fix add missing max_token in request query

This commit is contained in:
nopeless
2024-03-18 20:23:41 -05:00
parent 6326ff0052
commit 5de0bcca6b
2 changed files with 5 additions and 2 deletions

View File

@@ -4,13 +4,14 @@ import (
"encoding/json"
"errors"
"fmt"
"strings"
"unicode/utf8"
"github.com/kardolus/chatgpt-cli/config"
"github.com/kardolus/chatgpt-cli/configmanager"
"github.com/kardolus/chatgpt-cli/history"
"github.com/kardolus/chatgpt-cli/http"
"github.com/kardolus/chatgpt-cli/types"
"strings"
"unicode/utf8"
)
const (
@@ -163,6 +164,7 @@ func (c *Client) createBody(stream bool) ([]byte, error) {
body := types.CompletionsRequest{
Messages: c.History,
Model: c.Config.Model,
MaxTokens: c.Config.MaxTokens,
Temperature: c.Config.Temperature,
TopP: c.Config.TopP,
FrequencyPenalty: c.Config.FrequencyPenalty,

View File

@@ -5,6 +5,7 @@ type CompletionsRequest struct {
Temperature float64 `json:"temperature"`
TopP float64 `json:"top_p"`
FrequencyPenalty float64 `json:"frequency_penalty"`
MaxTokens int `json:"max_tokens"`
PresencePenalty float64 `json:"presence_penalty"`
Messages []Message `json:"messages"`
Stream bool `json:"stream"`