support gpt-4-1106-vision-preview

This commit is contained in:
CaIon
2023-11-17 18:24:37 +08:00
parent fc494416fc
commit 7e0d2606c3
13 changed files with 81 additions and 34 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(string(choice.Message.Content), model)
}
textResponse.Usage = Usage{
PromptTokens: promptTokens,