Skip to content

Commit e4c45fa

Browse files
authored
Merge pull request #723 from maximhq/10-31-fix_handle_panic_in_gemini_responses_stream
fix: handle panic in gemini responses stream
2 parents 1d4eed6 + 9ce1f7f commit e4c45fa

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

core/schemas/mux.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,8 @@ func (cr *BifrostChatResponse) ToBifrostResponsesStreamResponse() *BifrostRespon
10571057
}
10581058
}
10591059

1060+
streamResp.ExtraFields.RequestType = ResponsesStreamRequest
1061+
10601062
// Return the created stream response
10611063
return streamResp
10621064
}

transports/bifrost-http/integrations/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,10 @@ func (g *GenericRouter) handleStreaming(ctx *fasthttp.RequestCtx, config RouteCo
722722
switch {
723723
case chunk.BifrostTextCompletionResponse != nil:
724724
convertedResponse, err = config.StreamConfig.TextStreamResponseConverter(chunk.BifrostTextCompletionResponse)
725-
case chunk.BifrostChatResponse != nil:
726-
convertedResponse, err = config.StreamConfig.ChatStreamResponseConverter(chunk.BifrostChatResponse)
727725
case chunk.BifrostResponsesStreamResponse != nil:
728726
convertedResponse, err = config.StreamConfig.ResponsesStreamResponseConverter(chunk.BifrostResponsesStreamResponse)
727+
case chunk.BifrostChatResponse != nil:
728+
convertedResponse, err = config.StreamConfig.ChatStreamResponseConverter(chunk.BifrostChatResponse)
729729
case chunk.BifrostSpeechStreamResponse != nil:
730730
convertedResponse, err = config.StreamConfig.SpeechStreamResponseConverter(chunk.BifrostSpeechStreamResponse)
731731
case chunk.BifrostTranscriptionStreamResponse != nil:

0 commit comments

Comments
 (0)