Skip to content

Commit

Permalink
Try to fix Gemini streaming return being truncated by FinishReason. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mxdlzg authored Jun 13, 2024
1 parent ed71721 commit b1520b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion relay/adaptor/gemini/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,10 @@ func responseGeminiChat2OpenAI(response *ChatResponse) *openai.TextResponse {
func streamResponseGeminiChat2OpenAI(geminiResponse *ChatResponse) *openai.ChatCompletionsStreamResponse {
var choice openai.ChatCompletionsStreamResponseChoice
choice.Delta.Content = geminiResponse.GetResponseText()
choice.FinishReason = &constant.StopFinishReason
//choice.FinishReason = &constant.StopFinishReason
var response openai.ChatCompletionsStreamResponse
response.Id = fmt.Sprintf("chatcmpl-%s", random.GetUUID())
response.Created = helper.GetTimestamp()
response.Object = "chat.completion.chunk"
response.Model = "gemini"
response.Choices = []openai.ChatCompletionsStreamResponseChoice{choice}
Expand Down

0 comments on commit b1520b3

Please sign in to comment.