feat: 支持gpt4.0的自定义 (#93)

This commit is contained in:
二丫讲梵
2023-03-15 18:10:04 +08:00
committed by GitHub
parent 4ff2f39c42
commit 5a796061da
5 changed files with 11 additions and 8 deletions

View File

@@ -157,9 +157,13 @@ func (c *ChatGPT) ChatWithContext(question string) (answer string, err error) {
return "", OverMaxTextLength
}
if public.Config.Model == openai.GPT3Dot5Turbo0301 || public.Config.Model == openai.GPT3Dot5Turbo {
model := public.Config.Model
if model == openai.GPT3Dot5Turbo0301 ||
model == openai.GPT3Dot5Turbo ||
model == openai.GPT4 || model == openai.GPT40314 ||
model == openai.GPT432K || model == openai.GPT432K0314 {
req := openai.ChatCompletionRequest{
Model: public.Config.Model,
Model: model,
Messages: []openai.ChatCompletionMessage{
{
Role: "user",
@@ -183,7 +187,7 @@ func (c *ChatGPT) ChatWithContext(question string) (answer string, err error) {
return resp.Choices[0].Message.Content, nil
} else {
req := openai.CompletionRequest{
Model: public.Config.Model,
Model: model,
MaxTokens: c.maxAnswerLen,
Prompt: prompt,
Temperature: 0.9,