mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-02 14:58:49 +01:00
🎨 支持应用内配置人工智能 https://github.com/siyuan-note/siyuan/issues/7714
This commit is contained in:
parent
cb1c20ea92
commit
bbbedac655
4 changed files with 24 additions and 68 deletions
|
|
@ -77,7 +77,7 @@ func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret str
|
|||
if cloud {
|
||||
gpt = &CloudGPT{}
|
||||
} else {
|
||||
gpt = &OpenAIGPT{c: util.NewOpenAIClient()}
|
||||
gpt = &OpenAIGPT{c: util.NewOpenAIClient(Conf.AI.OpenAI.APIKey, Conf.AI.OpenAI.APIProxy, Conf.AI.OpenAI.APIBaseURL)}
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
|
|
@ -99,7 +99,7 @@ func chatGPTContinueWrite(msg string, contextMsgs []string, cloud bool) (ret str
|
|||
}
|
||||
|
||||
func isOpenAIAPIEnabled() bool {
|
||||
if "" == util.OpenAIAPIKey {
|
||||
if "" == Conf.AI.OpenAI.APIKey {
|
||||
util.PushMsg(Conf.Language(193), 5000)
|
||||
return false
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ type OpenAIGPT struct {
|
|||
}
|
||||
|
||||
func (gpt *OpenAIGPT) chat(msg string, contextMsgs []string) (partRet string, stop bool, err error) {
|
||||
return util.ChatGPT(msg, contextMsgs, gpt.c)
|
||||
return util.ChatGPT(msg, contextMsgs, gpt.c, Conf.AI.OpenAI.APIMaxTokens, Conf.AI.OpenAI.APITimeout)
|
||||
}
|
||||
|
||||
type CloudGPT struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue