Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(providers): address speech setup review regressions
JiangJiahao8b335c8cccab
diff --git a/apps/desktop/scripts/fixtures/provider-speech-setup/provider-speech-setup-fixture.tsx b/apps/desktop/scripts/fixtures/provider-speech-setup/provider-speech-setup-fixture.tsxindex 43ec949399..0f3d2701af 100644--- a/apps/desktop/scripts/fixtures/provider-speech-setup/provider-speech-setup-fixture.tsx+++ b/apps/desktop/scripts/fixtures/provider-speech-setup/provider-speech-setup-fixture.tsx@@ -131,7 +131,11 @@ void mountPage({safeStorageRead: async () => 'fixture-key',maker: {listProviderPresets: async () => ({- presets: BUNDLED_CATALOG.presets!.filter((p) => p.id === 'minimax-global'),+ presets: ctx.case === 'bailian-fallback' ? [{+ id: 'bailian-empty', name: 'Fallback API', runtimes: {+ codex: { baseUrl: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1', models: [] },+ },+ }] : BUNDLED_CATALOG.presets!.filter((p) => p.id === 'minimax-global'),}),localModelList: async () => ({status: { runtime: 'ollama', kind: 'absent', appInstalled: false },diff --git a/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs b/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjsindex b10dd02572..9318f87ebc 100644--- a/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs@@ -16,6 +16,7 @@ export default {bailian: {about: 'Alibaba Cloud speech recommendations visible above 100 discovered chat models',},+ 'bailian-fallback': { about: 'An empty mixed preset with failed discovery keeps manual chat entry beside speech suggestions' },'bailian-existing': {about: 'Existing Beijing workspace recommends CosyVoice and preserves its chat model',},@@ -37,7 +38,7 @@ export default {await page.getByTestId('add-provider').click();await ui.capture('single-add-entry');const name =- ui.case === 'minimax' ? /MiniMax/ : ui.case === 'elevenlabs' ? /ElevenLabs/ : /API/;+ ui.case === 'minimax' ? /MiniMax/ : ui.case === 'elevenlabs' ? /ElevenLabs/ : ui.case === 'bailian-fallback' ? /Fallback API/ : /API/;const buttons = page.getByRole('dialog').getByRole('button').filter({ hasText: name });await buttons.first().click();if (ui.case === 'minimax')@@ -57,7 +58,7 @@ export default {const recommendedId =ui.case === 'elevenlabs'? 'eleven_flash_v2_5'- : ui.case === 'bailian'+ : ['bailian', 'bailian-fallback'].includes(ui.case)? 'qwen3-tts-flash': ui.case === 'bailian-existing'? 'cosyvoice-v3-flash'@@ -75,12 +76,21 @@ export default {}await recommended.scrollIntoViewIfNeeded();await ui.capture('models');+ if (ui.case === 'bailian-fallback') {+ const manual = page.getByPlaceholder(await ui.t('settings.providers.wizard.manualModelPlaceholder'));+ await manual.fill('my-new-chat-model');+ await page.getByRole('button', { name: await ui.t('settings.providers.wizard.addManualModel'), exact: true }).click();+ await manual.scrollIntoViewIfNeeded();+ await ui.capture('chat-fallback');+ }const finish = existing? 'settings.providers.wizard.addManualModel': 'settings.providers.wizard.finish';await page.getByRole('button', { name: await ui.t(finish), exact: true }).click();await page.getByTestId('saved').waitFor();assert.ok((await page.getByTestId('saved').textContent()).includes(recommendedId));+ if (ui.case === 'bailian-fallback')+ assert.ok((await page.getByTestId('saved').textContent()).includes('my-new-chat-model'));if (ui.case === 'default')assert.ok((await page.getByTestId('saved').textContent()).includes('MiniMax-M3'));if (ui.case === 'bailian-existing')diff --git a/apps/desktop/scripts/fixtures/voice-settings/ui-page.mjs b/apps/desktop/scripts/fixtures/voice-settings/ui-page.mjsindex 870d3b9cf0..e3337a4043 100644--- a/apps/desktop/scripts/fixtures/voice-settings/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/voice-settings/ui-page.mjs@@ -30,6 +30,8 @@ export default {about: 'Eleven v3 keeps voice and preview but does not offer a speed slider',data: { modelId: 'eleven_v3' },},+ hidden: { about: 'A saved hidden model remains displayed without offering other unchecked speech models', data: { hidden: true } },+ 'hidden-empty': { about: 'Hidden models are not selected automatically without a saved preference', data: { hidden: true, noPreference: true } },empty: {about: 'No models keeps only the existing setup introduction and provider link',data: { empty: true },@@ -54,7 +56,7 @@ export default {},},async ready(page) {- const empty = await page.evaluate(() => window.__uiPage.ctx.data.empty);+ const empty = await page.evaluate(() => window.__uiPage.ctx.data.empty || window.__uiPage.ctx.data.noPreference);if (empty) await page.getByRole('button').first().waitFor();else if (await page.evaluate(() => window.__uiPage.ctx.data.manual)) {const label = await page.evaluate(() => window.__uiPage.t('bots.voiceMode.voiceId'));@@ -110,6 +112,22 @@ export default {return;}assert.equal(await standalonePreview.count(), 0);+ if (ui.data.hidden) {+ const model = page.getByRole('combobox', { name: await ui.t('bots.voiceMode.model'), exact: true });+ if (ui.data.noPreference) {+ assert.equal(await model.count(), 0);+ await page.getByText(await ui.t('bots.voiceMode.noModels'), { exact: true }).waitFor();+ await ui.capture('hidden-empty');+ } else {+ assert.ok((await model.textContent()).includes('eleven_flash_v2_5'));+ await model.click();+ await page.getByRole('option', { name: /Visible speech/ }).waitFor();+ assert.equal(await page.getByRole('option', { name: /Unchecked speech/ }).count(), 0);+ await ui.capture('hidden-selection');+ await page.keyboard.press('Escape');+ }+ return;+ }if (ui.data.menu) {const label = await ui.t('bots.voiceMode.voice');const trigger = page.getByRole('button', { name: label, exact: true });diff --git a/apps/desktop/scripts/fixtures/voice-settings/voice-settings-fixture.tsx b/apps/desktop/scripts/fixtures/voice-settings/voice-settings-fixture.tsxindex c0f554bf9b..4c05e9fdde 100644--- a/apps/desktop/scripts/fixtures/voice-settings/voice-settings-fixture.tsx+++ b/apps/desktop/scripts/fixtures/voice-settings/voice-settings-fixture.tsx@@ -35,6 +35,7 @@ mountPage({customized: ctx.data.speed !== undefined || !!ctx.data.manual,sentencePlayback: true,};+ if (ctx.data.noPreference) preference.selection = null;return {onAuthStateChange: () => () => {},voiceInput: { onPowerStateChange: () => () => {} },@@ -46,6 +47,7 @@ mountPage({: [{id: modelId,+ ...(ctx.data.hidden ? { pickerVisible: false } : {}),name: modelId,providerId: 'fixture',providerName:@@ -59,6 +61,8 @@ mountPage({protocolLocked: true,defaultVoice: 'river',},+ ...(ctx.data.hidden ? [{ id: 'unchecked', name: 'Unchecked speech', providerId: 'fixture', agent: 'codex' as const, pickerVisible: false }] : []),+ ...(ctx.data.hidden && !ctx.data.noPreference ? [{ id: 'visible', name: 'Visible speech', providerId: 'fixture', agent: 'codex' as const, protocol, protocolLocked: true, defaultVoice: 'river' }] : []),],voices: async () => ({source: 'provider',diff --git a/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.tsindex 546e1fc583..3f134259ac 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/providerHandlers.test.ts@@ -2,7 +2,8 @@ import Database from 'better-sqlite3';import { drizzle } from 'drizzle-orm/better-sqlite3';import { afterEach, describe, it, expect, vi } from 'vitest';-import type { AgentKind, CustomProviderConfig, ProviderView } from '@cindy/model-providers';+import { buildUserProvider, type AgentKind, type CustomProviderConfig, type ProviderPreset, type ProviderView } from '@cindy/model-providers';+import { providerViewToCustomProviderConfig } from '../../../renderer/lib/customProviders.js';import type { ProviderImportPreview } from '../../../shared/providerImport.js';import { BUILTIN_REFRESHABLE_PROVIDER_IDS } from '../../../shared/providerModelRefresh.js';@@ -4735,3 +4736,35 @@ it('speech additions accept an unchanged projected default protocol and preserveexpect(stored?.runtimes.codex?.models.map(model => model.id)).toEqual(['gpt-5.4', 'gpt-4o-mini-tts']);expect(stored?.runtimes.pi).toEqual(config.runtimes.pi);});++// Review regression: real catalog projection + update handler. A current preset can+// replace a stored directory URL without changing the connection. Existing tests+// only compared raw snapshots, so they missed this failed save (DB tier, no network).+it.each([undefined, 'https://api.minimax.io/v1/old-models'])(+ 'appends speech against the current preset while preserving stored modelsUrl %s',+ async (modelsUrl) => {+ mountDb();+ const harness = new IpcHarness();+ const config: CustomProviderConfig = { id: 'preset-speech', name: 'My MiniMax', runtimes: {+ codex: { catalogPresetId: 'minimax-api', baseUrl: 'https://api.minimax.io/v1',+ modelsUrl, models: [{ id: 'MiniMax-M3', name: 'My chat' }] },+ } };+ const presets: ProviderPreset[] = [{ id: 'minimax-api', name: 'MiniMax API', runtimes: {+ codex: { baseUrl: 'https://api.minimax.io/v1', modelsUrl: 'https://api.minimax.io/v1/current-models', models: [] },+ } }];+ registerProviderHandlers(harness, makeDeps({ listPresets: () => presets }));+ await harness.invoke(MAKER_INVOKE.PROVIDER_CUSTOM_CREATE, config);+ const projected = buildUserProvider(config, { presets });+ const request = providerViewToCustomProviderConfig({ ...projected, connected: true } as ProviderView);+ request.runtimes.codex!.models = [{ id: 'speech-2.8-turbo', name: 'Speech' }];+ expect(request.runtimes.codex!.modelsUrl).toBe(presets[0].runtimes.codex!.modelsUrl);+ // A dialog from before the preset update is genuinely stale; reopening fixes it.+ const stale = structuredClone(request);+ stale.runtimes.codex!.modelsUrl = 'https://api.minimax.io/v1/stale-models';+ await expect(harness.invoke(MAKER_INVOKE.PROVIDER_CUSTOM_UPDATE, stale, {}, { appendSpeechModelsOnly: true })).rejects.toThrow(/INVALID_PARAMS/);+ await expect(harness.invoke(MAKER_INVOKE.PROVIDER_CUSTOM_UPDATE, request, {}, { appendSpeechModelsOnly: true })).resolves.toEqual({ ok: true });+ expect((await getCustomProvider(config.id))?.runtimes.codex).toEqual({+ ...config.runtimes.codex, models: [...config.runtimes.codex!.models, ...request.runtimes.codex!.models],+ });+ },+);diff --git a/apps/desktop/src/main/maker-ipc/providerHandlers.ts b/apps/desktop/src/main/maker-ipc/providerHandlers.tsindex 5724eb98a9..7f1c8f60da 100644--- a/apps/desktop/src/main/maker-ipc/providerHandlers.ts+++ b/apps/desktop/src/main/maker-ipc/providerHandlers.ts@@ -2059,7 +2059,7 @@ export function registerProviderHandlers(if (!previous) throwIpcError('NOT_FOUND', `custom provider '${config.id}' not found`);if (options.appendSpeechModelsOnly) {if (Object.keys(keys).length) throwIpcError('INVALID_PARAMS', 'speech additions cannot change credentials');- try { config = appendSpeechModels(previous, config); }+ try { config = appendSpeechModels(previous, config, deps.listPresets()); }catch { throwIpcError('INVALID_PARAMS', 'connection changed or invalid speech additions'); }const validation = validateCustomProviderConfig(config, { allowLegacyXai: true });if (!validation.ok) throwIpcError(validation.code, validation.message);diff --git a/apps/desktop/src/main/voice-conversation/__tests__/models.test.ts b/apps/desktop/src/main/voice-conversation/__tests__/models.test.tsindex 8e970913bf..3b0967362e 100644--- a/apps/desktop/src/main/voice-conversation/__tests__/models.test.ts+++ b/apps/desktop/src/main/voice-conversation/__tests__/models.test.ts@@ -51,7 +51,7 @@ it('lists only selected speech models and applies connection-scoped display overcustom('a', 'https://api.elevenlabs.io/v1', models),custom('b', 'https://api.elevenlabs.io/v1', models),]);- const choices = () => speechModels(d).map((item) => [item.providerId, item.id]);+ const choices = () => speechModels(d).filter((item) => item.pickerVisible !== false).map((item) => [item.providerId, item.id]);expect(choices()).toEqual([['a', 'eleven_flash_v2_5'], ['b', 'eleven_flash_v2_5']]);d.visibilityOverride = (agent, provider, id) => agent === 'codex' && provider === 'a'? id === 'eleven_v3' : undefined;diff --git a/apps/desktop/src/main/voice-conversation/__tests__/service.test.ts b/apps/desktop/src/main/voice-conversation/__tests__/service.test.tsindex 5091aa51e6..16ac85f4fc 100644--- a/apps/desktop/src/main/voice-conversation/__tests__/service.test.ts+++ b/apps/desktop/src/main/voice-conversation/__tests__/service.test.ts@@ -1,6 +1,9 @@import { afterEach, describe, expect, it, vi } from 'vitest';import type { AsrSegment, AudioGate, AudioGateEmit } from '@cindy/voice-input-core';+import { BUNDLED_CATALOG, buildUserProvider } from '@cindy/model-providers';+import { speechModels, resolveSpeechConnection, type SpeechCatalogDeps } from '../models.js';import { VoiceConversationService } from '../service.js';+import type { SpeechConnection } from '../speech.js';import { hasVoiceConversationLease } from '../lease.js';import type { VoiceExitDecision } from '../../../shared/voiceConversation.js';import type { VoiceExitClassification } from '../semanticExit.js';@@ -139,7 +142,7 @@ function fixture() {models: vi.fn(() => [{ id: 'tts', name: 'Speech' }]),createProvider: vi.fn(async () => provider),createAudioGate: vi.fn<() => AudioGate | undefined>(() => undefined),- connection: vi.fn(() => ({+ connection: vi.fn<() => SpeechConnection>(() => ({baseUrl: 'https://gateway.test/v1',protocol: 'openai' as const,headers: { authorization: 'Bearer test-key' },@@ -736,3 +739,35 @@ describe('input-only mute', () => {},);});++// Review regression: real catalog admission + service starts, not a direct resolver+// assertion. Hiding a saved route must not revoke it; disabling it must. Unit tier,+// mock ASR/transport only, no devices, credentials or paid network requests.+it.each(['startPreview', 'start', 'startPlayback'] as const)(+ 'keeps a hidden saved speech route usable through %s, but rejects a disabled route',+ async (method) => {+ const { service, deps } = fixture();+ const catalog: SpeechCatalogDeps = {+ catalog: { ...BUNDLED_CATALOG, providers: [buildUserProvider({+ id: 'speech', name: 'Speech', runtimes: { codex: {+ baseUrl: 'https://api.openai.com/v1', models: [{ id: 'tts', name: 'Speech', mode: 'audio_speech', defaultEnabled: false }],+ } },+ })] },+ gatewayAllowed: false, disabled: () => false, visibilityOverride: () => false,+ gatewayConnection: () => ({ baseUrl: '', apiKey: '' }), readKey: () => 'fake-test-key',+ };+ const saved = { ...selection, ...previewSelection, providerId: 'speech', agent: 'codex' as const };+ deps.models.mockImplementation(() => speechModels(catalog));+ deps.connection.mockImplementation(() => resolveSpeechConnection(catalog, saved));+ await expect(service[method](1, saved)).resolves.toBeDefined();+ expect(deps.connection).toHaveBeenCalled();+ await service.end(1);+ deps.fetch.mockClear();+ deps.createProvider.mockClear();+ catalog.disabled = () => true;+ await expect(service[method](1, saved)).rejects.toThrow('model_unavailable');+ expect(deps.fetch).not.toHaveBeenCalled();+ expect(deps.createProvider).not.toHaveBeenCalled();+ expect(hasVoiceConversationLease()).toBe(false);+ },+);diff --git a/apps/desktop/src/main/voice-conversation/models.ts b/apps/desktop/src/main/voice-conversation/models.tsindex 865abc3de1..8e6a15468e 100644--- a/apps/desktop/src/main/voice-conversation/models.ts+++ b/apps/desktop/src/main/voice-conversation/models.ts@@ -96,10 +96,10 @@ function bindings(deps: SpeechCatalogDeps, selection?: SpeechModelSelection): Bicontinue;// Display preferences affect the picker, independently of route admission.// BYOK media keeps the runtime that owns both its key and display override.- if (!selection && !isModelVisible(+ const pickerVisible = isModelVisible(media.sourceAgent ? deps.visibilityOverride?.(media.sourceAgent, provider.id, media.id) : undefined,media.defaultEnabled,- )) continue;+ );const declared = nativeProtocol(deps.catalog, provider.id, media);if (provider.id === 'xd') {if (@@ -113,6 +113,7 @@ function bindings(deps: SpeechCatalogDeps, selection?: SpeechModelSelection): Biresult.push({model: {id: media.id,+ ...(pickerVisible ? {} : { pickerVisible: false }),name: media.name,providerId: 'xd',providerName: provider.name,@@ -188,6 +189,7 @@ function bindings(deps: SpeechCatalogDeps, selection?: SpeechModelSelection): Biresult.push({model: {id: media.id,+ ...(pickerVisible ? {} : { pickerVisible: false }),name: media.name,providerId: provider.id,providerName: provider.name,@@ -205,7 +207,8 @@ function bindings(deps: SpeechCatalogDeps, selection?: SpeechModelSelection): Bireturn result;}-/** Registry entries alone never add catalog membership or grant a credential. */+/** Admitted routes include hidden saved choices; pickerVisible only controls discovery UI.+ * Registry entries alone never add catalog membership or grant a credential. */export function speechModels(deps: SpeechCatalogDeps): VoiceConversationModel[] {return bindings(deps).map((binding) => binding.model);}diff --git a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsxindex 5d296eb550..c7de9a25f4 100644--- a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx+++ b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx@@ -1718,3 +1718,46 @@ describe('existing connection speech additions', () => {expect(createCustomProvider).not.toHaveBeenCalled();});});++// Review regression: a mixed provider with no preset models and no directory must+// retain the chat fallback alongside speech suggestions. Prior LiteLLM coverage+// used a URL without speech support (Renderer unit, mock discovery, no requests).+describe('general manual fallback beside speech suggestions', () => {+ it.each([+ ['OpenAI', 'https://api.openai.com/v1'],+ ['MiniMax', 'https://api.minimax.io/v1'],+ ['Bailian', 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1'],+ ].flatMap(([name, baseUrl]) => [true, false].map(failed => ({ name, baseUrl, failed }))))(+ 'keeps manual chat entry for $name with failed=$failed directory', async ({ name, baseUrl, failed }) => {+ window.electronAPI.maker.listProviderPresets = vi.fn(async () => ({ presets: [{+ id: 'empty-mixed-api', name, runtimes: { codex: { baseUrl, models: [] } },+ }] }));+ if (!failed) vi.mocked(window.electronAPI.maker.fetchProviderModels).mockResolvedValue({ ok: true, models: [] });+ renderWizard('empty-mixed-api');+ fireEvent.change(await screen.findByPlaceholderText('sk-…'), { target: { value: 'fake-test-key' } });+ fireEvent.click(screen.getByText('settings.providers.wizard.next'));+ const input = await screen.findByPlaceholderText('settings.providers.wizard.manualModelPlaceholder');+ expect(screen.getByText('settings.providers.speechSetup.manual')).toBeTruthy();+ fireEvent.change(input, { target: { value: 'my-new-chat-model' } });+ fireEvent.click(screen.getByText('settings.providers.wizard.addManualModel'));+ fireEvent.click(screen.getByText('settings.providers.wizard.finish'));+ await waitFor(() => expect(createCustomProvider).toHaveBeenCalledOnce());+ const saved = vi.mocked(createCustomProvider).mock.calls[0][0].runtimes.codex!.models;+ expect(saved.find(model => model.id === 'my-new-chat-model')).toMatchObject({ name: 'my-new-chat-model' });+ expect(saved.find(model => model.id === 'my-new-chat-model')?.mode).toBeUndefined();+ },+ );+ it.each(['elevenlabs', 'speech-only'] as const)('does not offer a chat fallback in %s setup', async (kind) => {+ window.electronAPI.maker.listProviderPresets = vi.fn(async () => ({ presets: [{+ id: 'empty-api', name: 'Empty API', runtimes: { codex: {+ baseUrl: kind === 'elevenlabs' ? 'https://api.elevenlabs.io/v1' : 'https://api.openai.com/v1', models: [],+ } },+ }] }));+ render(<AddProviderWizard providers={[]} entry={{ kind: 'preset', presetId: 'empty-api', speechOnly: kind === 'speech-only' }} onClose={vi.fn()} onDone={vi.fn()} onOpenCustomForm={vi.fn()} />);+ fireEvent.change(await screen.findByPlaceholderText('sk-…'), { target: { value: 'fake-test-key' } });+ fireEvent.click(screen.getByText('settings.providers.wizard.next'));+ await screen.findByText('settings.providers.speechSetup.manual');+ await waitFor(() => expect(screen.queryByText('settings.providers.wizard.fetching')).toBeNull());+ expect(screen.queryByPlaceholderText('settings.providers.wizard.manualModelPlaceholder')).toBeNull();+ });+});diff --git a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsxindex 37c0ed50e6..03d4d2f41f 100644--- a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx+++ b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx@@ -1468,7 +1468,9 @@ export function AddProviderWizard({sel?.kind === 'preset' &&fetchState.status === 'done' &&(fetchState.failed || fetchState.empty) &&- !presetHasRecommendedModels && !speechTarget;+ !presetHasRecommendedModels &&+ !(entry?.kind === 'preset' && entry.speechOnly) &&+ speechTarget?.service !== 'elevenlabs';const presetNeedsApiKey = sel?.kind === 'preset' && sel.preset.authMethod !== 'none';const presetBaseUrlsValid =sel?.kind === 'preset' &&diff --git a/apps/desktop/src/renderer/features/bots/voice/CompanionVoiceSettings.tsx b/apps/desktop/src/renderer/features/bots/voice/CompanionVoiceSettings.tsxindex c98f35958d..c1924d4770 100644--- a/apps/desktop/src/renderer/features/bots/voice/CompanionVoiceSettings.tsx+++ b/apps/desktop/src/renderer/features/bots/voice/CompanionVoiceSettings.tsx@@ -92,6 +92,9 @@ export function CompanionVoiceSettings(props: Props) {const speedLabel = (value: number) =>t('bots.voiceMode.speedValue', { speed: value.toFixed(2).replace(/0$/, '') });const validModel = !!selectedModel;+ // Keep the saved current value readable, without offering other hidden routes+ // or silently choosing one when there is no saved preference.+ const pickerModels = models.filter((model) => model.pickerVisible !== false || model === selectedModel);const preview = useMemo(() =>new VoicePreviewController({@@ -277,7 +280,7 @@ export function CompanionVoiceSettings(props: Props) {// Keep unavailable controls out of the empty state, including while its first// catalog request is pending. This only changes presentation, not saved preferences.- if (models.length === 0) {+ if (pickerModels.length === 0) {return (<div className="space-y-4 pt-3">{loading ? (@@ -335,12 +338,12 @@ export function CompanionVoiceSettings(props: Props) {{...control}label={t('bots.voiceMode.model')}value={selectedModel ? voiceModelKey(selectedModel) : ''}- options={models.map((model) => ({+ options={pickerModels.map((model) => ({value: voiceModelKey(model),label: [model.name, model.providerName].filter(Boolean).join(' · '),}))}onValueChange={chooseModel}- disabled={loading || !ready || saving || models.length === 0}+ disabled={loading || !ready || saving || pickerModels.length === 0}className="flex-1"/><Buttondiff --git a/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx b/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsxindex a5093c0c49..91cf4c02fd 100644--- a/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx+++ b/apps/desktop/src/renderer/features/bots/voice/__tests__/CompanionVoiceSettings.test.tsx@@ -73,6 +73,7 @@ vi.mock('../PcmSpeechPlayer', () => ({}));import { CompanionVoiceSettings } from '../CompanionVoiceSettings';+import { resolveVoiceConfiguration } from '../voiceConfiguration';const sessionState = vi.hoisted(() => ({ value: {} }));vi.mock('@/lib/makerChatStore', () => ({makerChatStore: { subscribeLight: () => () => {}, getLightSnapshot: () => sessionState.value },@@ -1190,3 +1191,32 @@ it('blocks preview while the companion is waiting for confirmation', async () =>).toBe(true);expect(start).not.toHaveBeenCalled();});++// Review regression: visibility is picker policy, not saved-route eligibility.+// Existing UI tests had only visible or missing routes (Renderer unit, mock bridge).+it('does not default to or offer unchecked speech models, while restoring a saved hidden selection', async () => {+ models = [+ { id: 'hidden', name: 'Saved hidden speech', pickerVisible: false, defaultVoice: 'alloy' },+ { id: 'unchecked', name: 'Unchecked speech', pickerVisible: false, defaultVoice: 'alloy' },+ { id: 'visible', name: 'Visible speech', defaultVoice: 'alloy' },+ ];+ expect(resolveVoiceConfiguration(models, null).selection?.modelId).toBe('visible');+ const saved = { modelId: 'hidden', voice: 'nova' };+ expect(resolveVoiceConfiguration(models, saved).selection).toEqual(saved);+ vi.mocked(window.electronAPI.voiceConversation.preference).mockResolvedValue({ selection: saved, customized: true });+ renderSettings();+ const field = await screen.findByRole('combobox', { name: 'bots.voiceMode.model' });+ await waitFor(() => expect((field as HTMLSelectElement).value).toBe(voiceModelKey(saved)));+ // The saved value remains displayed; other unchecked models are not offered.+ expect(within(field).queryByRole('option', { name: 'Unchecked speech' })).toBeNull();+ expect(screen.queryByText('bots.voiceMode.modelUnavailable')).toBeNull();+ expect(window.electronAPI.voiceConversation.setPreference).not.toHaveBeenCalled();+});++it('shows setup guidance when all speech models are hidden and there is no saved choice', async () => {+ models = [{ id: 'unchecked', name: 'Unchecked speech', pickerVisible: false, defaultVoice: 'alloy' }];+ expect(resolveVoiceConfiguration(models, null).selection).toBeNull();+ renderSettings();+ await screen.findByText('bots.voiceMode.noModels');+ expect(screen.queryByRole('combobox', { name: 'bots.voiceMode.model' })).toBeNull();+});diff --git a/apps/desktop/src/renderer/features/bots/voice/voiceConfiguration.ts b/apps/desktop/src/renderer/features/bots/voice/voiceConfiguration.tsindex 8636e23ca4..f61156bfd4 100644--- a/apps/desktop/src/renderer/features/bots/voice/voiceConfiguration.ts+++ b/apps/desktop/src/renderer/features/bots/voice/voiceConfiguration.ts@@ -16,7 +16,7 @@ export function resolveVoiceConfiguration() {const selectedModel = preference? models.find((model) => voiceModelKey(model) === voiceModelKey(preference))- : models[0];+ : models.find((model) => model.pickerVisible !== false);const protocolOverride = selectedModel?.protocolLocked ? undefined : preference?.protocol;const incompatibleSavedProtocol = Boolean(selectedModel?.protocolLocked &&diff --git a/apps/desktop/src/shared/speechProviderSetup.ts b/apps/desktop/src/shared/speechProviderSetup.tsindex 89729df91d..b4c926ee22 100644--- a/apps/desktop/src/shared/speechProviderSetup.ts+++ b/apps/desktop/src/shared/speechProviderSetup.ts@@ -199,13 +199,15 @@ export function providerSpeechSetup(export function appendSpeechModels(current: CustomProviderConfig,request: CustomProviderConfig,+ presets: ProviderPreset[] = [],): CustomProviderConfig {if ((current.auth?.method ?? 'apiKey') !== 'apiKey')throw new Error('api_key_connection_required');const next = structuredClone(current);- // The catalog omits an explicit runtime protocol when it equals the engine default.- // Compare the same projection, while keeping the original stored declaration intact.- const currentRouting = buildUserProvider(current).routing;+ // Compare the current effective route with the dialog's projected snapshot.+ // Do not reapply presets to the snapshot: that would hide a genuinely stale URL.+ // Append to the stored config below without persisting derived preset fields.+ const currentRouting = buildUserProvider(current, { presets }).routing;const requestedRouting = buildUserProvider(request).routing;const known = new Set(Object.values(next.runtimes).flatMap(@@ -218,10 +220,10 @@ export function appendSpeechModels(if (!draft ||!runtime ||- runtime.baseUrl !== draft.baseUrl ||+ currentRouting[agent]?.upstream !== requestedRouting[agent]?.upstream ||currentRouting[agent]?.wireProtocol !== requestedRouting[agent]?.wireProtocol ||- runtime.requestPath !== draft.requestPath ||- runtime.modelsUrl !== draft.modelsUrl+ currentRouting[agent]?.requestPath !== requestedRouting[agent]?.requestPath ||+ currentRouting[agent]?.modelsUrl !== requestedRouting[agent]?.modelsUrl)throw new Error('connection_changed');for (const model of draft.models) {diff --git a/apps/desktop/src/shared/voiceConversation.ts b/apps/desktop/src/shared/voiceConversation.tsindex 07a96b32ca..15915f5ca4 100644--- a/apps/desktop/src/shared/voiceConversation.ts+++ b/apps/desktop/src/shared/voiceConversation.ts@@ -115,6 +115,8 @@ export type SpeechPreviewStart = VoiceConversationSelection & {text: string;};export type VoiceConversationModel = {+ /** Display preference only; hidden routes remain available for saved selections. */+ pickerVisible?: boolean;id: string;name: string;providerId?: string;diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex fd69d2cd2f..36653abf4b 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -193,7 +193,7 @@ Mobile 已由 DS-7 纳入同一台账(2026-09-10 静态入口发现),保| `desktop.auth.add-account` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路 | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 || `desktop.auth.legacy-migration` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路(消费 --login-callback-* 品牌豁免族 component token) | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 || `desktop.auth.login` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §16 登录链路 | 既有登录品牌保护;本批无全局按钮/主题变更 | 真实隔离窗口走过登录→本地模式;没有验证 Apple/Google/企业账号登录;2026-09-17 或 DS-10 开工前复查 |-| `desktop.bots` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | 当前 #4283 伙伴设置与聊天路径;操作集合由原业务决定 | 核标准/伙伴精简消息与授权相邻回归;实际远程伙伴/跨账号联调留 kirozeng 安排,Codex 复测,不以样本标整页完成;2026-09-17 或 DS-10 开工前复查 |+| `desktop.bots` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | 当前 #4283 伙伴设置与聊天路径;操作集合由原业务决定 | 核标准/伙伴精简消息与授权相邻回归;实际远程伙伴/跨账号联调留 kirozeng 安排,Codex 复测,不以样本标整页完成;2026-09-17 或 DS-10 开工前复查;#6768(2026-10-22)区分朗读候选可见性与已保存选择,保留当前隐藏选择的展示和调用,其余隐藏候选不展示;不改变停用/账号准入,双主题五语言单页证据随 PR 提供 || `desktop.chat.files` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | 文件页聊天 rail 继承本批呈现;文件扫描与 watcher 不变 | 核真实文件路由与窄栏;整页不标迁移,文件新鲜度/焦点继续用既有回归保护;2026-09-17 或 DS-10 开工前复查 || `desktop.chat.new-draft` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §15.15 创建页内容位 | 保持既有 ChatInput 与新建布局,本批改动在后续消息与授权 | 真实本地新建入口正常;完整聊天与授权分别验收,不把创建页标 migrated;2026-09-17 或 DS-10 开工前复查 || `desktop.chat.orca-workflow` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | 复用 CCAgentSessionView 的聊天组件,Orca 编排不变 | 共用呈现与紧凑宽度有受控验证;实际多 Agent 调度未发起,kirozeng 安排实测、Codex 复测;2026-09-17 或 DS-10 开工前复查 |@@ -213,7 +213,7 @@ Mobile 已由 DS-7 纳入同一台账(2026-09-10 静态入口发现),保| `desktop.overlay.toast` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 || `desktop.plugins.app-main` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 || `desktop.plugins.installed` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | DS-9 保留现有专属表面;未改全局 Button/主题源,按共享依赖核影响 | 本批未直接改该入口;无真实实例的独立/原生/账号/插件场景保留原合同,未作完整运行验收;kirozeng 安排所需环境,Codex 核对,2026-09-17 或 DS-10 开工前复查 |-| `desktop.settings` | kirozeng(DS-6 与用量图表跟进) | pilot | DESIGN.md §10 语义豁免色族消费者;外部主题导入保护 token(资源用量类别色在独立窗);DESIGN.md §5 登记成员 `usage-heatmap-day` / `usage-token-bar` | DS-4 / DS-4b 已落地;DS-6 两张表单与指定普通确认已随 #4135 合入,用户测试版手动审核通过;DS-8 数值同源 | DS-6 工程与真实测试版审核已交付,G2/公开附件/平台待项按证据复查;focus、ivory/elevated 见治理 §10。旧 alias 与 slot 按作用域生效,禁止仅因同值删除局部配色;DS-6/8/9 按实际消费者分批核对跨 surface alias,confirm-dialog 归 DS-6;用量图表形状与密度已随 #4064 恢复;DS-11 补 36px 任意日期入口,与图表共用 day 筛选(最终视觉验收另记);09-08 蓝色热力图描边、多色柱图七日强调与微弹裁决见 [组件规范](./usage-history-charts.md),此前移除的日期入口由 DS-11 用户授权重新补足;图表优化 #4076 已合入;DS-11 等价日期输入已实施,平台与用户验收仍须独立记录,不提前标记 migrated;DS-6 SC/G2/公开附件/平台待项见 [本批证据](../design-evidence/2026-09-08/ds6-forms.md),不把局部通过当完整设置页 migrated |+| `desktop.settings` | kirozeng(DS-6 与用量图表跟进) | pilot | DESIGN.md §10 语义豁免色族消费者;外部主题导入保护 token(资源用量类别色在独立窗);DESIGN.md §5 登记成员 `usage-heatmap-day` / `usage-token-bar` | DS-4 / DS-4b 已落地;DS-6 两张表单与指定普通确认已随 #4135 合入,用户测试版手动审核通过;DS-8 数值同源 | DS-6 工程与真实测试版审核已交付,G2/公开附件/平台待项按证据复查;focus、ivory/elevated 见治理 §10。旧 alias 与 slot 按作用域生效,禁止仅因同值删除局部配色;DS-6/8/9 按实际消费者分批核对跨 surface alias,confirm-dialog 归 DS-6;用量图表形状与密度已随 #4064 恢复;DS-11 补 36px 任意日期入口,与图表共用 day 筛选(最终视觉验收另记);09-08 蓝色热力图描边、多色柱图七日强调与微弹裁决见 [组件规范](./usage-history-charts.md),此前移除的日期入口由 DS-11 用户授权重新补足;图表优化 #4076 已合入;DS-11 等价日期输入已实施,平台与用户验收仍须独立记录,不提前标记 migrated;DS-6 SC/G2/公开附件/平台待项见 [本批证据](../design-evidence/2026-09-08/ds6-forms.md),不把局部通过当完整设置页 migrated;#6768(2026-10-22)补普通厂商空目录/发现失败时的通用型号手填回退,语音分组说明保持原位置;新增回归与双主题五语言单页证据随 PR 提供 || `desktop.shell.main-layout` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | DESIGN.md §15 CINDY 皮肤族(侧栏 vibrancy / 选中 pill);外部主题导入保护 token;DESIGN.md §5 登记成员 `workflow-status-cell`(background-tasks 面板详情) | 保持布局树与主题;聊天区域继承本批共用呈现 | 真实本地主窗口、侧栏与聊天可用;其它皮肤/平台待用户实看;2026-09-17 或 DS-10 开工前复查 || `desktop.skillhub.local` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | SkillhubDiffPanel 继承 DiffView 排版,文件比较和发布逻辑不变 | 同一 DiffView 的真实 Worker/长行/大字号验证;Skill Hub 真实网络长反馈未联调;2026-09-17 或 DS-10 开工前复查 || `desktop.skillhub.market` | Codex(DS-9 影响核对)/ kirozeng(验收协调) | legacy | — | SkillhubDiffPanel 复用 DiffView,列表/网络逻辑不变 | 真实 Diff 组件验证不等于市场流程完成;真实远端联调按 DS-10 平台清单继续安排;2026-09-17 或 DS-10 开工前复查 |diff --git a/docs/product-rules/provider-settings.md b/docs/product-rules/provider-settings.mdindex a01baebe65..3639e3189e 100644--- a/docs/product-rules/provider-settings.md+++ b/docs/product-rules/provider-settings.md@@ -121,8 +121,9 @@ OpenAI、Claude 和 Grok 都允许新增独立登录账号。每次新增生成- 「添加供应商」保持一个入口。API Key 连接沿用选择供应商、连接、选择模型三步;在同一模型页分组展示语音模型、对话与其他模型,语音分组位于普通模型长列表之前。MiniMax、OpenAI API、ElevenLabs、百炼普通 API 提供语音参考型号,在已确认支持的地址默认勾选一个推荐型号,用户可以取消或仅添加语音型号。- 两个添加入口共用实际连接地址的推荐规则,不按预设名称或 Cindy 发行区域推断:公共 `dashscope.aliyuncs.com` / `dashscope-intl.aliyuncs.com` 推荐 `qwen3-tts-flash`;北京 workspace 推荐 `cosyvoice-v3-flash`;新加坡 workspace 推荐公共 Registry 已收录的 `qwen-audio-3.0-tts-flash`。美国公共地址及未确认组合不自动推荐或勾选参考型号,目录发现和手动添加仍可用。推荐遵循 #6660 的原生 HTTP 支持范围,不更换 origin、地域或密钥;返回连接步骤编辑地址后重新计算。已有保存型号与用户显示偏好不因新推荐改变。-- 已有 API Key 连接在模型管理工具行提供「添加语音模型」。操作绑定连接 ID,追加用户选择的新型号;不重填密钥,不覆盖已有名称、协议、模型类型、开关和其他 runtime。Main 在原有供应商修改队列内合并最新配置,连接地址已变更则要求重新打开;不使用旧快照替换整个连接。+- 已有 API Key 连接在模型管理工具行提供「添加语音模型」。操作绑定连接 ID,追加用户选择的新型号;不重填密钥,不覆盖已有名称、协议、模型类型、开关和其他 runtime。Main 在原有供应商修改队列内合并最新配置,按当前预设投影后的有效地址校验弹窗快照,实际地址已变更则要求重新打开;预设补充目录地址不会改写存储值,不使用旧快照替换整个连接。- 订阅或设备码连接走独立 API Key 连接,不转换、不覆盖原连接。普通百炼 API 与 Coding Plan / Token Plan 入口分开,不推断套餐具有语音额度。+- 普通厂商没有预置模型且目录获取失败或为空时,同时保留通用型号手填与语音建议;通用手填不强制设为语音。仅明确的语音接入流程或 ElevenLabs 这类语音服务隐藏通用回退。- 目录返回、公共参考和用户手填是不同来源。参考清单只描述添加建议,名称与能力仍继承公共 Registry;未选中的参考型号不写入账号连接。目录明确返回非 TTS 能力时,不以参考清单把它恢复成语音。-- 目录返回但未勾选的语音型号保留在连接目录中,默认隐藏,不出现在伙伴朗读选择器中。媒体投影保留该显示默认值;后续显式显示偏好按连接与 runtime 生效,显示偏好与停用、账号准入独立。+- 目录返回但未勾选的语音型号保留在连接目录中,默认隐藏,不出现在伙伴朗读选择器中。媒体投影保留该显示默认值;后续显式显示偏好按连接与 runtime 生效,显示偏好与停用、账号准入独立。已保存为伙伴朗读偏好的隐藏型号仍可恢复、试听、朗读和开始通话;设置中保留显示当前选择,其他隐藏型号不进入候选,也不自动选作默认。停用、凭证丢失或账号不可用仍阻止调用。- 获取目录和保存型号不等于调用成功或已获授权;不自动发起计费合成。音色、试听、逐句朗读属于伙伴语音设置,不进入供应商添加流程。两个添加入口的保存与设置说明统一放在语音模型分组内,对话模型的说明留在对应列表下方。Qwen / CosyVoice 的目录接入不替代各自原生执行器的交付和验证。