mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-02 12:09:05 +08:00
🐛 AI DeepSeek 422 Unprocessable Entity https://github.com/siyuan-note/siyuan/issues/14347
This commit is contained in:
parent
95dc762faf
commit
42c0461e3d
@ -109,7 +109,9 @@ func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret str
|
||||
|
||||
ret = buf.String()
|
||||
ret = strings.TrimSpace(ret)
|
||||
retContextMsgs = append(retContextMsgs, msg, ret)
|
||||
if "" != ret {
|
||||
retContextMsgs = append(retContextMsgs, msg, ret)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -31,15 +31,27 @@ func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, m
|
||||
var reqMsgs []openai.ChatCompletionMessage
|
||||
|
||||
for _, ctxMsg := range contextMsgs {
|
||||
if "" == ctxMsg {
|
||||
continue
|
||||
}
|
||||
|
||||
reqMsgs = append(reqMsgs, openai.ChatCompletionMessage{
|
||||
Role: "user",
|
||||
Content: ctxMsg,
|
||||
})
|
||||
}
|
||||
reqMsgs = append(reqMsgs, openai.ChatCompletionMessage{
|
||||
Role: "user",
|
||||
Content: msg,
|
||||
})
|
||||
|
||||
if "" != msg {
|
||||
reqMsgs = append(reqMsgs, openai.ChatCompletionMessage{
|
||||
Role: "user",
|
||||
Content: msg,
|
||||
})
|
||||
}
|
||||
|
||||
if 1 > len(reqMsgs) {
|
||||
stop = true
|
||||
return
|
||||
}
|
||||
|
||||
req := openai.ChatCompletionRequest{
|
||||
Model: model,
|
||||
|
Loading…
Reference in New Issue
Block a user