This commit is contained in:
Liang Ding 2023-03-21 19:46:55 +08:00
parent cb1c20ea92
commit bbbedac655
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
4 changed files with 24 additions and 68 deletions

View file

@ -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 {