feat: 统一错误提示

This commit is contained in:
CaIon
2024-03-20 20:36:55 +08:00
parent eb6257a8d8
commit a232afe9fd
8 changed files with 35 additions and 25 deletions

View File

@@ -154,7 +154,7 @@ func OpenaiHandler(c *gin.Context, resp *http.Response, promptTokens int, model
completionTokens := 0
for _, choice := range textResponse.Choices {
stringContent := string(choice.Message.Content)
ctkm, _ := service.CountTokenText(stringContent, model, false)
ctkm, _, _ := service.CountTokenText(stringContent, model, false)
completionTokens += ctkm
if checkSensitive {
sensitive, words, stringContent := service.SensitiveWordReplace(stringContent, false)