diff --git a/__tests__/validate.test.mjs b/__tests__/validate.test.mjs index 924b010..8963f45 100644 --- a/__tests__/validate.test.mjs +++ b/__tests__/validate.test.mjs @@ -298,6 +298,32 @@ describe('provider schema 反例(防 PR #1 重演)', () => { assert.equal(validate(data), true, JSON.stringify(validate.errors)) }) + it('接受 extra.reasoning 能力矩阵,同时保留 extra 其他扩展字段', () => { + const data = makeValidProvider() + data.models[0].extra = { + reasoning: { + supportedEfforts: ['low', 'medium', 'high', 'xhigh', 'max'], + defaultEffort: 'medium', + }, + providerSpecificFlag: true, + } + assert.equal(validate(data), true, JSON.stringify(validate.errors)) + }) + + it('拒绝 Ultra 与重复 reasoning effort', () => { + const ultra = makeValidProvider() + ultra.models[0].extra = { + reasoning: { supportedEfforts: ['high', 'ultra'], defaultEffort: 'high' }, + } + assert.equal(validate(ultra), false) + + const duplicate = makeValidProvider() + duplicate.models[0].extra = { + reasoning: { supportedEfforts: ['high', 'high'], defaultEffort: 'high' }, + } + assert.equal(validate(duplicate), false) + }) + it('接受 defaultTemperature: 0.7(合法 number)', () => { const data = makeValidProvider() data.models[0].defaultTemperature = 0.7 diff --git a/compute/providers/openai-codex.json b/compute/providers/openai-codex.json index 61ee9ec..5b3971f 100644 --- a/compute/providers/openai-codex.json +++ b/compute/providers/openai-codex.json @@ -42,6 +42,12 @@ "tool_use", "agent" ], + "extra": { + "reasoning": { + "supportedEfforts": ["low", "medium", "high", "xhigh", "max"], + "defaultEffort": "low" + } + }, "source": "preset" }, { @@ -62,6 +68,12 @@ "tool_use", "agent" ], + "extra": { + "reasoning": { + "supportedEfforts": ["low", "medium", "high", "xhigh", "max"], + "defaultEffort": "medium" + } + }, "source": "preset" }, { @@ -82,6 +94,12 @@ "tool_use", "fast" ], + "extra": { + "reasoning": { + "supportedEfforts": ["low", "medium", "high", "xhigh", "max"], + "defaultEffort": "medium" + } + }, "source": "preset" }, { diff --git a/manifest.json b/manifest.json index 1abf08c..1197159 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "version": "1.0.0", - "presetDataVersion": 75, + "presetDataVersion": 76, "updatedAt": "2026-07-19", "description": "DesireCore 官方配置中心" } diff --git a/schemas/provider.schema.json b/schemas/provider.schema.json index 6b898d3..047bbc8 100644 --- a/schemas/provider.schema.json +++ b/schemas/provider.schema.json @@ -252,7 +252,31 @@ }, "extra": { "type": "object", - "description": "模型特定配置:如 TTS 模型音色列表、ASR 支持格式等", + "description": "模型特定配置:如 TTS 模型音色列表、ASR 支持格式、模型级 reasoning effort 能力等。这里是兼容扩展面:旧客户端会安全保留并忽略未知子字段。", + "properties": { + "reasoning": { + "type": "object", + "required": ["supportedEfforts"], + "properties": { + "supportedEfforts": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { + "type": "string", + "enum": ["none", "minimal", "low", "medium", "high", "xhigh", "max"] + }, + "description": "当前模型与接入面实际接受的 OpenAI reasoning effort。none 在产品层映射为 off;Ultra 是多 Agent 编排模式,禁止写入。" + }, + "defaultEffort": { + "type": "string", + "enum": ["minimal", "low", "medium", "high", "xhigh", "max"], + "description": "当前模型在此接入面的推荐显式默认档位,必须同时存在于 supportedEfforts。" + } + }, + "additionalProperties": false + } + }, "additionalProperties": true }, "apiModelId": {