feat(actions): add scroll

This commit is contained in:
Gergő Móricz 2024-09-20 21:41:53 +02:00
parent 3dd912ec91
commit d663bbf0ca
3 changed files with 11 additions and 1 deletions

View File

@ -78,6 +78,10 @@ export const actionsSchema = z.array(z.union([
type: z.literal("pressKey"), type: z.literal("pressKey"),
key: z.string(), key: z.string(),
}), }),
z.object({
type: z.literal("scroll"),
direction: z.enum(["up", "down"]),
}),
])); ]));
export const scrapeOptions = z.object({ export const scrapeOptions = z.object({

View File

@ -25,6 +25,9 @@ export type Action = {
} | { } | {
type: "pressKey", type: "pressKey",
key: string, key: string,
} | {
type: "scroll",
direction: "up" | "down"
}; };
export type PageOptions = { export type PageOptions = {

View File

@ -99,7 +99,10 @@ export type Action = {
} | { } | {
type: "pressKey", type: "pressKey",
key: string, key: string,
};; } | {
type: "scroll",
direction: "up" | "down",
};
export interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions { export interface ScrapeParams<LLMSchema extends zt.ZodSchema = any, ActionsSchema extends (Action[] | undefined) = undefined> extends CrawlScrapeOptions {
extract?: { extract?: {