修改通义及openai日志输出
This commit is contained in:
parent
478cfc31d3
commit
ebe9e31de9
|
|
@ -57,7 +57,9 @@ func OpenAI(modelParam proto.ModelParam, imCtx *proto.IMParamContext, platform s
|
||||||
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
|
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
|
||||||
}
|
}
|
||||||
if len(chunk.Choices) > 0 {
|
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
|
answer += chunk.Choices[0].Delta.Content
|
||||||
tokens = chunk.Usage.TotalTokens
|
tokens = chunk.Usage.TotalTokens
|
||||||
PromptTokens = chunk.Usage.PromptTokens
|
PromptTokens = chunk.Usage.PromptTokens
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ func Tongyi(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
|
||||||
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
|
chunk.Created = -1 // 这里由于没有返回结束标志,所以用该字段来判断
|
||||||
}
|
}
|
||||||
if len(chunk.Choices) > 0 {
|
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
|
answer += chunk.Choices[0].Delta.Content
|
||||||
tokens = chunk.Usage.TotalTokens
|
tokens = chunk.Usage.TotalTokens
|
||||||
PromptTokens = chunk.Usage.PromptTokens
|
PromptTokens = chunk.Usage.PromptTokens
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue