feat: support gpt-4 with vision (#683, #714)

This commit is contained in:
JustSong
2023-11-19 18:38:54 +08:00
parent 76f9288c34
commit 495fc628e4
10 changed files with 56 additions and 17 deletions

View File

@@ -132,7 +132,7 @@ func openaiHandler(c *gin.Context, resp *http.Response, consumeQuota bool, promp
if textResponse.Usage.TotalTokens == 0 {
completionTokens := 0
for _, choice := range textResponse.Choices {
completionTokens += countTokenText(choice.Message.Content, model)
completionTokens += countTokenText(choice.Message.StringContent(), model)
}
textResponse.Usage = Usage{
PromptTokens: promptTokens,