@@ -2,6 +2,7 @@ package provider
@@ -348,8 +349,18 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
348 chunk.Choices[0].Delta.ToolCalls[0].Index = 0
349 chunk.Choices[0].Delta.ToolCalls[0].Index = 0
350 acc.AddChunk(chunk)
351 acc.AddChunk(chunk)
351− // This fixes multiple tool calls for some providers
352 for i, choice := range chunk.Choices {
352 for i, choice := range chunk.Choices {
353+ reasoning, ok := choice.Delta.JSON.ExtraFields["reasoning"]
354+ if ok && reasoning.Raw() != "" {
356+ json.Unmarshal([]byte(reasoning.Raw()), &reasoningStr)
357+ if reasoningStr != "" {
358+ eventChan <- ProviderEvent{
359+ Type: EventThinkingDelta,
360+ Thinking: reasoningStr,
353 if choice.Delta.Content != "" {
364 if choice.Delta.Content != "" {
354 eventChan <- ProviderEvent{
365 eventChan <- ProviderEvent{
355 Type: EventContentDelta,
366 Type: EventContentDelta,