mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-04 08:30:31 +00:00
agent: add markdown command
This commit is contained in:
@@ -16,6 +16,7 @@ pub const Command = union(enum) {
|
||||
type_cmd: TypeArgs,
|
||||
wait: []const u8,
|
||||
tree: void,
|
||||
markdown: void,
|
||||
extract: ExtractArgs,
|
||||
eval_js: []const u8,
|
||||
exit: void,
|
||||
@@ -61,6 +62,10 @@ pub fn parse(line: []const u8) Command {
|
||||
return .{ .tree = {} };
|
||||
}
|
||||
|
||||
if (eqlIgnoreCase(cmd_word, "MARKDOWN") or eqlIgnoreCase(cmd_word, "MD")) {
|
||||
return .{ .markdown = {} };
|
||||
}
|
||||
|
||||
if (eqlIgnoreCase(cmd_word, "EXTRACT")) {
|
||||
const selector = extractQuoted(rest) orelse {
|
||||
if (rest.len == 0) return .{ .natural_language = trimmed };
|
||||
|
||||
@@ -28,6 +28,7 @@ pub fn execute(self: *Self, cmd: Command.Command) void {
|
||||
.type_cmd => |args| self.execType(a, args),
|
||||
.wait => |selector| self.tool_executor.call(a, "waitForSelector", buildJson(a, .{ .selector = selector })) catch "Error: wait failed",
|
||||
.tree => self.tool_executor.call(a, "semantic_tree", "") catch "Error: tree failed",
|
||||
.markdown => self.tool_executor.call(a, "markdown", "") catch "Error: markdown failed",
|
||||
.extract => |args| self.execExtract(a, args),
|
||||
.eval_js => |script| self.tool_executor.call(a, "evaluate", buildJson(a, .{ .script = script })) catch "Error: eval failed",
|
||||
.exit, .natural_language => unreachable,
|
||||
|
||||
Reference in New Issue
Block a user