mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 01:29:55 +00:00
Исправления в ветке main
This commit is contained in:
10
gpt/gpt.go
10
gpt/gpt.go
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user