diff --git a/lib/ai/model-router.ts b/lib/ai/model-router.ts index fbf51a7d0..f2a1c309d 100644 --- a/lib/ai/model-router.ts +++ b/lib/ai/model-router.ts @@ -143,17 +143,28 @@ export async function routeToModel(params: { ); if (configuredModel) { + const isImageIntent = intent === "image_edit" || intent === "image_gen"; const matchesVision = !config.requireVision || configuredModel.model.supportsVision; const matchesImageGen = !config.requireImageGen || configuredModel.model.supportsImageGen; + const allowImageIntentWithImageGenOnly = + isImageIntent && configuredModel.model.supportsImageGen; - if (matchesVision && matchesImageGen) { + if ((matchesVision && matchesImageGen) || allowImageIntentWithImageGenOnly) { + const reason = allowImageIntentWithImageGenOnly && !matchesVision + ? `管理员配置的默认模型(按生图能力优先)→ ${configuredModel.model.displayName}` + : `管理员配置的默认模型 → ${configuredModel.model.displayName}`; console.log("[Model Router] ✅ Using configured default model:", configuredModel.model.displayName); + if (allowImageIntentWithImageGenOnly && !matchesVision) { + console.log( + "[Model Router] ℹ️ Configured default model does not support vision, but image intent can reuse Agent analysis and keep admin default image model." + ); + } return { id: configuredModel.model.id, displayName: configuredModel.model.displayName, providerType: configuredModel.provider.type, modelId: configuredModel.model.modelId, - reason: `管理员配置的默认模型 → ${configuredModel.model.displayName}`, + reason, }; }