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): preserve gateway media model ids

liugaowei8b55f3a3c8a5
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/imageModelCatalogSync.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/imageModelCatalogSync.test.ts
index 794f776b31..aa80db3d4c 100644
--- a/apps/desktop/src/main/cindy-brain/__tests__/imageModelCatalogSync.test.ts
+++ b/apps/desktop/src/main/cindy-brain/__tests__/imageModelCatalogSync.test.ts
@@ -1,60 +1,24 @@
-/**
- * imageModelCatalogSync.test.ts — 图像模型两份打包源的同源守卫。
- *
- * 运行时清单以 providers.json 目录(getActiveCatalog)为准,目录缺区即视为
- * 能力暂不可用(不再回落常量,见 cindyMediaCatalog.ts);@cindy/mcps 的
- * GATEWAY_IMAGE_MODELS 仍是图像通道 enum(GatewayImageModel)的类型正本。
- * 两者随 App 同版发布,必须逐项一致——漂移会造成"下拉可选但图像通道
- * enum 不认"(或反之)的割裂。改任一边,另一边必须同步。
- */
+/** XD 媒体成员只由运行时 Gateway `/models` 投影,不能再回落打包目录。 */
-import { describe, it, expect } from 'vitest';
-import { GATEWAY_IMAGE_MODELS } from '../../cindy-proxy-media/types.js';
+import { describe, expect, it } from 'vitest';
import { BUNDLED_CATALOG } from '@cindy/model-providers';
-const LEGACY_PREVIEW_IMAGE_MODELS = ['gemini-3-pro-image-preview', 'gemini-3.1-flash-image-preview'] as const;
-const ACTIVE_GEMINI_IMAGE_MODELS = ['gemini-3-pro-image', 'gemini-3.1-flash-image'] as const;
-
-describe('图像模型清单同源守卫', () => {
- it('内置目录 xd.imageModels 与 @cindy/mcps 打包常量逐项一致(id + 显示名)', () => {
- const xd = BUNDLED_CATALOG.providers.find((p) => p.id === 'xd');
- expect(xd?.imageModels, '内置目录 xd 供应商缺 imageModels 区').toBeTruthy();
- expect(xd?.imageModels).toEqual(GATEWAY_IMAGE_MODELS.map((m) => ({ id: m.id, name: m.label })));
- });
-
- it('旧 preview alias 不再进入目录、打包兜底或默认档位', () => {
+describe('媒体模型目录来源守卫', () => {
+ it('bundled XD 只保留 provider 身份,不携带图片或视频成员', () => {
const xd = BUNDLED_CATALOG.providers.find((p) => p.id === 'xd');
- const catalogIds = new Set((xd?.imageModels ?? []).map((m) => m.id));
- const fallbackIds = new Set<string>(GATEWAY_IMAGE_MODELS.map((m) => m.id));
- const defaults = new Set<string>(Object.values(xd?.imageDefaults ?? {}));
-
- for (const id of LEGACY_PREVIEW_IMAGE_MODELS) {
- expect(catalogIds.has(id), `${id} 仍在内置目录`).toBe(false);
- expect(fallbackIds.has(id), `${id} 仍在图片通道打包兜底`).toBe(false);
- expect(defaults.has(id), `${id} 仍被默认档位引用`).toBe(false);
- }
+ expect(xd?.imageModels).toBeUndefined();
+ expect(xd?.imageDefaults).toBeUndefined();
+ expect(xd?.videoModels).toBeUndefined();
+ expect(xd?.videoDefaults).toBeUndefined();
});
- it('网关当前 Gemini alias 同时进入目录与打包兜底,draft 指向 Flash', () => {
- const xd = BUNDLED_CATALOG.providers.find((p) => p.id === 'xd');
- const catalogIds = new Set((xd?.imageModels ?? []).map((m) => m.id));
- const fallbackIds = new Set<string>(GATEWAY_IMAGE_MODELS.map((m) => m.id));
-
- for (const id of ACTIVE_GEMINI_IMAGE_MODELS) {
- expect(catalogIds.has(id), `${id} 未进入内置目录`).toBe(true);
- expect(fallbackIds.has(id), `${id} 未进入图片通道打包兜底`).toBe(true);
- }
- expect(xd?.imageDefaults?.draft).toBe('gemini-3.1-flash-image');
- });
-});
-
-describe('图像默认选型入册守卫', () => {
- it('内置目录 xd.imageDefaults 存在且每个值都指向在册模型', () => {
- const xd = BUNDLED_CATALOG.providers.find((p) => p.id === 'xd');
- const ids = new Set((xd?.imageModels ?? []).map((m) => m.id));
- expect(xd?.imageDefaults?.standard, '缺 imageDefaults.standard(默认选型必须入册,代码零字面量)').toBeTruthy();
- for (const v of Object.values(xd?.imageDefaults ?? {})) {
- expect(ids.has(v as string), `imageDefaults 值 ${String(v)} 不在 imageModels`).toBe(true);
- }
+ it('第三方 OpenAI 的媒体目录仍保留完整 provider-aware modelId', () => {
+ const openai = BUNDLED_CATALOG.providers.find((p) => p.id === 'openai');
+ expect(openai?.imageModels).toEqual([
+ expect.objectContaining({
+ id: 'openai/gpt-image-2',
+ modalities: { input: ['text', 'image'], output: ['image'] },
+ }),
+ ]);
});
});
diff --git a/apps/desktop/src/main/cindy-brain/cindyMediaCatalog.ts b/apps/desktop/src/main/cindy-brain/cindyMediaCatalog.ts
index c6e8e37fb4..c127fc685e 100644
--- a/apps/desktop/src/main/cindy-brain/cindyMediaCatalog.ts
+++ b/apps/desktop/src/main/cindy-brain/cindyMediaCatalog.ts
@@ -2,9 +2,9 @@
* cindyMediaCatalog.ts — cindy 槽能力配置的纯派生(白名单 + 默认/档位选型)。
* [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
*
- * 输入是 providers.json 运行时目录的供应商数组(与会话模型列表**同一获取来源**,
- * 见 maker-host/active-catalog 的 getActiveCatalog),输出图像 / 视频 / 向量各自的
- * 可选清单与默认选型。本文件**零模型字面量**:清单与默认全部来自目录。
+ * 输入是 active catalog 的供应商数组(与会话模型列表**同一获取来源**,
+ * 见 maker-host/active-catalog 的 getActiveCatalog)。其中 XD 媒体由 Gateway `/models`
+ * 动态投影,第三方媒体来自各 Provider 目录;本文件**零模型字面量**。
*
* 文件名留着 "Media" 是历史(2026-08-04 加入向量类目时未改名,避免一次纯改名
* 的大 diff 冲掉 blame);三个类目共用同一套派生规则,差异只在读目录的哪个字段。
diff --git a/apps/desktop/src/main/cindy-brain/index.ts b/apps/desktop/src/main/cindy-brain/index.ts
index 98aa564879..1522d1ac9c 100644
--- a/apps/desktop/src/main/cindy-brain/index.ts
+++ b/apps/desktop/src/main/cindy-brain/index.ts
@@ -3096,8 +3096,8 @@ function isVideoCatalogProviderReady(providerId: string): boolean {
/**
* 当前媒体能力配置(图像/视频同一套推导)——与会话模型列表**同一获取
- * 来源**:providers.json 运行时目录(getActiveCatalog,OSS 热更 + 内置兜底),
- * 汇总各供应商的 imageModels/imageDefaults 或 videoModels/videoDefaults。
+ * 来源**:active catalog。XD 媒体由 Gateway `/models` 动态投影,第三方媒体
+ * 保留各 Provider 的 imageModels/imageDefaults 或 videoModels/videoDefaults。
* 清单与默认/档位选型全部来自目录,主机代码零
* 模型字面量;派生规则见 cindyMediaCatalog.ts。
*
diff --git a/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts b/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
index 5013079979..5519644be4 100644
--- a/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
+++ b/apps/desktop/src/main/cindy-media/__tests__/invocationService.test.ts
@@ -284,6 +284,42 @@ describe('Cindy Core media invocation state and security boundary', () => {
expect(mocks.ingestMedia).toHaveBeenCalledTimes(1);
});
+ it('Guide 查询键无前缀时仍持久化并提交完整 Gateway modelId', async () => {
+ const fullModelId = 'openai/gpt-image-2';
+ mocks.models.mockResolvedValue([
+ { id: fullModelId, name: 'GPT Image 2', providerId: 'xd', mode: 'image_generation' },
+ ]);
+ mocks.guide.mockResolvedValue({
+ ...resolvedGuide(
+ operation({
+ mode: 'sync',
+ media: [{ path: ['data'], encoding: 'base64', kind: 'image' }],
+ }),
+ ),
+ modelId: 'gpt-image-2',
+ });
+ mocks.outboundFetch.mockResolvedValue(
+ new Response(JSON.stringify({ data: PNG.toString('base64') }), {
+ status: 200,
+ headers: { 'content-type': 'application/json' },
+ }),
+ );
+
+ const prepared = await callCindyMedia({
+ action: 'prepare',
+ modelId: fullModelId,
+ capability: 'image.generate',
+ });
+ const invocationId = prepared.invocation_id as string;
+ await callCindyMedia({ action: 'request', invocationId, body: { prompt: 'cat' } });
+
+ expect(prepared).toMatchObject({ ok: true, model_id: fullModelId });
+ expect(mocks.guide).toHaveBeenCalledWith(fullModelId);
+ expect(mocks.rows.get(invocationId)?.modelId).toBe(fullModelId);
+ const [, init] = mocks.outboundFetch.mock.calls[0];
+ expect(JSON.parse(init.body)).toMatchObject({ model: fullModelId });
+ });
+
it('同名媒体模型按 providerId 精确准备并调用第三方来源', async () => {
const providerModel = {
id: 'openai/gpt-image-2',
diff --git a/apps/desktop/src/main/cindy-media/invocationService.ts b/apps/desktop/src/main/cindy-media/invocationService.ts
index cf15f1dc8a..eaf5668f79 100644
--- a/apps/desktop/src/main/cindy-media/invocationService.ts
+++ b/apps/desktop/src/main/cindy-media/invocationService.ts
@@ -1198,7 +1198,8 @@ async function prepareInvocation(
const { operations: _operations, ...guideProtocol } = resolvedGuide.guide;
void _operations;
preparedGuide = {
- modelId: resolvedGuide.modelId,
+ // Guide 查询键不参与调用身份;配置、持久化和 Gateway 请求始终使用完整 modelId。
+ modelId,
...guideProtocol,
...operation,
};
diff --git a/apps/desktop/src/main/maker-host/__tests__/activeCatalogXdAvailability.test.ts b/apps/desktop/src/main/maker-host/__tests__/activeCatalogXdAvailability.test.ts
index 1fa668f0ef..f0a2b2b0cf 100644
--- a/apps/desktop/src/main/maker-host/__tests__/activeCatalogXdAvailability.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/activeCatalogXdAvailability.test.ts
@@ -39,6 +39,9 @@ describe('XD 网关权威模型清单重建', () => {
setActiveCatalog(BUNDLED_CATALOG);
expect(xdModels('claude-code')).toEqual([]);
expect(xdModels('codex')).toEqual([]);
+ const xd = getActiveCatalog().providers.find((provider) => provider.id === 'xd');
+ expect(xd?.imageModels).toEqual([]);
+ expect(xd?.videoModels).toEqual([]);
});
it('显式空列表保持 XD 模型不可用', () => {
@@ -48,7 +51,7 @@ describe('XD 网关权威模型清单重建', () => {
expect(xdModels('codex')).toEqual([]);
});
- it('current Catalog controls the XD media shell while /models controls chat membership', () => {
+ it('/models 同时控制 XD chat 与媒体成员,忽略 Catalog 里的旧媒体清单', () => {
const catalog = JSON.parse(JSON.stringify(BUNDLED_CATALOG)) as typeof BUNDLED_CATALOG;
const catalogXd = catalog.providers.find((provider) => provider.id === 'xd');
if (!catalogXd) throw new Error('missing XD provider fixture');
@@ -70,12 +73,42 @@ describe('XD 网关权威模型清单重建', () => {
];
setActiveCatalog(catalog);
+ setXdGatewayModels([
+ {
+ id: 'openai/gpt-image-2',
+ name: 'GPT Image 2',
+ mode: 'image_generation',
+ agents: [],
+ modalities: { input: ['text', 'image'], output: ['image'] },
+ },
+ {
+ id: 'bytedance/seedance-2.5',
+ name: 'Seedance 2.5',
+ mode: 'video_generation',
+ agents: [],
+ modalities: { input: ['text', 'image'], output: ['video'] },
+ },
+ ]);
const activeXd = getActiveCatalog().providers.find((provider) => provider.id === 'xd');
expect(activeXd?.name).toBe('Catalog-supplied XD');
- expect(activeXd?.imageModels).toEqual([]);
+ expect(activeXd?.imageModels).toEqual([
+ {
+ id: 'openai/gpt-image-2',
+ name: 'GPT Image 2',
+ modalities: { input: ['text', 'image'], output: ['image'] },
+ },
+ ]);
+ expect(activeXd?.imageDefaults).toEqual({ standard: 'openai/gpt-image-2' });
expect(activeXd?.embeddingModels).toEqual([]);
- expect(activeXd?.videoModels).toEqual([{ id: 'seedance-fast', name: 'Seedance Fast' }]);
+ expect(activeXd?.videoModels).toEqual([
+ {
+ id: 'bytedance/seedance-2.5',
+ name: 'Seedance 2.5',
+ modalities: { input: ['text', 'image'], output: ['video'] },
+ },
+ ]);
+ expect(activeXd?.videoDefaults).toEqual({ standard: 'bytedance/seedance-2.5' });
expect(xdModels('claude-code')).toEqual([]);
});
diff --git a/apps/desktop/src/main/maker-host/__tests__/providerCatalogRealmReload.test.ts b/apps/desktop/src/main/maker-host/__tests__/providerCatalogRealmReload.test.ts
index 369509c941..f39fab5938 100644
--- a/apps/desktop/src/main/maker-host/__tests__/providerCatalogRealmReload.test.ts
+++ b/apps/desktop/src/main/maker-host/__tests__/providerCatalogRealmReload.test.ts
@@ -551,12 +551,8 @@ describe('provider catalog realm reload', () => {
const startupXd = getDesktopSelectableCatalog().providers.find(
(provider) => provider.id === 'xd',
);
- expect(startupXd?.imageModels).toEqual(
- BUNDLED_CATALOG.providers.find((provider) => provider.id === 'xd')?.imageModels,
- );
- expect(startupXd?.videoModels).toEqual(
- BUNDLED_CATALOG.providers.find((provider) => provider.id === 'xd')?.videoModels,
- );
+ expect(startupXd?.imageModels).toEqual([]);
+ expect(startupXd?.videoModels).toEqual([]);
expect(startupXd?.embeddingModels).toEqual([]);
h.endpoint = 'https://model.global.example';
@@ -649,7 +645,7 @@ describe('provider catalog realm reload', () => {
const currentXd = currentCatalog.providers.find((provider) => provider.id === 'xd');
expect(currentXd?.imageModels).toEqual([]);
expect(currentXd?.embeddingModels).toEqual([]);
- expect(currentXd?.videoModels).toEqual([{ id: 'seedance-fast', name: 'Seedance Fast' }]);
+ expect(currentXd?.videoModels).toEqual([]);
expect(deriveCindyMediaConfig(currentCatalog.providers, 'embed')).toEqual({
models: [],
defaults: null,
@@ -721,8 +717,8 @@ describe('provider catalog realm reload', () => {
const projectedEmbedding = getDesktopSelectableCatalog().providers.find(
(provider) => provider.id === 'xd',
);
- expect(projectedEmbedding?.imageModels).toEqual(inheritedEmbeddingXd.imageModels);
- expect(projectedEmbedding?.videoModels).toEqual(inheritedEmbeddingXd.videoModels);
+ expect(projectedEmbedding?.imageModels).toEqual([]);
+ expect(projectedEmbedding?.videoModels).toEqual([]);
expect(projectedEmbedding?.embeddingModels).toEqual([]);
const evidenceUpgrade = refreshActiveCatalogFromSource();
@@ -887,7 +883,7 @@ describe('provider catalog realm reload', () => {
getDesktopSelectableCatalog().providers.find((provider) => provider.id === 'xd'),
).toMatchObject({
imageModels: [],
- videoModels: fallbackXd.videoModels,
+ videoModels: [],
embeddingModels: fallbackXd.embeddingModels,
});
expect(events).toHaveLength(2);
@@ -980,7 +976,7 @@ describe('provider catalog realm reload', () => {
expect(activeMarker()).toBe('catalog-current-same-registry');
expect(promotedXd?.imageModels).toEqual([]);
expect(promotedXd?.embeddingModels).toEqual([]);
- expect(promotedXd?.videoModels).toEqual([{ id: 'seedance-fast', name: 'Seedance Fast' }]);
+ expect(promotedXd?.videoModels).toEqual([]);
expect(promoted.providers.find((provider) => provider.id === 'xai')?.videoModels).toEqual(
recoveredXai.videoModels,
);
diff --git a/apps/desktop/src/main/maker-host/active-catalog.ts b/apps/desktop/src/main/maker-host/active-catalog.ts
index 48ec9a45e8..95ba03fc5b 100644
--- a/apps/desktop/src/main/maker-host/active-catalog.ts
+++ b/apps/desktop/src/main/maker-host/active-catalog.ts
@@ -136,9 +136,8 @@ export interface XdGatewayAgentOverride {
/**
* 服务端下发的 XD 网关模型条目(shared/modelAccess ModelAccessGatewayModel 的子集)。
- * 命名沿用历史("聊天"),但条目本身不保证是聊天模型——是否聊天模型看 mode,
- * 服务端目前只透传已经过它自己 chat 过滤的条目,过滤范围以后可能放开(issue #882);
- * 客户端一律用 isChatEligible 判定,不依赖本类型名字或服务端过滤范围。
+ * 命名沿用历史("聊天"),但条目本身不保证是聊天模型——v4 同时包含 chat 与媒体模型,
+ * 客户端一律按 agents/mode 投影到对应消费面,不从 id 猜测类型。
*
* 能力字段已由服务端一次归一化,客户端不再二次转换(见 model-access/index.ts)。
*/
@@ -790,6 +789,38 @@ function withEmptyModels(p: Provider): Provider {
return { ...p, models };
}
+function projectXdGatewayMediaModels(
+ provider: Provider,
+ gatewayModels: readonly XdGatewayModelInfo[],
+): Provider {
+ const imageModels = gatewayModels
+ .filter((model) => model.mode === 'image_generation')
+ .map((model) => ({
+ id: model.id,
+ name: model.name ?? model.id,
+ ...(model.modalities ? { modalities: model.modalities } : {}),
+ }));
+ const videoModels = gatewayModels
+ .filter((model) => model.mode === 'video_generation')
+ .map((model) => ({
+ id: model.id,
+ name: model.name ?? model.id,
+ ...(model.modalities ? { modalities: model.modalities } : {}),
+ }));
+ const identity = { ...provider };
+ delete identity.imageModels;
+ delete identity.imageDefaults;
+ delete identity.videoModels;
+ delete identity.videoDefaults;
+ return {
+ ...identity,
+ imageModels,
+ videoModels,
+ ...(imageModels[0] ? { imageDefaults: { standard: imageModels[0].id } } : {}),
+ ...(videoModels[0] ? { videoDefaults: { standard: videoModels[0].id } } : {}),
+ };
+}
+
function computeMerged(): Catalog {
const source = base ?? BUNDLED_CATALOG;
const b =
@@ -836,9 +867,8 @@ function computeMerged(): Catalog {
// 作者错误隔离进 warnings,由刷新路径读走打日志,不拖垮其余条目。
const plan = planRegistryRoots(b.modelRegistry);
lastPlanWarnings = plan.warnings;
- // XD 的对话模型成员仍由下方 `/models` 权威重建,但 provider 壳中的媒体清单、
- // 默认项和显式空值必须服从当前 Catalog。只有目录本身缺少 XD(生产加载经
- // mergeWithBundled 后通常不会发生)才回落与 evidence 同级安全的 bundled 壳。
+ // XD 的模型成员与媒体清单都由下方 `/models` 权威重建。Catalog 只保留 provider
+ // 身份壳;其中残留的旧媒体字段不得成为第二事实源。
const fallbackXdCatalog =
baseCapabilityEvidence === 'current'
? projectUnverifiedCatalogFallbackForBuildRegion(
@@ -1161,7 +1191,7 @@ function computeMerged(): Catalog {
)
.map(({ model }) => model);
}
- return { ...p, models };
+ return { ...projectXdGatewayMediaModels(p, gwModels), models };
});
if (providers === b.providers) return b; // 无 augment、无 custom → 原样返回
diff --git a/apps/desktop/src/main/model-access/__tests__/mediaModels.test.ts b/apps/desktop/src/main/model-access/__tests__/mediaModels.test.ts
index 534cac5f22..4a43130206 100644
--- a/apps/desktop/src/main/model-access/__tests__/mediaModels.test.ts
+++ b/apps/desktop/src/main/model-access/__tests__/mediaModels.test.ts
@@ -193,6 +193,56 @@ describe('listAvailableMediaModels', () => {
);
});
+ it('只在 Guide 查询边界移除 modelId namespace', async () => {
+ serverApiFetchMock.mockResolvedValueOnce({
+ modelId: 'gpt-image-2',
+ guide: {
+ schemaVersion: 1,
+ guideId: 'openai-images-v1',
+ revision: '2026-08-20.1',
+ connection: { providerId: 'xd' },
+ operations: [
+ {
+ capability: 'image.generate',
+ request: {
+ method: 'POST',
+ path: '/images/generations',
+ bodyEncoding: 'json',
+ bodyModelPath: ['model'],
+ timeoutMs: 1_000,
+ maxRequestBytes: 1_024,
+ maxResponseBytes: 1_024,
+ },
+ response: {
+ mode: 'sync',
+ media: [
+ {
+ path: ['data', '*', 'url'],
+ encoding: 'url',
+ kind: 'image',
+ allowedUrlHosts: ['example.com'],
+ },
+ ],
+ },
+ instructions: '按协议组装请求。',
+ exampleBody: { prompt: 'hello' },
+ inputSchema: { type: 'object' },
+ officialDocs: 'https://example.com/images-api',
+ },
+ ],
+ },
+ });
+
+ await expect(fetchMediaInvocationGuide('openai/gpt-image-2')).resolves.toMatchObject({
+ modelId: 'gpt-image-2',
+ guide: { guideId: 'openai-images-v1' },
+ });
+ expect(serverApiFetchMock).toHaveBeenLastCalledWith(
+ '/api/model-access/invocation-guide?modelId=gpt-image-2',
+ expect.any(Object),
+ );
+ });
+
it('把更高 Guide schemaVersion 分类为客户端需要升级', async () => {
serverApiFetchMock.mockResolvedValueOnce({
modelId: 'image-with-guide',
diff --git a/apps/desktop/src/main/model-access/mediaModels.ts b/apps/desktop/src/main/model-access/mediaModels.ts
index c344487314..2739b087e1 100644
--- a/apps/desktop/src/main/model-access/mediaModels.ts
+++ b/apps/desktop/src/main/model-access/mediaModels.ts
@@ -217,7 +217,8 @@ export async function fetchMediaInvocationGuide(
modelId: string,
timeoutMs = MEDIA_MODEL_REQUEST_TIMEOUT_MS,
): Promise<ResolvedMediaInvocationGuide> {
- const query = new URLSearchParams({ modelId });
+ const guideModelId = mediaInvocationGuideModelId(modelId);
+ const query = new URLSearchParams({ modelId: guideModelId });
const payload = await serverApiFetch<unknown>(
`${MODEL_ACCESS_INVOCATION_GUIDE_PATH}?${query.toString()}`,
{
@@ -226,7 +227,12 @@ export async function fetchMediaInvocationGuide(
logLabel: MODEL_ACCESS_INVOCATION_GUIDE_PATH,
},
);
- return parseResolvedGuidePayload(payload, modelId);
+ return parseResolvedGuidePayload(payload, guideModelId);
+}
+
+/** Guide 只按模型协议名查询;provider/routing namespace 仍保留在真实调用身份中。 */
+export function mediaInvocationGuideModelId(modelId: string): string {
+ return modelId.slice(modelId.lastIndexOf('/') + 1);
}
function parseResolvedGuidePayload(
diff --git a/packages/model-providers/src/builtin.ts b/packages/model-providers/src/builtin.ts
index c45205a118..873fa09573 100644
--- a/packages/model-providers/src/builtin.ts
+++ b/packages/model-providers/src/builtin.ts
@@ -12,7 +12,7 @@
* 必须静态维护的——活在 `catalog/providers.json`(仓内正本 = OSS 发布物 = dev 直读),
* 此处从 json 引入作 bundled 兜底。
*
- * 身份卡(id / auth / access / routing / titleModel / 媒体模型清单)是随代码走的事实:
+ * 身份卡(id / auth / access / routing / titleModel)是随代码走的事实:
* 改它们必然伴随发版(SDK 集成 / 翻译桥 / 网关协议都是代码),所以写死在这里,
* 不再经 OSS 下发。OSS `cfg/providers.json`(v2)只承载 xai 清单 + presets 模板,
* 模型元数据与参考价只走同目录下严格版本化的 `model-registry.json`。
@@ -186,27 +186,6 @@ const XD_PROVIDER: Provider = {
auth: { method: 'managed' },
access: { kind: 'managed' },
titleModel: 'gpt-5.4-mini',
- imageModels: [
- { id: 'gpt-image-2', name: 'GPT Image 2' },
- { id: 'gemini-3-pro-image', name: 'Gemini 3 Pro Image' },
- { id: 'gemini-3.1-flash-image', name: 'Gemini 3.1 Flash Image' },
- ],
- imageDefaults: {
- standard: 'gpt-image-2',
- draft: 'gemini-3.1-flash-image',
- },
- videoModels: [
- { id: 'seedance-fast', name: 'Seedance 快速' },
- { id: 'seedance-pro', name: 'Seedance Pro' },
- { id: 'bytedance/seedance-2.5', name: 'Seedance 2.5' },
- { id: 'happyhorse', name: 'HappyHorse 1.0' },
- ],
- // 2.5 刻意不接管 best:它只到 720p,而 seedance-pro 有 1080p —— 让 tier=best
- // 指向 2.5 会把"要 1080p"的单子从可用变成明拒。2.5 需显式点名。
- videoDefaults: {
- standard: 'seedance-fast',
- best: 'seedance-pro',
- },
// 向量模型:id 必须与 @cindy/embedding-client 的 EmbeddingModelId 逐字一致
// (执行侧按 id 查 catalog 拿 provider 做 input_type 值域翻译,对不上就翻译不了)。
// 只列 2026-08-04 经网关实测确认可用的型号 + 同族高置信的 3-large。