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