fixed bug for QWen response blank quotes

This commit is contained in:
RockYang
2024-04-19 10:30:02 +08:00
parent 3bb5b66e8b
commit a15f431a7f
3 changed files with 15 additions and 9 deletions

View File

@@ -336,10 +336,12 @@ func (h *ChatHandler) sendMessage(ctx context.Context, session *types.ChatSessio
}
if session.Model.Platform == types.QWen {
req.Input = map[string]interface{}{"prompt": prompt}
if len(reqMgs) > 0 {
req.Input["messages"] = reqMgs
}
req.Input = make(map[string]interface{})
reqMgs = append(reqMgs, types.Message{
Role: "user",
Content: prompt,
})
req.Input["messages"] = reqMgs
} else if session.Model.Platform == types.OpenAI { // extract image for gpt-vision model
imgURLs := utils.ExtractImgURL(prompt)
logger.Debugf("detected IMG: %+v", imgURLs)

View File

@@ -82,10 +82,11 @@ func (h *ChatHandler) sendQWenMessage(
continue
}
if strings.HasPrefix(line, "data:") {
content = line[5:]
if !strings.HasPrefix(line, "data:") {
continue
}
content = line[5:]
var resp qWenResp
if len(contents) == 0 { // 发送消息头
if !outPutStart {