mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-12 08:27:27 +02:00
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:
@@ -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 };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user