Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(model-access): opt in to the audio speech catalog
JiangJiahao83c0ff6130f8
diff --git a/apps/desktop/src/main/model-access/__tests__/modelsSyncRefresh.test.ts b/apps/desktop/src/main/model-access/__tests__/modelsSyncRefresh.test.tsindex 11daf137e0..68d55bc6ba 100644--- a/apps/desktop/src/main/model-access/__tests__/modelsSyncRefresh.test.ts+++ b/apps/desktop/src/main/model-access/__tests__/modelsSyncRefresh.test.ts@@ -14,6 +14,20 @@ import {} from '../modelsSyncRefresh.js';describe('parseModelsSyncPayload', () => {+ it.each(['available', 'requires_payment'] as const)(+ 'accepts standalone speech from the opted-in v5 catalog (%s)',+ (availability) => {+ const model = {+ id: 'speech-from-gateway', name: 'Gateway Speech', mode: 'audio_speech',+ currency: 'USD', agents: [], availability,+ inputCostPerCharacter: 0.00001, outputCostPerAudioToken: 0.00002,+ modalities: { input: ['text'], output: ['audio'] },+ };+ expect(parseModelsSyncPayload({ schemaVersion: 5, accountTier: 'free', models: [model] }))+ .toEqual({ ok: true, accountTier: 'free', models: [model] });+ },+ );+const baseModel = {id: 'deepseek/deepseek-v4-pro',name: 'DeepSeek V4 Pro',@@ -223,6 +237,7 @@ describe('waitForModelsSyncRefresh', () => {baseUrl: 'https://model-access.example.com',timeoutMs: 20_000,cache: 'no-store',+ headers: { 'X-Cindy-Model-Capabilities': 'audio_speech' },},});expect(Number.isFinite(XD_MODELS_SYNC_TIMEOUT_MS)).toBe(true);diff --git a/apps/desktop/src/main/model-access/modelsSyncRefresh.ts b/apps/desktop/src/main/model-access/modelsSyncRefresh.tsindex 01f04b48a8..d481b89595 100644--- a/apps/desktop/src/main/model-access/modelsSyncRefresh.ts+++ b/apps/desktop/src/main/model-access/modelsSyncRefresh.ts@@ -75,13 +75,15 @@ export function withModelsSyncOverallDeadline<T>(export function buildModelsSyncRequest(baseUrl: string | (() => string)): {path: typeof XD_MODELS_SYNC_PATH;- options: { baseUrl: string | (() => string); timeoutMs: number; cache: 'no-store' };+ options: { baseUrl: string | (() => string); timeoutMs: number; cache: 'no-store'; headers: Record<string, string> };} {return {path: XD_MODELS_SYNC_PATH,options: {baseUrl,timeoutMs: XD_MODELS_SYNC_TIMEOUT_MS,+ // Older v5 clients reject standalone audio; older servers safely ignore this opt-in.+ headers: { 'X-Cindy-Model-Capabilities': 'audio_speech' },// 模型权限随订阅权益变化,强制刷新不能命中 Electron HTTP cache。cache: 'no-store',},diff --git a/docs/model-registry-v4-media.md b/docs/model-registry-v4-media.mdindex c1a0327f8c..abc593d624 100644--- a/docs/model-registry-v4-media.md+++ b/docs/model-registry-v4-media.md@@ -97,6 +97,12 @@ V1–V3 解析保持原有契约;新媒体字段、媒体原生协议和空 Ag### 发布前置条件+账号模型目录 `/api/model-access/models?schemaVersion=5` 的语音合成扩展使用请求头+`X-Cindy-Model-Capabilities: audio_speech` 显式声明客户端能解析独立音频条目。+服务端仅向声明该能力的 V5 请求下发 Gateway 中的 `audio_speech`,旧客户端维持原列表;+旧服务端忽略该请求头,当前客户端继续接受原有 V5 响应。该能力声明不改变 Gateway 授权、+付费解锁或组织权限,也不声明客户端已有 TTS 执行器。+相同 `registrySchemaVersion=4` 或 `schemaVersion=5` 请求不能证明客户端认识本次扩展。公共目录请求必须同时声明 `registryMedia=1`,服务端只向明确声明该能力的 V4/V5 请求返回完整目录(V4 仍展开 V5 官方价格)。无标识、未知标识、重复参数