Commit 61601d38 by CaIon

feat: 完善gemini格式转换

parent f181ca25
...@@ -935,7 +935,7 @@ func GeminiChatStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp * ...@@ -935,7 +935,7 @@ func GeminiChatStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *
} }
} }
} }
logger.LogDebug(c, fmt.Sprintf("info.SendResponseCount = %d", info.SendResponseCount))
if info.SendResponseCount == 0 { if info.SendResponseCount == 0 {
// send first response // send first response
emptyResponse := helper.GenerateStartEmptyResponse(id, createAt, info.UpstreamModelName, nil) emptyResponse := helper.GenerateStartEmptyResponse(id, createAt, info.UpstreamModelName, nil)
...@@ -953,6 +953,11 @@ func GeminiChatStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp * ...@@ -953,6 +953,11 @@ func GeminiChatStreamHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *
if response.IsFinished() { if response.IsFinished() {
response.Choices[0].FinishReason = nil response.Choices[0].FinishReason = nil
} }
} else {
err = handleStream(c, info, emptyResponse)
if err != nil {
logger.LogError(c, err.Error())
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment