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

@@ -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({