on main help sign in
Fix lint issue on OpenAI field access in streaming response handler
commit5ae1e751c58e01c0bdd8eb54bc7145f973d30e20 authorFabio Mora <17892293+Fuabioo@users.noreply.github.com> dateTue 15 Jul 2025, 21:10 (1 year ago) parente156b8f
1 file changed+2−2
internal/llm/provider/openai.go+2−2
internal/llm/provider/openai.go+2−2
@@ -342,7 +342,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
342342 slog.Debug("Response", "messages", string(jsonData))
343343 }
344344
345− if len(acc.ChatCompletion.Choices) == 0 {
345+ if len(acc.Choices) == 0 {
346346 eventChan <- ProviderEvent{
347347 Type: EventError,
348348 Error: fmt.Errorf("received empty streaming response from OpenAI API - check endpoint configuration"),
@@ -350,7 +350,7 @@ func (o *openaiClient) stream(ctx context.Context, messages []message.Message, t
350350 return
351351 }
352352
353− resultFinishReason := acc.ChatCompletion.Choices[0].FinishReason
353+ resultFinishReason := acc.Choices[0].FinishReason
354354 if resultFinishReason == "" {
355355 // If the finish reason is empty, we assume it was a successful completion
356356 // INFO: this is happening for openrouter for some reason