feat: use managed model capabilities for reasoning and image input

This commit is contained in:
2026-09-12 21:37:18 +08:00
parent e7701d1f2c
commit 26cbb29aa9
29 changed files with 652 additions and 271 deletions

View File

@@ -1,4 +1,5 @@
import type { IncomingMessage, ServerResponse } from 'node:http';
import { parseManagedReasoningChoice } from '../../../shared/managed-model-capabilities';
import type { ConversationInteractionResponse } from '../../coding-runtime/contracts';
import { CodingConversationServiceError } from '../../coding-runtime/conversation-service';
import { normalizeProductModelRef } from '../../coding-projects/project-config';
@@ -182,12 +183,15 @@ export async function handleCodingConversationRoutes(
return true;
}
if (action === 'thinking' && req.method === 'POST') {
const body = await parseJsonBody<{ thinkingLevel?: unknown }>(req);
const body = await parseJsonBody<{ thinkingLevel?: unknown; reasoningChoice?: unknown }>(req);
const reasoningChoice = body.reasoningChoice === undefined ? undefined : parseManagedReasoningChoice(body.reasoningChoice);
if (reasoningChoice === null) invalidRequest('Reasoning choice is invalid');
if (!THINKING_LEVELS.has(String(body.thinkingLevel))) invalidRequest('Thinking level is invalid');
sendJson(res, 200, {
model: await service.setThinking(
conversationId,
body.thinkingLevel as 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'max',
reasoningChoice ?? undefined,
),
});
return true;