Spaces:
Paused

assistant / ui /web /src /components /chat /AgentControls.svelte
localailb's picture
Deploy Full LocalAiLab Application (FastAPI + Svelte + Agents)
bc9f3e6 verified
Raw History Blame Contribute Delete
2.81 kB
<script>
import { t } from "../../lib/stores.svelte.js";
import "./Controls.css";
import PresetSelect from "./PresetSelect.svelte";
import { EXEC_TIMEOUT_OPTIONS, STEP_OPTIONS, SUBSTEP_OPTIONS } from "../../lib/chatPresets.js";
/**
* Agentic-mode budgets for the chat tabs that run a manager agent
* (General: single agent; RAG: manager + knowledge_searcher sub-agent).
* Rendered ONLY while agentic mode is on (ChatPane gates it), so direct
* mode users never see these fields. null = AUTO — the backend applies its
* own default (model-scaled step budget / factory execution timeout), so an
* untouched control never overrides the defaults; typing a number sets an
* explicit value and clearing the field ("auto" placeholder) returns to auto.
*/
let {
maxSteps = $bindable(),
searcherSteps = $bindable(),
execTimeout = $bindable(),
showSearcher = false,
/** Per-step code-execution timeout field (General / RAG agentic). */
showExecTimeout = false,
/** The concrete values this tab's "auto" controls resolve to (computed
* in ChatPane from /api/meta autoDefaults + the live model) — shown as
* the placeholder so an empty field reveals the real default, never the
* opaque word "auto". */
autoMaxSteps = 8,
autoSearcherSteps = 5,
autoExecTimeout = 30,
/** (settingKey, value) fired on blur/Enter — the pane persists the
* budget (value null = back to auto) and refreshes the meta store. */
onSteps = () => {},
} = $props();
</script>
<div class="theme-row">
<label class="mini-field" data-tooltip={t("info_max_steps")}>
<span>{t("label_max_steps")}</span>
<PresetSelect
bind:value={maxSteps}
options={STEP_OPTIONS}
autoLabel={`${t("exec_timeout_auto")} · ${autoMaxSteps}`}
tip={t("info_max_steps")}
onchange={() => onSteps("agent_max_steps", maxSteps)}
/>
</label>
{#if showSearcher}
<label class="mini-field" data-tooltip={t("web_tt_search_steps")}>
<span>{t("web_search_steps")}</span>
<PresetSelect
bind:value={searcherSteps}
options={SUBSTEP_OPTIONS}
autoLabel={`${t("exec_timeout_auto")} · ${autoSearcherSteps}`}
tip={t("web_tt_search_steps")}
onchange={() => onSteps("searcher_max_steps", searcherSteps)}
/>
</label>
{/if}
{#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={() => onSteps("execution_timeout", execTimeout)}
/>
</label>
{/if}
</div>