feat: 完善gemini格式转换
This commit is contained in:
@@ -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 *
|
|||||||
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())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user