mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 AI supports configuration randomness and context number https://github.com/siyuan-note/siyuan/issues/10660
This commit is contained in:
parent
97e3ff656d
commit
a7e1e3abac
12 changed files with 66 additions and 16 deletions
|
|
@ -27,7 +27,7 @@ import (
|
|||
"github.com/siyuan-note/logging"
|
||||
)
|
||||
|
||||
func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, maxTokens, timeout int) (ret string, stop bool, err error) {
|
||||
func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, maxTokens int, temperature float64, timeout int) (ret string, stop bool, err error) {
|
||||
var reqMsgs []openai.ChatCompletionMessage
|
||||
|
||||
for _, ctxMsg := range contextMsgs {
|
||||
|
|
@ -42,9 +42,10 @@ func ChatGPT(msg string, contextMsgs []string, c *openai.Client, model string, m
|
|||
})
|
||||
|
||||
req := openai.ChatCompletionRequest{
|
||||
Model: model,
|
||||
MaxTokens: maxTokens,
|
||||
Messages: reqMsgs,
|
||||
Model: model,
|
||||
MaxTokens: maxTokens,
|
||||
Temperature: float32(temperature),
|
||||
Messages: reqMsgs,
|
||||
}
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(timeout)*time.Second)
|
||||
defer cancel()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue