添加doubao 图片功能日志输出
This commit is contained in:
parent
4d974e4eab
commit
13bcffa72d
|
|
@ -75,6 +75,7 @@ type IMParamContext struct {
|
|||
ModelType string `json:"model_type"` //模型类型
|
||||
Question string `json:"question"` //问题
|
||||
Channel string `json:"channel"` //消息队列
|
||||
IsHasImage bool `json:"is_has_image"` //是否有图片
|
||||
}
|
||||
|
||||
// 用户向模型发送图片的消息结构
|
||||
|
|
|
|||
|
|
@ -90,8 +90,8 @@ func DouBaoV2(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
|
|||
if err != nil {
|
||||
log.Println("get doubao session history message error:", err)
|
||||
}
|
||||
//messagesStr, _ := json.Marshal(messages)
|
||||
//log.Println("doubao messages:", string(messagesStr))
|
||||
messagesStr, _ := json.Marshal(messages)
|
||||
log.Println("doubao messages:", string(messagesStr))
|
||||
|
||||
req := model.CreateChatCompletionRequest{
|
||||
Model: modelParam.Model,
|
||||
|
|
@ -137,7 +137,9 @@ func DouBaoV2(modelParam proto.ModelParam, imCtx *proto.IMParamContext) {
|
|||
choices := recv.Choices[0]
|
||||
if choices.FinishReason == proto.FinishReasonStop {
|
||||
answer += choices.Delta.Content
|
||||
if recv.Usage != nil {
|
||||
tokens += recv.Usage.TotalTokens
|
||||
}
|
||||
break
|
||||
} else {
|
||||
answer += choices.Delta.Content
|
||||
|
|
|
|||
Loading…
Reference in New Issue