Skip to content

Commit

Permalink
fix: loosen schema (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen authored May 23, 2024
1 parent e5cbf8f commit c98b994
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/helpers/rpc/performAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ function createOperateTool(
console.log("operateTool", action);
switch (action.name) {
case "scroll":
await scroll(domActions, action.args.value);
await scroll(domActions, action?.args?.value ?? "down");
break;
case "wait":
await sleep(3000);
Expand Down
10 changes: 6 additions & 4 deletions src/helpers/vision-agent/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ export const scrollSchema = z.object({
'Scroll the page to see the other parts. Use "up" or "down" to scroll 2/3 of height of the window. Use "top" or "bottom" to quickly scroll to the top or bottom of the page.',
)
.optional(),
args: z.object({
value: z.string(),
}),
args: z
.object({
value: z.string(),
})
.optional(),
});

export const waitSchema = z.object({
Expand All @@ -67,7 +69,7 @@ export const waitSchema = z.object({
"Wait for 3 seconds before the next action. Useful when the page is loading.",
)
.optional(),
args: z.object({}),
args: z.object({}).optional(),
});

export const finishSchema = z.object({
Expand Down

0 comments on commit c98b994

Please sign in to comment.