The open source AI video agent: turns any coding agent into a video agent, with an editor to change anything it makes.
Desktop: the options the chat picked reach the agent after a model change (#67)
最爱双皮奶4047538da314
diff --git a/.changeset/lucky-mice-speak.md b/.changeset/lucky-mice-speak.mdnew file mode 100644index 0000000..bcd04cd--- /dev/null+++ b/.changeset/lucky-mice-speak.md@@ -0,0 +1,5 @@+---+'@openfilm/desktop': patch+---++Desktop: the thinking effort picked in the chat reaches the agent after a model change, even when the agent resets it to its own default when the model changes.diff --git a/apps/desktop/chat/src/lib/desktop-bridge.ts b/apps/desktop/chat/src/lib/desktop-bridge.tsindex cf6e5ae..2ba7091 100644--- a/apps/desktop/chat/src/lib/desktop-bridge.ts+++ b/apps/desktop/chat/src/lib/desktop-bridge.ts@@ -210,7 +210,7 @@ export interface DesktopBridge {/** What the agent does with nobody having written is the turn `turnId` (null: no longer), in its log. */adopt?(key: string, turnId: string | null, meta?: LocalAgentTurnMeta): Promise<{ ok: boolean }>;cancel(key: string): Promise<{ ok: true }>;- setOption(key: string, configId: string, value: unknown): Promise<{ ok: boolean; error?: string }>;+ setOption(key: string, configId: string, value: unknown): Promise<{ ok: boolean; error?: string; result?: { configOptions?: LocalAgentSessionInfo['configOptions'] } }>;answerPermission(key: string, requestId: string, optionId: string | null): Promise<{ ok: boolean }>;/** Answers its question; null = skip. Older shells lack it (and never ask). */answerQuestion?(key: string, requestId: string, answers: Record<string, LocalAgentAnswer> | null): Promise<{ ok: boolean }>;diff --git a/apps/desktop/chat/src/lib/local-agent-run.ts b/apps/desktop/chat/src/lib/local-agent-run.tsindex 7e86ca3..b1303e9 100644--- a/apps/desktop/chat/src/lib/local-agent-run.ts+++ b/apps/desktop/chat/src/lib/local-agent-run.ts@@ -848,19 +848,23 @@ export async function runLocalAgentTurn({endUnprompted(session.key);turnByKey.set(session.key, turn);- /* Picked options: set only when they differ from the session's current value, saving a round trip. The model- first (it decides which efforts there are), then the rest at once */+ /* Picked options: set only when they differ from what the session holds, the model first (it decides which efforts+ there are), then the rest one after another. An agent may change other options when one is set (MiniMax Code+ resets its thinking effort when the model changes), so what it answers replaces what the session holds */const live = session;const setOption = async ([configId, value]: [string, unknown]) => {const option = live.info.configOptions?.find((o) => o.id === configId);if (!option || option.currentValue === value) return;const r = await bridge.setOption(live.key, configId, value);- if (r.ok) option.currentValue = value;+ if (!r.ok) return;+ const answered = r.result?.configOptions;+ if (Array.isArray(answered) && answered.length) live.info.configOptions = answered;+ else option.currentValue = value;};const picked = Object.entries(options);const isModel = ([configId]: [string, unknown]) => live.info.configOptions?.find((o) => o.id === configId)?.category === 'model';for (const entry of picked.filter(isModel)) await setOption(entry);- await Promise.all(picked.filter((entry) => !isModel(entry)).map(setOption));+ for (const entry of picked.filter((entry) => !isModel(entry))) await setOption(entry);/* where it is and how to work (the project, the `openfilm` manual, Studio already open) it was told when thesession started (apps/desktop src/agents.mjs INSTRUCTIONS): the message goes as the person wrote it */