rename variable (#2865)

This commit is contained in:
Shuchang Zheng
2025-07-03 02:03:01 -07:00
committed by GitHub
parent 73d6743c87
commit 393387acb0
34 changed files with 118 additions and 126 deletions

View File

@@ -143,7 +143,7 @@ export type CreateTaskRequest = {
totp_identifier?: string | null;
application?: string | null;
include_action_history_in_verification?: boolean | null;
max_screenshot_scrolling_times?: number | null;
max_screenshot_scrolls?: number | null;
};
export type User = {
@@ -298,7 +298,7 @@ export type WorkflowRunStatusApiResponse = {
task_v2: TaskV2 | null;
workflow_title: string | null;
browser_session_id: string | null;
max_screenshot_scrolling_times: number | null;
max_screenshot_scrolls: number | null;
};
export type TaskGenerationApiResponse = {

View File

@@ -40,7 +40,7 @@ import {
} from "./taskFormTypes";
import { ProxySelector } from "@/components/ProxySelector";
import { Switch } from "@/components/ui/switch";
import { MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT } from "@/routes/workflows/editor/nodes/Taskv2Node/types";
import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "@/routes/workflows/editor/nodes/Taskv2Node/types";
type Props = {
initialValues: CreateNewTaskFormValues;
};
@@ -91,7 +91,7 @@ function createTaskRequestObject(
extra_http_headers: extraHttpHeaders,
totp_identifier: transform(formValues.totpIdentifier),
error_code_mapping: errorCodeMapping,
max_screenshot_scrolling_times: formValues.maxScreenshotScrollingTimes,
max_screenshot_scrolls: formValues.maxScreenshotScrolls,
include_action_history_in_verification:
formValues.includeActionHistoryInVerification,
};
@@ -126,8 +126,7 @@ function CreateNewTaskForm({ initialValues }: Props) {
...initialValues,
maxStepsOverride: initialValues.maxStepsOverride ?? null,
proxyLocation: initialValues.proxyLocation ?? ProxyLocation.Residential,
maxScreenshotScrollingTimes:
initialValues.maxScreenshotScrollingTimes ?? null,
maxScreenshotScrolls: initialValues.maxScreenshotScrolls ?? null,
},
});
const { errors } = useFormState({ control: form.control });
@@ -573,17 +572,15 @@ function CreateNewTaskForm({ initialValues }: Props) {
/>
<FormField
control={form.control}
name="maxScreenshotScrollingTimes"
name="maxScreenshotScrolls"
render={({ field }) => (
<FormItem>
<div className="flex gap-16">
<FormLabel>
<div className="w-72">
<h1 className="text-lg">
Max Scrolling Screenshots
</h1>
<h1 className="text-lg">Max Screenshot Scrolls</h1>
<h2 className="text-base text-slate-400">
{`The maximum number of times to scroll down the page to take merged screenshots after action. Default is ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
{`The maximum number of scrolls for the post action screenshot. Default is ${MAX_SCREENSHOT_SCROLLS_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
</h2>
</div>
</FormLabel>
@@ -594,7 +591,7 @@ function CreateNewTaskForm({ initialValues }: Props) {
type="number"
min={0}
value={field.value ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}`}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLS_DEFAULT}`}
onChange={(event) => {
const value =
event.target.value === ""

View File

@@ -62,7 +62,7 @@ function CreateNewTaskFormPage() {
webhookCallbackUrl: null,
proxyLocation: null,
includeActionHistoryInVerification: null,
maxScreenshotScrollingTimes: null,
maxScreenshotScrolls: null,
extraHttpHeaders: null,
}}
/>
@@ -133,7 +133,7 @@ function CreateNewTaskFormPage() {
includeActionHistoryInVerification:
data.workflow_definition.blocks[0]
.include_action_history_in_verification,
maxScreenshotScrollingTimes: data.max_screenshot_scrolling_times,
maxScreenshotScrolls: data.max_screenshot_scrolls,
extraHttpHeaders: data.extra_http_headers
? JSON.stringify(data.extra_http_headers)
: null,

View File

@@ -45,7 +45,7 @@ import {
} from "../data/sampleTaskData";
import { ExampleCasePill } from "./ExampleCasePill";
import {
MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT,
MAX_SCREENSHOT_SCROLLS_DEFAULT,
MAX_STEPS_DEFAULT,
} from "@/routes/workflows/editor/nodes/Taskv2Node/types";
@@ -158,8 +158,9 @@ function PromptBox() {
const [publishWorkflow, setPublishWorkflow] = useState(false);
const [totpIdentifier, setTotpIdentifier] = useState("");
const [maxStepsOverride, setMaxStepsOverride] = useState<string | null>(null);
const [maxScreenshotScrollingTimes, setMaxScreenshotScrollingTimes] =
useState<string | null>(null);
const [maxScreenshotScrolls, setMaxScreenshotScrolls] = useState<
string | null
>(null);
const [showAdvancedSettings, setShowAdvancedSettings] = useState(false);
const [dataSchema, setDataSchema] = useState<string | null>(null);
const [extraHttpHeaders, setExtraHttpHeaders] = useState<string | null>(null);
@@ -176,7 +177,7 @@ function PromptBox() {
browser_session_id: browserSessionId,
totp_identifier: totpIdentifier,
publish_workflow: publishWorkflow,
max_screenshot_scrolling_times: maxScreenshotScrollingTimes,
max_screenshot_scrolls: maxScreenshotScrolls,
extracted_information_schema: dataSchema
? (() => {
try {
@@ -498,16 +499,16 @@ function PromptBox() {
</div>
<div className="flex gap-16">
<div className="w-48 shrink-0">
<div className="text-sm">Max Scrolling Screenshots</div>
<div className="text-sm">Max Screenshot Scrolls</div>
<div className="text-xs text-slate-400">
{`The maximum number of times to scroll down the page to take merged screenshots after action. Default is ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
{`The maximum number of scrolls for the post action screenshot. Default is ${MAX_SCREENSHOT_SCROLLS_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
</div>
</div>
<Input
value={maxScreenshotScrollingTimes ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}`}
value={maxScreenshotScrolls ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLS_DEFAULT}`}
onChange={(event) => {
setMaxScreenshotScrollingTimes(event.target.value);
setMaxScreenshotScrolls(event.target.value);
}}
/>
</div>

View File

@@ -44,8 +44,7 @@ function RetryTask() {
proxyLocation: task.request.proxy_location ?? null,
includeActionHistoryInVerification:
task.request.include_action_history_in_verification ?? false,
maxScreenshotScrollingTimes:
task.request.max_screenshot_scrolling_times ?? null,
maxScreenshotScrolls: task.request.max_screenshot_scrolls ?? null,
extraHttpHeaders: task.request.extra_http_headers
? JSON.stringify(task.request.extra_http_headers)
: null,

View File

@@ -16,7 +16,7 @@ const createNewTaskFormSchemaBase = z.object({
errorCodeMapping: z.string().or(z.null()),
proxyLocation: z.nativeEnum(ProxyLocation).or(z.null()),
includeActionHistoryInVerification: z.boolean().or(z.null()).default(false),
maxScreenshotScrollingTimes: z.number().or(z.null()).default(null),
maxScreenshotScrolls: z.number().or(z.null()).default(null),
});
const savedTaskFormSchemaBase = createNewTaskFormSchemaBase.extend({

View File

@@ -7,7 +7,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { Switch } from "@/components/ui/switch";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
import { MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT } from "@/routes/workflows/editor/nodes/Taskv2Node/types";
import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "@/routes/workflows/editor/nodes/Taskv2Node/types";
import { useQuery } from "@tanstack/react-query";
import { useParams } from "react-router-dom";
@@ -147,14 +147,14 @@ function TaskParameters() {
</div>
<div className="flex gap-16">
<div className="w-72">
<h1 className="text-lg">Max Scrolling Screenshots</h1>
<h1 className="text-lg">Max Screenshot Scrolls</h1>
<h2 className="text-base text-slate-400">
The maximum number of times to scroll the page
</h2>
</div>
<Input
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}`}
value={task.request.max_screenshot_scrolling_times ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLS_DEFAULT}`}
value={task.request.max_screenshot_scrolls ?? ""}
readOnly
/>
</div>

View File

@@ -29,14 +29,14 @@ import { WorkflowParameter } from "./types/workflowTypes";
import { WorkflowParameterInput } from "./WorkflowParameterInput";
import { AxiosError } from "axios";
import { getLabelForWorkflowParameterType } from "./editor/workflowEditorUtils";
import { MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT } from "./editor/nodes/Taskv2Node/types";
import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "./editor/nodes/Taskv2Node/types";
type Props = {
workflowParameters: Array<WorkflowParameter>;
initialValues: Record<string, unknown>;
initialSettings: {
proxyLocation: ProxyLocation;
webhookCallbackUrl: string;
maxScreenshotScrollingTimes: number | null;
maxScreenshotScrolls: number | null;
extraHttpHeaders: Record<string, string> | null;
};
};
@@ -77,7 +77,7 @@ type RunWorkflowRequestBody = {
proxy_location: ProxyLocation | null;
webhook_callback_url?: string | null;
browser_session_id: string | null;
max_screenshot_scrolling_times?: number | null;
max_screenshot_scrolls?: number | null;
extra_http_headers?: Record<string, string> | null;
};
@@ -89,7 +89,7 @@ function getRunWorkflowRequestBody(
webhookCallbackUrl,
proxyLocation,
browserSessionId,
maxScreenshotScrollingTimes,
maxScreenshotScrolls,
extraHttpHeaders,
...parameters
} = values;
@@ -107,8 +107,8 @@ function getRunWorkflowRequestBody(
browser_session_id: bsi,
};
if (maxScreenshotScrollingTimes) {
body.max_screenshot_scrolling_times = maxScreenshotScrollingTimes;
if (maxScreenshotScrolls) {
body.max_screenshot_scrolls = maxScreenshotScrolls;
}
if (webhookCallbackUrl) {
@@ -131,7 +131,7 @@ type RunWorkflowFormType = Record<string, unknown> & {
webhookCallbackUrl: string;
proxyLocation: ProxyLocation;
browserSessionId: string | null;
maxScreenshotScrollingTimes: number | null;
maxScreenshotScrolls: number | null;
extraHttpHeaders: string | null;
};
@@ -154,7 +154,7 @@ function RunWorkflowForm({
webhookCallbackUrl: initialSettings.webhookCallbackUrl,
proxyLocation: initialSettings.proxyLocation,
browserSessionId: browserSessionIdDefault,
maxScreenshotScrollingTimes: initialSettings.maxScreenshotScrollingTimes,
maxScreenshotScrolls: initialSettings.maxScreenshotScrolls,
extraHttpHeaders: initialSettings.extraHttpHeaders
? JSON.stringify(initialSettings.extraHttpHeaders)
: null,
@@ -208,7 +208,7 @@ function RunWorkflowForm({
webhookCallbackUrl,
proxyLocation,
browserSessionId,
maxScreenshotScrollingTimes,
maxScreenshotScrolls,
extraHttpHeaders,
...parameters
} = values;
@@ -222,7 +222,7 @@ function RunWorkflowForm({
webhookCallbackUrl,
proxyLocation,
browserSessionId,
maxScreenshotScrollingTimes,
maxScreenshotScrolls,
extraHttpHeaders,
});
}
@@ -462,9 +462,9 @@ function RunWorkflowForm({
}}
/>
<FormField
key="maxScreenshotScrollingTimes"
key="maxScreenshotScrolls"
control={form.control}
name="maxScreenshotScrollingTimes"
name="maxScreenshotScrolls"
render={({ field }) => {
return (
<FormItem>
@@ -472,10 +472,10 @@ function RunWorkflowForm({
<FormLabel>
<div className="w-72">
<div className="flex items-center gap-2 text-lg">
Max Scrolling Screenshots
Max Screenshot Scrolls
</div>
<h2 className="text-sm text-slate-400">
{`The maximum number of times to scroll down the page to take merged screenshots after action. Default is ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
{`The maximum number of scrolls for the post action screenshot. Default is ${MAX_SCREENSHOT_SCROLLS_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
</h2>
</div>
</FormLabel>
@@ -486,7 +486,7 @@ function RunWorkflowForm({
type="number"
min={0}
value={field.value ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}`}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLS_DEFAULT}`}
onChange={(event) => {
const value =
event.target.value === ""

View File

@@ -100,8 +100,7 @@ function WorkflowRun() {
const parameters = workflowRun?.parameters ?? {};
const proxyLocation =
workflowRun?.proxy_location ?? ProxyLocation.Residential;
const maxScreenshotScrollingTimes =
workflowRun?.max_screenshot_scrolling_times ?? null;
const maxScreenshotScrolls = workflowRun?.max_screenshot_scrolls ?? null;
const title = workflowIsLoading ? (
<Skeleton className="h-9 w-48" />
@@ -246,7 +245,7 @@ function WorkflowRun() {
data: parameters,
proxyLocation,
webhookCallbackUrl: workflowRun?.webhook_callback_url ?? "",
maxScreenshotScrollingTimes,
maxScreenshotScrolls,
}}
>
<PlayIcon className="mr-2 h-4 w-4" />

View File

@@ -30,8 +30,7 @@ function WorkflowRunParameters() {
const proxyLocation = location.state
? (location.state.proxyLocation as ProxyLocation)
: null;
const maxScreenshotScrollingTimes =
location.state?.maxScreenshotScrollingTimes ?? null;
const maxScreenshotScrolls = location.state?.maxScreenshotScrolls ?? null;
const webhookCallbackUrl = location.state
? (location.state.webhookCallbackUrl as string)
@@ -115,10 +114,8 @@ function WorkflowRunParameters() {
ProxyLocation.Residential,
webhookCallbackUrl:
webhookCallbackUrl ?? workflow.webhook_callback_url ?? "",
maxScreenshotScrollingTimes:
maxScreenshotScrollingTimes ??
workflow.max_screenshot_scrolling_times ??
null,
maxScreenshotScrolls:
maxScreenshotScrolls ?? workflow.max_screenshot_scrolls ?? null,
extraHttpHeaders:
extraHttpHeaders ?? workflow.extra_http_headers ?? null,
}}

View File

@@ -322,8 +322,7 @@ function FlowRenderer({
webhook_callback_url: data.settings.webhookCallbackUrl,
persist_browser_session: data.settings.persistBrowserSession,
model: data.settings.model,
max_screenshot_scrolling_times:
data.settings.maxScreenshotScrollingTimes,
max_screenshot_scrolls: data.settings.maxScreenshotScrolls,
totp_verification_url: workflow.totp_verification_url,
extra_http_headers: extraHttpHeaders,
workflow_definition: {

View File

@@ -60,7 +60,7 @@ function WorkflowEditor() {
proxyLocation: workflow.proxy_location,
webhookCallbackUrl: workflow.webhook_callback_url,
model: workflow.model,
maxScreenshotScrollingTimes: workflow.max_screenshot_scrolling_times,
maxScreenshotScrolls: workflow.max_screenshot_scrolls,
extraHttpHeaders: workflow.extra_http_headers
? JSON.stringify(workflow.extra_http_headers)
: null,

View File

@@ -20,7 +20,7 @@ import { Separator } from "@/components/ui/separator";
import { ModelsResponse } from "@/api/types";
import { ModelSelector } from "@/components/ModelSelector";
import { WorkflowModel } from "@/routes/workflows/types/workflowTypes";
import { MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT } from "../Taskv2Node/types";
import { MAX_SCREENSHOT_SCROLLS_DEFAULT } from "../Taskv2Node/types";
import { KeyValueInput } from "@/components/KeyValueInput";
function StartNode({ id, data }: NodeProps<StartNode>) {
@@ -53,8 +53,8 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
? data.persistBrowserSession
: false,
model: data.withWorkflowSettings ? data.model : workflowModel,
maxScreenshotScrollingTimes: data.withWorkflowSettings
? data.maxScreenshotScrollingTimes
maxScreenshotScrolls: data.withWorkflowSettings
? data.maxScreenshotScrolls
: null,
extraHttpHeaders: data.withWorkflowSettings ? data.extraHttpHeaders : null,
});
@@ -151,21 +151,21 @@ function StartNode({ id, data }: NodeProps<StartNode>) {
</div>
<div className="space-y-2">
<div className="flex items-center gap-2">
<Label>Max Scrolling Screenshots</Label>
<Label>Max Screenshot Scrolls</Label>
<HelpTooltip
content={`The maximum number of times to scroll down the page to take merged screenshots after action. Default is ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
content={`The maximum number of scrolls for the post action screenshot. Default is ${MAX_SCREENSHOT_SCROLLS_DEFAULT}. If it's set to 0, it will take the current viewport screenshot.`}
/>
</div>
<Input
value={inputs.maxScreenshotScrollingTimes ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT}`}
value={inputs.maxScreenshotScrolls ?? ""}
placeholder={`Default: ${MAX_SCREENSHOT_SCROLLS_DEFAULT}`}
onChange={(event) => {
const value =
event.target.value === ""
? null
: Number(event.target.value);
handleChange("maxScreenshotScrollingTimes", value);
handleChange("maxScreenshotScrolls", value);
}}
/>
</div>

View File

@@ -9,7 +9,7 @@ export type WorkflowStartNodeData = {
proxyLocation: ProxyLocation;
persistBrowserSession: boolean;
model: WorkflowModel | null;
maxScreenshotScrollingTimes: number | null;
maxScreenshotScrolls: number | null;
extraHttpHeaders: string | null;
editable: boolean;
};

View File

@@ -2,7 +2,7 @@ import { Node } from "@xyflow/react";
import { NodeBaseData } from "../types";
export const MAX_STEPS_DEFAULT = 25;
export const MAX_SCREENSHOT_SCROLLING_TIMES_DEFAULT = 3;
export const MAX_SCREENSHOT_SCROLLS_DEFAULT = 3;
export type Taskv2NodeData = NodeBaseData & {
prompt: string;
@@ -10,7 +10,7 @@ export type Taskv2NodeData = NodeBaseData & {
totpVerificationUrl: string | null;
totpIdentifier: string | null;
maxSteps: number | null;
maxScreenshotScrollingTimes: number | null;
maxScreenshotScrolls: number | null;
};
export type Taskv2Node = Node<Taskv2NodeData, "taskv2">;
@@ -25,7 +25,7 @@ export const taskv2NodeDefaultData: Taskv2NodeData = {
totpVerificationUrl: null,
maxSteps: MAX_STEPS_DEFAULT,
model: null,
maxScreenshotScrollingTimes: null,
maxScreenshotScrolls: null,
};
export function isTaskV2Node(node: Node): node is Taskv2Node {

View File

@@ -251,7 +251,7 @@ function convertToNode(
maxSteps: block.max_steps,
totpIdentifier: block.totp_identifier,
totpVerificationUrl: block.totp_verification_url,
maxScreenshotScrollingTimes: null,
maxScreenshotScrolls: null,
},
};
}
@@ -663,7 +663,7 @@ function getElements(
proxyLocation: settings.proxyLocation ?? ProxyLocation.Residential,
webhookCallbackUrl: settings.webhookCallbackUrl ?? "",
model: settings.model,
maxScreenshotScrollingTimes: settings.maxScreenshotScrollingTimes,
maxScreenshotScrolls: settings.maxScreenshotScrolls,
extraHttpHeaders: settings.extraHttpHeaders,
editable,
}),
@@ -1325,7 +1325,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
proxyLocation: ProxyLocation.Residential,
webhookCallbackUrl: null,
model: null,
maxScreenshotScrollingTimes: null,
maxScreenshotScrolls: null,
extraHttpHeaders: null,
};
const startNodes = nodes.filter(isStartNode);
@@ -1342,7 +1342,7 @@ function getWorkflowSettings(nodes: Array<AppNode>): WorkflowSettings {
proxyLocation: data.proxyLocation,
webhookCallbackUrl: data.webhookCallbackUrl,
model: data.model,
maxScreenshotScrollingTimes: data.maxScreenshotScrollingTimes,
maxScreenshotScrolls: data.maxScreenshotScrolls,
extraHttpHeaders: data.extraHttpHeaders,
};
}
@@ -1999,7 +1999,7 @@ function convert(workflow: WorkflowApiResponse): WorkflowCreateYAMLRequest {
persist_browser_session: workflow.persist_browser_session,
model: workflow.model,
totp_verification_url: workflow.totp_verification_url,
max_screenshot_scrolling_times: workflow.max_screenshot_scrolling_times,
max_screenshot_scrolls: workflow.max_screenshot_scrolls,
extra_http_headers: workflow.extra_http_headers,
workflow_definition: {
parameters: convertParametersToParameterYAML(userParameters),

View File

@@ -471,7 +471,7 @@ export type WorkflowApiResponse = {
model: WorkflowModel | null;
totp_verification_url: string | null;
totp_identifier: string | null;
max_screenshot_scrolling_times: number | null;
max_screenshot_scrolls: number | null;
created_at: string;
modified_at: string;
deleted_at: string | null;
@@ -482,7 +482,7 @@ export type WorkflowSettings = {
webhookCallbackUrl: string | null;
persistBrowserSession: boolean;
model: WorkflowModel | null;
maxScreenshotScrollingTimes: number | null;
maxScreenshotScrolls: number | null;
extraHttpHeaders: string | null;
};

View File

@@ -12,7 +12,7 @@ export type WorkflowCreateYAMLRequest = {
totp_verification_url?: string | null;
workflow_definition: WorkflowDefinitionYAML;
is_saved_task?: boolean;
max_screenshot_scrolling_times?: number | null;
max_screenshot_scrolls?: number | null;
extra_http_headers?: Record<string, string> | null;
};