Исправления в ветке main

This commit is contained in:
2025-11-10 10:23:38 +06:00
parent c83fed5591
commit 0820e859a6
10 changed files with 79 additions and 14 deletions

View File

@@ -44,11 +44,19 @@ type Chat struct {
type Gpt3Request struct {
Model string `json:"model"`
Stream bool `json:"stream"`
Stream bool `json:"stream"`
Messages []Chat `json:"messages"`
Options Gpt3Options `json:"options"`
}
type Gpt3ThinkRequest struct {
Model string `json:"model"`
Stream bool `json:"stream"`
Think bool `json:"think"`
Messages []Chat `json:"messages"`
Options Gpt3Options `json:"options"`
}
type Gpt3Options struct {
Temperature float64 `json:"temperature"`
}

View File

@@ -200,12 +200,26 @@ func (p *ProxyAPIProvider) Health() error {
// Chat для OllamaProvider
func (o *OllamaProvider) Chat(messages []Chat) (string, error) {
payload := Gpt3Request{
think := config.AppConfig.Think
var payload interface{}
if think {
payload = Gpt3Request{
Model: o.Model,
Messages: messages,
Stream: false,
Stream: false,
Options: Gpt3Options{o.Temperature},
}
} else {
payload = Gpt3ThinkRequest{
Model: o.Model,
Messages: messages,
Stream: false,
Think: false,
Options: Gpt3Options{o.Temperature},
}
}
jsonData, err := json.Marshal(payload)
if err != nil {