Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 本机只改档位不再写回活动模型

Dash5021638a7910
diff --git a/apps/desktop/src/renderer/__tests__/deviceLinkInteractionScenarios.test.ts b/apps/desktop/src/renderer/__tests__/deviceLinkInteractionScenarios.test.ts
index cbab4dfe85..34e871eb3d 100644
--- a/apps/desktop/src/renderer/__tests__/deviceLinkInteractionScenarios.test.ts
+++ b/apps/desktop/src/renderer/__tests__/deviceLinkInteractionScenarios.test.ts
@@ -963,7 +963,7 @@ describe('远程交互接线不变式', () => {
expect(syncBody).toContain("opts.markModelChoice === true");
expect(syncBody).toContain('markModelChoice');
expect(syncBody).toContain('{ model: modelId, providerId: activeProviderId ?? null }');
- expect(syncBody).toContain(': { model: modelId }');
+ expect(syncBody).not.toContain(': { model: modelId }');
expect(syncBody).toContain(
'opts.remoteDeviceId ?? getSessionDeviceId(sessionId) ?? deviceLinkDeviceId',
);
diff --git a/apps/desktop/src/renderer/__tests__/newMakerDraft.test.ts b/apps/desktop/src/renderer/__tests__/newMakerDraft.test.ts
index 8df92cc166..01caeaa83d 100644
--- a/apps/desktop/src/renderer/__tests__/newMakerDraft.test.ts
+++ b/apps/desktop/src/renderer/__tests__/newMakerDraft.test.ts
@@ -420,6 +420,20 @@ describe('newMakerDraft store', () => {
expect(m1.getDraft().modelChosenByVendor).toEqual({ cc: true });
});
+ it('patchVendorPrefsPreservingModelChoice:未打标且不带 model 时不得改活动模型', async () => {
+ const m1 = await loadModule();
+ const seedModel = m1.getDraft().lastByVendor.cc.model;
+
+ m1.patchVendorPrefsPreservingModelChoice('cc', {
+ effort: 'high',
+ });
+
+ expect(m1.getDraft().lastByVendor.cc.model).toBe(seedModel);
+ expect(m1.getDraft().lastByVendor.cc.effort).toBe('high');
+ expect(m1.getDraft().modelChosenByVendor).toEqual({});
+ expect(m1.getPersistedVendorModel('cc')).toBe('');
+ });
+
it('patchVendorPrefsPreservingModelChoice:未打标时仍可写回活动模型与来源', async () => {
const m1 = await loadModule();
m1.patchVendorPrefsPreservingModelChoice('cc', {
diff --git a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
index 7d6d79edc0..03391b4d72 100644
--- a/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/ChatInput.tsx
@@ -5206,11 +5206,11 @@ export function ChatInput({
: 'cc';
const persistPrefs = markModelChoice ? patchVendorPrefs : patchVendorPrefsPreservingModelChoice;
persistPrefs(vendor, {
- // 换模才带配对并打标记。只改思考档时仍带当前 model,让 store
- // 判断是否与已保存模型一致;不一致则丢掉这次 effort。
+ // 换模才带配对并打标记。本机只改思考档 / Fast 不写回活动模型,
+ // 避免未打标用户把区域默认改成当前任务模型。
...(markModelChoice
? { model: modelId, providerId: activeProviderId ?? null }
- : { model: modelId }),
+ : {}),
...(patch.effort !== undefined ? { effort: patch.effort } : {}),
});
if (memoryProviderId) {