Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions internal/llm/provider/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
}
acc.AddChunk(chunk)
for i, choice := range chunk.Choices {
// Handle standard "reasoning" field
reasoning, ok := choice.Delta.JSON.ExtraFields["reasoning"]
if ok && reasoning.Raw() != "" {
reasoningStr := ""
Expand All @@ -361,6 +362,18 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
}
}
}
// Handle custom "reasoning_content" field from custom OSS servers
reasoningContent, ok := choice.Delta.JSON.ExtraFields["reasoning_content"]
if ok && reasoningContent.Raw() != "" {
reasoningStr := ""
json.Unmarshal([]byte(reasoningContent.Raw()), &reasoningStr)
if reasoningStr != "" {
eventChan <- ProviderEvent{
Type: EventThinkingDelta,
Thinking: reasoningStr,
}
}
}
if choice.Delta.Content != "" {
eventChan <- ProviderEvent{
Type: EventContentDelta,
Expand Down