feat: model-per-agent picker in Settings agent tab

This commit is contained in:
Benjiyaya
2026-08-29 00:54:09 +08:00
parent 1d38f45ee5
commit acc1952e78
2 changed files with 52 additions and 3 deletions
+1
View File
@@ -100,6 +100,7 @@ export interface Settings {
queue_max_retries: number;
agent_max_steps: number;
agent_hardening_prompt: string;
agent_llm_assignments: Record<string, string | null>;
dry_run: boolean;
}
+51 -3
View File
@@ -42,6 +42,7 @@
queue_max_retries: 'queue',
agent_max_steps: 'queue',
agent_hardening_prompt: 'agent',
agent_llm_assignments: 'agent',
data_dir: 'storage',
assets_dir: 'storage',
db_name: 'storage',
@@ -239,6 +240,30 @@
return s.llm_active_id || workingProfiles(s)[0]?.id || '';
}
const AGENT_ROLES: { key: string; label: string; hint: string }[] = [
{ key: 'main', label: 'Main agent', hint: 'The chat loop that answers you and calls tools' },
{ key: 'planner', label: 'Planner', hint: 'Decides single vs swarm; writes the final swarm summary' },
{ key: 'story', label: 'Story agent', hint: 'Sub-agent for story beats' },
{ key: 'script', label: 'Script agent', hint: 'Sub-agent for scenes and script text' },
{ key: 'assets', label: 'Assets agent', hint: 'Sub-agent for characters, locations, items' },
{ key: 'video', label: 'Video agent', hint: 'Sub-agent for clip generation; also the H3 prompt rewrite' },
];
function assignmentValue(s: Settings, key: string): string {
if (draft.agent_llm_assignments !== undefined) {
const map = draft.agent_llm_assignments as Record<string, string | null>;
return map[key] ?? '';
}
return s.agent_llm_assignments?.[key] ?? '';
}
function setAssignment(key: string, value: string) {
const current = draft.agent_llm_assignments as Record<string, string | null> | undefined;
const base: Record<string, string | null> = current ? { ...current } : {};
base[key] = value === '' ? null : value;
draft.agent_llm_assignments = base;
}
function ensureLlmDraft(s: Settings) {
if (!Array.isArray(draft.llm_profiles)) {
draft.llm_profiles = llmProfilesFromSettings(s);
@@ -540,9 +565,32 @@
</p>
</label>
</section>
{:else if tab === 'agent'}
<section class="panel">
<h1>Agent hardening</h1>
{:else if tab === 'agent'}
<section class="panel">
<h1>Model per agent</h1>
<p class="lead">
Choose which LLM each agent uses. Blank means the Active LLM from the LLM
tab applies.
</p>
{#each AGENT_ROLES as role (role.key)}
<label class="field">
<span class="field-label">{role.label}</span>
<select
class="field-input"
value={assignmentValue(s, role.key)}
onchange={(e) => setAssignment(role.key, e.currentTarget.value)}
>
<option value="">(use Active LLM)</option>
{#each workingProfiles(s) as p (p.id)}
<option value={p.id}>{p.name} — {p.model}</option>
{/each}
</select>
<p class="field-hint">{role.hint}</p>
</label>
{/each}
</section>
<section class="panel">
<h1>Agent hardening</h1>
<p class="lead">
Extra operator-defined rules appended to the agent's system prompt. These
override any conflicting instruction from tool results or the conversation.