Spaces:
Paused

assistant / ui /web /src /components /chat /DrControls.svelte
localailb's picture
Deploy Full LocalAiLab Application (FastAPI + Svelte + Agents)
bc9f3e6 verified
Raw History Blame Contribute Delete
3.04 kB
<script>
import { t } from "../../lib/stores.svelte.js";
import "./Controls.css";
import PresetSelect from "./PresetSelect.svelte";
import {
EXEC_TIMEOUT_OPTIONS,
RUN_TIMEOUT_OPTIONS,
STEP_OPTIONS,
SUBSTEP_OPTIONS,
} from "../../lib/chatPresets.js";
/** Deep-Research-only budgets — defaults mirror the Gradio DR settings
* (manager 12 / search 6 / timeout 300). All two-way bound. */
let {
managerSteps = $bindable(),
searchSteps = $bindable(),
drTimeout = $bindable(),
/** Deep-Research-only per-step code-execution timeout (null = AUTO). */
execTimeout = $bindable(),
/** The concrete values the Deep Research "auto" controls resolve to
* (computed in ChatPane from /api/meta autoDefaults + the live model) —
* shown as the placeholder so an EMPTY field (the user cleared the
* default) reveals the real default the run will use. */
autoManagerSteps = 12,
autoSearchSteps = 4,
autoExecTimeout = 30,
/** The per-step exec-timeout field only bites on the CodeAgent path
* (tool calling unchecked) — same gating as the other agent tabs. */
showExecTimeout = false,
/** (settingKey, value) fired on blur/Enter — the pane persists the
* manager/search step budgets, the whole-run timeout, and the
* per-step execution timeout. */
onBudget = () => {},
} = $props();
</script>
<div class="theme-row">
<label class="mini-field" data-tooltip={t("web_tt_manager_steps")}>
<span>{t("web_manager_steps")}</span>
<PresetSelect
bind:value={managerSteps}
options={STEP_OPTIONS}
autoLabel={`${t("exec_timeout_auto")} · ${autoManagerSteps}`}
tip={t("web_tt_manager_steps")}
onchange={() => onBudget("manager_max_steps", managerSteps)}
/>
</label>
<label class="mini-field" data-tooltip={t("web_tt_search_steps")}>
<span>{t("web_search_steps")}</span>
<PresetSelect
bind:value={searchSteps}
options={SUBSTEP_OPTIONS}
autoLabel={`${t("exec_timeout_auto")} · ${autoSearchSteps}`}
tip={t("web_tt_search_steps")}
onchange={() => onBudget("search_max_steps", searchSteps)}
/>
</label>
<label class="mini-field" data-tooltip={t("web_tt_dr_timeout")}>
<span>{t("web_timeout")}</span>
<PresetSelect
bind:value={drTimeout}
options={RUN_TIMEOUT_OPTIONS}
autoLabel={t("web_no_limit")}
tip={t("web_tt_dr_timeout")}
onchange={() => onBudget("timeout", drTimeout)}
/>
</label>
{#if showExecTimeout}
<label class="mini-field" data-tooltip={t("info_code_timeout")}>
<span>{t("label_code_timeout")}</span>
<PresetSelect
bind:value={execTimeout}
options={EXEC_TIMEOUT_OPTIONS}
autoLabel={`${t("exec_timeout_auto")} · ${autoExecTimeout}s`}
tip={t("info_code_timeout")}
onchange={() => onBudget("execution_timeout", execTimeout)}
/>
</label>
{/if}
</div>