Spaces:
Paused

File size: 2,805 Bytes
bc9f3e6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<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>