fix: parse reasoning from delta.reasoning (OpenAI format)

Different providers use different field names for reasoning traces:
- Claude/DeepSeek: delta.reasoning_content
- OpenAI/OpenRouter: delta.reasoning

Now checks both fields to ensure reasoning is captured regardless of
which format the API uses.

https://claude.ai/code/session_01HqtD9R33oqfB14Gu1V5wHC
This commit is contained in:
Claude
2026-01-31 15:16:24 +00:00
parent ea07b841aa
commit 53aca05a65

View File

@@ -396,9 +396,12 @@ class AIProviderManager {
yield { type: "token", content: delta.content };
}
// Extended thinking / reasoning (Claude, DeepSeek, etc.)
// Extended thinking / reasoning (multiple formats across providers)
// - Claude/DeepSeek: delta.reasoning_content
// - OpenAI/OpenRouter: delta.reasoning
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const reasoning = (delta as any)?.reasoning_content;
const deltaAny = delta as any;
const reasoning = deltaAny?.reasoning_content || deltaAny?.reasoning;
if (reasoning) {
yield { type: "reasoning", content: reasoning };
}