修改通义及openai日志输出

This commit is contained in:
junleea 2025-05-12 12:22:31 +08:00
parent 478cfc31d3
commit ebe9e31de9
2 changed files with 6 additions and 2 deletions

View File

@ -57,7 +57,9 @@ func OpenAI(modelParam proto.ModelParam, imCtx *proto.IMParamContext, platform s
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
}
if len(chunk.Choices) > 0 {
println(chunk.Choices[0].Delta.Content)
if proto.Config.LOG_OUTPUT {
log.Printf("openai_%s stream msg:%s\n", platform, chunk.Choices[0].Delta.Content)
}
answer += chunk.Choices[0].Delta.Content
tokens = chunk.Usage.TotalTokens
PromptTokens = chunk.Usage.PromptTokens

View File

@ -48,7 +48,9 @@ func Tongyi(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
}
if len(chunk.Choices) > 0 {
println(chunk.Choices[0].Delta.Content)
if proto.Config.LOG_OUTPUT {
log.Printf("tongyi stream msg:%s\n", chunk.Choices[0].Delta.Content)
}
answer += chunk.Choices[0].Delta.Content
tokens = chunk.Usage.TotalTokens
PromptTokens = chunk.Usage.PromptTokens