Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(providers): scope speech recommendations to endpoint region
JiangJiahao31ef395d6f87
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 b4933e2f00..43ec949399 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@@ -114,60 +114,76 @@ function Fixture({ scenario }: { scenario: string }) {);}void mountPage({- host: (ctx) => ({- safeStorageRead: async () => 'fixture-key',- maker: {- listProviderPresets: async () => ({- presets: BUNDLED_CATALOG.presets!.filter((p) => p.id === 'minimax-global'),- }),- localModelList: async () => ({- status: { runtime: 'ollama', kind: 'absent', appInstalled: false },- models: [],- }),- scanLocalCli: async () => ({ detections: [] }),- llamaCppStatus: async () => ({- installed: false,- supported: true,- running: false,- models: [],- }),- onProviderOAuthProgress: subscription('oauthProgress'),- onProvidersChanged: subscription('providersChanged'),- fetchProviderModels: async () =>- ctx.case === 'elevenlabs'- ? {- ok: true,- models: [- {- id: 'eleven_flash_v2_5',- name: 'Eleven Flash v2.5',- discoveredMetadata: { mode: 'audio_speech' },- },- ],- }- : ctx.case === 'bailian'+ host: (ctx) => {+ if (ctx.case === 'bailian-existing')+ stored = {+ id: 'bailian-workspace',+ name: 'Alibaba Cloud · Workspace',+ runtimes: {+ codex: {+ baseUrl: 'https://ws-test.cn-beijing.maas.aliyuncs.com/api/v1',+ wireProtocol: 'openai-chat',+ models: [{ id: 'qwen-plus', name: 'Qwen Plus' }],+ },+ },+ };+ return {+ safeStorageRead: async () => 'fixture-key',+ maker: {+ listProviderPresets: async () => ({+ presets: BUNDLED_CATALOG.presets!.filter((p) => p.id === 'minimax-global'),+ }),+ localModelList: async () => ({+ status: { runtime: 'ollama', kind: 'absent', appInstalled: false },+ models: [],+ }),+ scanLocalCli: async () => ({ detections: [] }),+ llamaCppStatus: async () => ({+ installed: false,+ supported: true,+ running: false,+ models: [],+ }),+ onProviderOAuthProgress: subscription('oauthProgress'),+ onProvidersChanged: subscription('providersChanged'),+ fetchProviderModels: async () =>+ ctx.case === 'elevenlabs'? {ok: true,- models: Array.from({ length: 100 }, (_, index) => ({- id: `chat-${index}`, name: `Chat ${index}`, mode: 'chat',- })),+ models: [+ {+ id: 'eleven_flash_v2_5',+ name: 'Eleven Flash v2.5',+ discoveredMetadata: { mode: 'audio_speech' },+ },+ ],}- : { ok: false, code: 'NETWORK' },- createCustomProvider: async (config: CustomProviderConfig) => {- stored = config;- return { ok: true };- },- updateCustomProvider: async (- config: CustomProviderConfig,- _keys: unknown,- options: { appendSpeechModelsOnly?: true },- ) => {- if (!options.appendSpeechModelsOnly) throw new Error('Expected additions only');- stored = appendSpeechModels(stored, config);- return { ok: true };+ : ctx.case === 'bailian'+ ? {+ ok: true,+ models: Array.from({ length: 100 }, (_, index) => ({+ id: `chat-${index}`,+ name: `Chat ${index}`,+ mode: 'chat',+ })),+ }+ : { ok: false, code: 'NETWORK' },+ createCustomProvider: async (config: CustomProviderConfig) => {+ stored = config;+ return { ok: true };+ },+ updateCustomProvider: async (+ config: CustomProviderConfig,+ _keys: unknown,+ options: { appendSpeechModelsOnly?: true },+ ) => {+ if (!options.appendSpeechModelsOnly) throw new Error('Expected additions only');+ stored = appendSpeechModels(stored, config);+ return { ok: true };+ },+ setModelDisable: forbid('setModelDisable'),},- setModelDisable: forbid('setModelDisable'),- },- }),+ };+ },render: (ctx) => <Fixture scenario={ctx.case} />,});diff --git a/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs b/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjsindex 12f9c93c4b..b10dd02572 100644--- a/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/provider-speech-setup/ui-page.mjs@@ -13,14 +13,20 @@ export default {'Single add-provider flow: MiniMax API key, grouped chat/speech, recommended speech default',},elevenlabs: { about: 'ElevenLabs catalog discovery, TTS-only connection' },- bailian: { about: 'Alibaba Cloud speech recommendations visible above 100 discovered chat models' },+ bailian: {+ about: 'Alibaba Cloud speech recommendations visible above 100 discovered chat models',+ },+ 'bailian-existing': {+ about: 'Existing Beijing workspace recommends CosyVoice and preserves its chat model',+ },subscription: { about: 'Existing OpenAI subscription creates a separate API-key connection' },},async ready(page) {await page.getByTestId('provider-model-toolbar').waitFor();},async check(page, ui) {- if (['default', 'subscription'].includes(ui.case)) {+ const existing = ['default', 'bailian-existing'].includes(ui.case);+ if (existing || ui.case === 'subscription') {await page.getByRole('button', {name: await ui.t('settings.providers.speechSetup.add'),@@ -39,7 +45,7 @@ export default {.getByRole('button', { name: await ui.t('settings.providers.wizard.useApiKey') }).click();}- if (ui.case !== 'default') {+ if (!existing) {if (ui.case === 'subscription')await page.getByText(await ui.t('settings.providers.speechSetup.separateKey')).waitFor();await page.getByPlaceholder('sk-…').fill('fixture-key');@@ -52,30 +58,33 @@ export default {ui.case === 'elevenlabs'? 'eleven_flash_v2_5': ui.case === 'bailian'- ? 'cosyvoice-v3-flash'- : ui.case === 'subscription'- ? 'gpt-4o-mini-tts'- : 'speech-2.8-turbo';+ ? 'qwen3-tts-flash'+ : ui.case === 'bailian-existing'+ ? 'cosyvoice-v3-flash'+ : ui.case === 'subscription'+ ? 'gpt-4o-mini-tts'+ : 'speech-2.8-turbo';const recommended = page.getByRole('checkbox', { name: new RegExp(recommendedId) });await recommended.waitFor();assert.equal(await recommended.getAttribute('aria-checked'), 'true');if (ui.case === 'bailian') {// PR #6768: first-screen discoverability, before any test-induced scrolling.const box = await recommended.boundingBox();- const height = await page.evaluate(() => window.innerHeight);+ const height = await page.evaluate(() => globalThis.innerHeight);assert.ok(box && box.y >= 0 && box.y + box.height < height);}await recommended.scrollIntoViewIfNeeded();await ui.capture('models');- const finish =- ui.case === 'default'- ? 'settings.providers.wizard.addManualModel'- : 'settings.providers.wizard.finish';+ 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 === 'default')assert.ok((await page.getByTestId('saved').textContent()).includes('MiniMax-M3'));+ if (ui.case === 'bailian-existing')+ assert.ok((await page.getByTestId('saved').textContent()).includes('qwen-plus'));await ui.capture('saved');},};diff --git a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsxindex de593fd83d..5d296eb550 100644--- a/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx+++ b/apps/desktop/src/renderer/__tests__/addProviderWizardPresetEntry.test.tsx@@ -1504,11 +1504,11 @@ describe('speech models in the existing provider wizard', () => {Array.from({ length: 100 }, (_, index) => ({ id: `chat-${index}`, name: `Chat ${index}`, mode: 'chat' })),});await enter('aliyun-bailian-api-cn');- const speech = await screen.findByRole('checkbox', { name: /cosyvoice-v3-flash/ });+ const speech = await screen.findByRole('checkbox', { name: /qwen3-tts-flash/ });const firstChat = screen.getByText('Chat 0');expect(speech.compareDocumentPosition(firstChat) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();expect(speech.getAttribute('aria-checked')).toBe('true');- expect(screen.getByRole('checkbox', { name: /qwen3-tts-flash/ }).getAttribute('aria-checked')).toBe('false');+ expect(screen.queryByRole('checkbox', { name: /cosyvoice/ })).toBeNull();});it('reuses server API presets instead of duplicating the same speech service entry', async () => {window.electronAPI.maker.listProviderPresets = vi.fn(async () => ({ presets: [{@@ -1523,7 +1523,7 @@ describe('speech models in the existing provider wizard', () => {fireEvent.click(serverPreset);fireEvent.change(await screen.findByPlaceholderText('sk-…'), { target: { value: 'fake-test-key' } });fireEvent.click(screen.getByText('settings.providers.wizard.next'));- expect((await screen.findByRole('checkbox', { name: /cosyvoice-v3-flash/ })).getAttribute('aria-checked')).toBe('true');+ expect((await screen.findByRole('checkbox', { name: /qwen3-tts-flash/ })).getAttribute('aria-checked')).toBe('true');});async function enter(presetId: string, speechOnly = false) {render(<AddProviderWizard providers={[]} entry={{ kind: 'preset', presetId, speechOnly }} onClose={vi.fn()} onDone={vi.fn()} onOpenCustomForm={vi.fn()} />);@@ -1574,6 +1574,114 @@ describe('speech models in the existing provider wizard', () => {});});+// PR #6768 / #6660 integration regression (Renderer unit): the real wizard and+// additions dialog must save defaults supported at the configured endpoint.+// Previous tests asserted one brand-wide CosyVoice default; a public DashScope+// URL is the smallest failing input. No live credentials or synthesis required.+describe('Alibaba speech recommendations follow the actual endpoint', () => {+ const endpoints = [+ ['https://dashscope.aliyuncs.com/compatible-mode/v1', 'qwen3-tts-flash'],+ ['https://dashscope-intl.aliyuncs.com/api/v1/', 'qwen3-tts-flash'],+ ['https://ws-test.cn-beijing.maas.aliyuncs.com/api/v1', 'cosyvoice-v3-flash'],+ ['https://work-unit.cn-beijing.maas.aliyuncs.com/compatible-mode/v1', 'cosyvoice-v3-flash'],+ ['https://ws-test.ap-southeast-1.maas.aliyuncs.com/api/v1', 'qwen-audio-3.0-tts-flash'],+ ['https://dashscope-us.aliyuncs.com/compatible-mode/v1', null],+ ] as const;+ const publicUrl = 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1';+ async function openWizard(baseUrl: string) {+ renderWizard('aliyun-bailian-api-global');+ fireEvent.change(await screen.findByDisplayValue(publicUrl), { target: { value: baseUrl } });+ fireEvent.change(screen.getByPlaceholderText('sk-…'), { target: { value: 'fake-test-key' } });+ fireEvent.click(screen.getByText('settings.providers.wizard.next'));+ await waitFor(() => expect(screen.queryByText('settings.providers.wizard.fetching')).toBeNull());+ }+ function expectRecommendation(id: string | null) {+ const section = screen.getByRole('region', { name: 'settings.providers.speechSetup.title' });+ const checked = within(section).queryAllByRole('checkbox').filter(row => row.getAttribute('aria-checked') === 'true');+ expect(checked).toHaveLength(id ? 1 : 0);+ if (id) {+ expect(checked[0].textContent).toContain(id);+ expect(within(checked[0]).getByText('settings.providers.wizard.recommended')).toBeTruthy();+ } else {+ expect(within(section).queryByText('settings.providers.wizard.recommended')).toBeNull();+ }+ }+ it.each(endpoints)('new provider uses %s instead of the preset region', async (baseUrl, expected) => {+ await openWizard(baseUrl);+ expectRecommendation(expected);+ if (!expected) return;+ fireEvent.click(screen.getByText('settings.providers.wizard.finish'));+ await waitFor(() => expect(createCustomProvider).toHaveBeenCalledTimes(1));+ const runtime = vi.mocked(createCustomProvider).mock.calls[0][0].runtimes.codex!;+ expect(runtime.baseUrl).toBe(baseUrl);+ const speech = runtime.models.filter(model => /tts|cosyvoice/.test(model.id));+ expect(speech.map(model => model.id)).toEqual([expected]);+ expect(speech[0].defaultEnabled).not.toBe(false);+ });+ it.each(endpoints)('existing provider uses the same recommendation for %s', async (baseUrl, expected) => {+ const provider = { ...buildUserProvider({ id: 'my-ali', name: 'Alibaba connection', runtimes: {+ codex: { baseUrl, wireProtocol: 'openai-chat', models: [{ id: 'qwen-plus', name: 'My chat', defaultEnabled: false }] },+ } }), connected: true } as ProviderView;+ vi.mocked(updateCustomProvider).mockResolvedValue({ ok: true });+ render(<AddSpeechModelsDialog provider={provider} onClose={vi.fn()} onSaved={vi.fn()} />);+ await waitFor(() => expect(screen.queryByText('settings.providers.wizard.fetching')).toBeNull());+ expectRecommendation(expected);+ if (!expected) return;+ fireEvent.click(screen.getByText('settings.providers.wizard.addManualModel'));+ await waitFor(() => expect(updateCustomProvider).toHaveBeenCalledTimes(1));+ expect(updateCustomProvider).toHaveBeenCalledWith(expect.objectContaining({+ runtimes: { codex: expect.objectContaining({ baseUrl, models: [expect.objectContaining({ id: expected, defaultEnabled: true })] }) },+ }), {}, { appendSpeechModelsOnly: true });+ });+ it('recomputes recommendations after going back and editing the endpoint', async () => {+ await openWizard(publicUrl);+ expectRecommendation('qwen3-tts-flash');+ fireEvent.click(screen.getByText('settings.providers.wizard.back'));+ const workspace = 'https://ws-test.cn-beijing.maas.aliyuncs.com/api/v1';+ fireEvent.change(await screen.findByDisplayValue(publicUrl), { target: { value: workspace } });+ fireEvent.click(screen.getByText('settings.providers.wizard.next'));+ await waitFor(() => expect(screen.queryByText('settings.providers.wizard.fetching')).toBeNull());+ expectRecommendation('cosyvoice-v3-flash');+ expect(screen.queryByRole('checkbox', { name: /qwen3-tts-flash/ })).toBeNull();+ });+ it('keeps US catalog models unselected and lets the user explicitly add one', async () => {+ vi.mocked(window.electronAPI.maker.fetchProviderModels).mockResolvedValue({ ok: true, models: [+ { id: 'cosyvoice-v3-flash', name: 'CosyVoice', discoveredMetadata: { mode: 'audio_speech' } },+ { id: 'qwen3-tts-flash', name: 'Qwen3', discoveredMetadata: { mode: 'audio_speech' } },+ ] });+ await openWizard('https://dashscope-us.aliyuncs.com/compatible-mode/v1');+ expectRecommendation(null);+ fireEvent.click(screen.getByRole('checkbox', { name: /cosyvoice-v3-flash/ }));+ fireEvent.click(screen.getByText('settings.providers.wizard.finish'));+ await waitFor(() => expect(createCustomProvider).toHaveBeenCalledTimes(1));+ const models = vi.mocked(createCustomProvider).mock.calls[0][0].runtimes.codex!.models;+ expect(models.find(model => model.id === 'cosyvoice-v3-flash')).toBeDefined();+ expect(models.find(model => model.id === 'cosyvoice-v3-flash')?.defaultEnabled).not.toBe(false);+ expect(models.find(model => model.id === 'qwen3-tts-flash')?.defaultEnabled).toBe(false);+ });+ it('keeps a previously saved CosyVoice choice when recommending Qwen3 for an existing public connection', async () => {+ const provider = { ...buildUserProvider({ id: 'my-ali', name: 'Alibaba connection', runtimes: {+ codex: { baseUrl: publicUrl, wireProtocol: 'openai-chat', models: [+ { id: 'cosyvoice-v3-flash', name: 'My saved voice', mode: 'audio_speech', defaultEnabled: false },+ ] },+ } }), connected: true } as ProviderView;+ vi.mocked(updateCustomProvider).mockResolvedValue({ ok: true });+ render(<AddSpeechModelsDialog provider={provider} onClose={vi.fn()} onSaved={vi.fn()} />);+ const saved = await screen.findByRole('checkbox', { name: /My saved voice/ });+ expect((saved as HTMLButtonElement).disabled).toBe(true);+ expect(within(saved).getByText('settings.providers.speechSetup.saved')).toBeTruthy();+ expect(screen.getByRole('checkbox', { name: /qwen3-tts-flash/ }).getAttribute('aria-checked')).toBe('true');+ fireEvent.click(screen.getByText('settings.providers.wizard.addManualModel'));+ await waitFor(() => expect(updateCustomProvider).toHaveBeenCalledTimes(1));+ expect(vi.mocked(updateCustomProvider).mock.calls[0][0].runtimes.codex?.models).toEqual([+ expect.objectContaining({ id: 'qwen3-tts-flash', defaultEnabled: true }),+ ]);+ expect(provider.models.codex).toEqual([+ expect.objectContaining({ id: 'cosyvoice-v3-flash', name: 'My saved voice', defaultEnabled: false }),+ ]);+ });+});+describe('existing connection speech additions', () => {const provider = { ...buildUserProvider({ id: 'my-minimax', name: 'My connection', runtimes: {codex: { baseUrl: 'https://api.minimax.io/v1', wireProtocol: 'openai-chat', models: [diff --git a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsxindex 579989a443..c019659d40 100644--- a/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx+++ b/apps/desktop/src/renderer/components/settings/AddProviderWizard.tsx@@ -1032,7 +1032,7 @@ export function AddProviderWizard({if (entry?.kind === 'preset' && entry.speechOnly) {for (const value of initial.values()) value.checked = false;}- for (const model of speechReferenceModels(speechTarget.service)) {+ for (const model of speechReferenceModels(presetRuntimeBaseUrl(preset, speechTarget.agent, presetBaseUrls))) {if (initial.has(model.id)) continue;initial.set(model.id, { name: model.name, checked: model.defaultEnabled !== false,recommended: model.defaultEnabled !== false, agents: [speechTarget.agent], speechReference: true });diff --git a/apps/desktop/src/renderer/components/settings/AddSpeechModelsDialog.tsx b/apps/desktop/src/renderer/components/settings/AddSpeechModelsDialog.tsxindex ad188b87ee..dd83f518ad 100644--- a/apps/desktop/src/renderer/components/settings/AddSpeechModelsDialog.tsx+++ b/apps/desktop/src/renderer/components/settings/AddSpeechModelsDialog.tsx@@ -42,15 +42,17 @@ export function AddSpeechModelsDialog({(runtime) => runtime?.models.map((model) => [model.id, model] as const) ?? [],),);- const references = speechReferenceModels(target.service).map((model) => ({- id: model.id,- name: saved.get(model.id)?.name ?? model.name,- checked: !saved.has(model.id) && model.defaultEnabled !== false,- recommended: model.defaultEnabled !== false,- reference: true,- saved: saved.has(model.id),- model,- }));+ const references = speechReferenceModels(config.runtimes[target.agent]?.baseUrl ?? '').map(+ (model) => ({+ id: model.id,+ name: saved.get(model.id)?.name ?? model.name,+ checked: !saved.has(model.id) && model.defaultEnabled !== false,+ recommended: model.defaultEnabled !== false,+ reference: true,+ saved: saved.has(model.id),+ model,+ }),+ );const ids = new Set(references.map((model) => model.id));return [...references,diff --git a/apps/desktop/src/shared/speechProviderSetup.ts b/apps/desktop/src/shared/speechProviderSetup.tsindex cd0433a644..89729df91d 100644--- a/apps/desktop/src/shared/speechProviderSetup.ts+++ b/apps/desktop/src/shared/speechProviderSetup.ts@@ -13,13 +13,28 @@ import {export type SpeechService = 'minimax' | 'elevenlabs' | 'openai' | 'bailian';/** Onboarding references only: no account entitlement or synthesis probe is implied. */-const references: Record<SpeechService, string[]> = {+const references: Record<Exclude<SpeechService, 'bailian'>, string[]> = {minimax: ['speech-2.8-turbo', 'speech-2.8-hd', 'speech-02-turbo'],elevenlabs: ['eleven_flash_v2_5', 'eleven_multilingual_v2', 'eleven_v3'],openai: ['gpt-4o-mini-tts', 'tts-1', 'tts-1-hd'],- bailian: ['cosyvoice-v3-flash', 'qwen3-tts-flash', 'cosyvoice-v3-plus'],};+const bailianWorkspaceHost = /^[a-z0-9-]+\.(cn-beijing|ap-southeast-1)\.maas\.aliyuncs\.com$/;++function bailianReferences(hostname: string): string[] {+ // Match the native HTTP endpoint/model scope in #6660. Public DashScope uses+ // Qwen3's multimodal API; CosyVoice's HTTP API requires a Beijing workspace.+ // These suggestions neither rewrite the connection nor prove account access.+ if (['dashscope.aliyuncs.com', 'dashscope-intl.aliyuncs.com'].includes(hostname))+ return ['qwen3-tts-flash'];+ const region = bailianWorkspaceHost.exec(hostname)?.[1];+ if (region === 'cn-beijing') return ['cosyvoice-v3-flash', 'cosyvoice-v3-plus'];+ if (region === 'ap-southeast-1') return ['qwen-audio-3.0-tts-flash', 'qwen-audio-3.0-tts-plus'];+ // The US endpoint has no verified native TTS binding; discovery/manual entry+ // stays available without a guessed default or recommended reference model.+ return [];+}+export function speechServiceForUrl(value: string): SpeechService | undefined {try {const url = new URL(value);@@ -52,7 +67,7 @@ export function speechServiceForUrl(value: string): SpeechService | undefined {'dashscope-intl.aliyuncs.com','dashscope-us.aliyuncs.com',].includes(url.hostname) ||- /^ws-[a-z0-9]+\.cn-beijing\.maas\.aliyuncs\.com$/.test(url.hostname)) &&+ bailianWorkspaceHost.test(url.hostname)) &&['/api/v1', '/compatible-mode/v1'].includes(path))return 'bailian';@@ -73,10 +88,14 @@ export function isSpeechModel(model: {);}-export function speechReferenceModels(service: SpeechService): ProviderRuntimeModelConfig[] {+export function speechReferenceModels(baseUrl: string): ProviderRuntimeModelConfig[] {+ const service = speechServiceForUrl(baseUrl);+ if (!service) return [];+ const ids =+ service === 'bailian' ? bailianReferences(new URL(baseUrl).hostname) : references[service];// Names/capabilities remain owned by the shared Registry. This list only orders// a few setup suggestions; adding one is an explicit user membership decision.- return references[service].flatMap((id, index) => {+ return ids.flatMap((id, index) => {const base = findBaseModel(BUNDLED_CATALOG.modelRegistry, id);return base?.defaults.mode === 'audio_speech'? [{ id, name: base.defaults.name ?? id, defaultEnabled: index === 0 }]@@ -164,9 +183,10 @@ export function providerSpeechSetup(? 'minimax-global': 'minimax-cn': service === 'bailian'- ? upstream!.includes('dashscope-intl')- ? 'aliyun-bailian-api-global'- : 'aliyun-bailian-api-cn'+ ? new URL(upstream!).hostname === 'dashscope.aliyuncs.com' ||+ new URL(upstream!).hostname.endsWith('.cn-beijing.maas.aliyuncs.com')+ ? 'aliyun-bailian-api-cn'+ : 'aliyun-bailian-api-global': `${service}-api`,};}diff --git a/docs/product-rules/provider-settings.md b/docs/product-rules/provider-settings.mdindex 180d3fbf25..5f1bcad322 100644--- a/docs/product-rules/provider-settings.md+++ b/docs/product-rules/provider-settings.md@@ -119,7 +119,8 @@ OpenAI、Claude 和 Grok 都允许新增独立登录账号。每次新增生成## 语音型号接入-- 「添加供应商」保持一个入口。API Key 连接沿用选择供应商、连接、选择模型三步;在同一模型页分组展示语音模型、对话与其他模型,语音分组位于普通模型长列表之前。MiniMax、OpenAI API、ElevenLabs、百炼普通 API 提供语音参考型号,默认勾选一个推荐型号,用户可以取消或仅添加语音型号。+- 「添加供应商」保持一个入口。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 连接,不转换、不覆盖原连接。普通百炼 API 与 Coding Plan / Token Plan 入口分开,不推断套餐具有语音额度。- 目录返回、公共参考和用户手填是不同来源。参考清单只描述添加建议,名称与能力仍继承公共 Registry;未选中的参考型号不写入账号连接。目录明确返回非 TTS 能力时,不以参考清单把它恢复成语音。