mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 17:49:55 +00:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 278a817709 | |||
| fbf8e0408c | |||
| 1428e0bd5c | |||
| 9365e0833c | |||
| 57f51c5d0e | |||
| d0b53607c4 | |||
| 814ca9ba7f | |||
| 49a41c597a | |||
| 93f60c4e36 | |||
| 8cdb31d96d | |||
| a20fb846f0 | |||
| 90cfc6fb0c | |||
| 114146f4d2 | |||
| b4b902cb4c | |||
| 7933abe62d | |||
| d213de7a95 | |||
| 81b01d74ae | |||
| 1fbdd237a3 | |||
| 2d82b91090 | |||
| 5d3829d1fe | |||
| edadedcf80 | |||
| 5ff6d4e072 | |||
| ffc2d6ba0a | |||
| dab94df7d2 | |||
| 281f7f877a |
@@ -1,32 +0,0 @@
|
|||||||
# Goreleaser configuration version 2
|
|
||||||
version: 2
|
|
||||||
|
|
||||||
builds:
|
|
||||||
- id: lcg
|
|
||||||
binary: "lcg_{{ .Version }}"
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
- windows
|
|
||||||
- darwin
|
|
||||||
goarch:
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
env:
|
|
||||||
- CGO_ENABLED=0
|
|
||||||
ldflags:
|
|
||||||
- -s -w
|
|
||||||
- -X main.version={{.Version}}
|
|
||||||
- -X main.commit={{.Commit}}
|
|
||||||
- -X main.date={{.Date}}
|
|
||||||
main: .
|
|
||||||
dir: .
|
|
||||||
|
|
||||||
archives:
|
|
||||||
- id: lcg
|
|
||||||
ids:
|
|
||||||
- lcg
|
|
||||||
formats:
|
|
||||||
- binary
|
|
||||||
name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
|
|
||||||
files:
|
|
||||||
- "lcg_{{ .Version }}"
|
|
||||||
@@ -1 +1 @@
|
|||||||
v.2.0.26
|
v.2.0.25
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ type Config struct {
|
|||||||
ResultHistory string
|
ResultHistory string
|
||||||
NoHistoryEnv string
|
NoHistoryEnv string
|
||||||
AllowExecution bool
|
AllowExecution bool
|
||||||
Think bool
|
|
||||||
Query string
|
Query string
|
||||||
MainFlags MainFlags
|
MainFlags MainFlags
|
||||||
Server ServerConfig
|
Server ServerConfig
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
v.2.0.26
|
v.2.0.25
|
||||||
|
|||||||
10
gpt/gpt.go
10
gpt/gpt.go
@@ -44,19 +44,11 @@ type Chat struct {
|
|||||||
|
|
||||||
type Gpt3Request struct {
|
type Gpt3Request struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Stream bool `json:"stream"`
|
Stream bool `json:"stream"`
|
||||||
Messages []Chat `json:"messages"`
|
Messages []Chat `json:"messages"`
|
||||||
Options Gpt3Options `json:"options"`
|
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 {
|
type Gpt3Options struct {
|
||||||
Temperature float64 `json:"temperature"`
|
Temperature float64 `json:"temperature"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,26 +200,12 @@ func (p *ProxyAPIProvider) Health() error {
|
|||||||
|
|
||||||
// Chat для OllamaProvider
|
// Chat для OllamaProvider
|
||||||
func (o *OllamaProvider) Chat(messages []Chat) (string, error) {
|
func (o *OllamaProvider) Chat(messages []Chat) (string, error) {
|
||||||
|
payload := Gpt3Request{
|
||||||
think := config.AppConfig.Think
|
|
||||||
|
|
||||||
var payload interface{}
|
|
||||||
if think {
|
|
||||||
payload = Gpt3Request{
|
|
||||||
Model: o.Model,
|
Model: o.Model,
|
||||||
Messages: messages,
|
Messages: messages,
|
||||||
Stream: false,
|
Stream: false,
|
||||||
Options: Gpt3Options{o.Temperature},
|
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)
|
jsonData, err := json.Marshal(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
namespace: lcg
|
namespace: lcg
|
||||||
data:
|
data:
|
||||||
# Основные настройки
|
# Основные настройки
|
||||||
LCG_VERSION: "v.2.0.26"
|
LCG_VERSION: "v.2.0.25"
|
||||||
LCG_BASE_PATH: "/lcg"
|
LCG_BASE_PATH: "/lcg"
|
||||||
LCG_SERVER_HOST: "0.0.0.0"
|
LCG_SERVER_HOST: "0.0.0.0"
|
||||||
LCG_SERVER_PORT: "8080"
|
LCG_SERVER_PORT: "8080"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ metadata:
|
|||||||
namespace: lcg
|
namespace: lcg
|
||||||
labels:
|
labels:
|
||||||
app: lcg
|
app: lcg
|
||||||
version: v.2.0.26
|
version: v.2.0.25
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
@@ -18,7 +18,7 @@ spec:
|
|||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: lcg
|
- name: lcg
|
||||||
image: kuznetcovay/lcg:v.2.0.26
|
image: kuznetcovay/lcg:v.2.0.25
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ resources:
|
|||||||
# Common labels
|
# Common labels
|
||||||
# commonLabels:
|
# commonLabels:
|
||||||
# app: lcg
|
# app: lcg
|
||||||
# version: v.2.0.26
|
# version: v.2.0.25
|
||||||
# managed-by: kustomize
|
# managed-by: kustomize
|
||||||
|
|
||||||
# Images
|
# Images
|
||||||
# images:
|
# images:
|
||||||
# - name: lcg
|
# - name: lcg
|
||||||
# newName: kuznetcovay/lcg
|
# newName: kuznetcovay/lcg
|
||||||
# newTag: v.2.0.26
|
# newTag: v.2.0.25
|
||||||
|
|||||||
18
main.go
18
main.go
@@ -109,7 +109,6 @@ lcg [опции] <описание команды>
|
|||||||
LCG_PROXY_URL URL прокси для proxy провайдера (по умолчанию: /api/v1/protected/sberchat/chat)
|
LCG_PROXY_URL URL прокси для proxy провайдера (по умолчанию: /api/v1/protected/sberchat/chat)
|
||||||
LCG_API_KEY_FILE Файл с API ключом (по умолчанию: .openai_api_key)
|
LCG_API_KEY_FILE Файл с API ключом (по умолчанию: .openai_api_key)
|
||||||
LCG_APP_NAME Название приложения (по умолчанию: Linux Command GPT)
|
LCG_APP_NAME Название приложения (по умолчанию: Linux Command GPT)
|
||||||
LCG_ALLOW_THINK только для ollama: разрешить модели отправлять свои размышления ("1" или "true" = разрешено, пусто = запрещено). Имеет смысл для моделей, которые поддерживают эти действия: qwen3, deepseek.
|
|
||||||
|
|
||||||
Настройки истории и выполнения:
|
Настройки истории и выполнения:
|
||||||
LCG_NO_HISTORY Отключить запись истории ("1" или "true" = отключено, пусто = включено)
|
LCG_NO_HISTORY Отключить запись истории ("1" или "true" = отключено, пусто = включено)
|
||||||
@@ -164,18 +163,12 @@ lcg [опции] <описание команды>
|
|||||||
Usage: "Disable writing/updating command history (overrides LCG_NO_HISTORY)",
|
Usage: "Disable writing/updating command history (overrides LCG_NO_HISTORY)",
|
||||||
Value: false,
|
Value: false,
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: "think",
|
|
||||||
Aliases: []string{"T"},
|
|
||||||
Usage: "Разрешить модели отправлять свои размышления",
|
|
||||||
Value: false,
|
|
||||||
},
|
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "query",
|
Name: "query",
|
||||||
Aliases: []string{"Q"},
|
Aliases: []string{"Q"},
|
||||||
Usage: "Query to send to the model",
|
Usage: "Query to send to the model",
|
||||||
DefaultText: "Привет! Порадуй меня случайной Linux командой ...",
|
DefaultText: "Hello? what day is it today?",
|
||||||
Value: "Привет! Порадуй меня случайной Linux командой ...",
|
Value: "Hello? what day is it today?",
|
||||||
},
|
},
|
||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "sys",
|
Name: "sys",
|
||||||
@@ -223,10 +216,7 @@ lcg [опции] <описание команды>
|
|||||||
if c.IsSet("model") {
|
if c.IsSet("model") {
|
||||||
config.AppConfig.Model = model
|
config.AppConfig.Model = model
|
||||||
}
|
}
|
||||||
config.AppConfig.Think = false
|
|
||||||
if c.IsSet("think") {
|
|
||||||
config.AppConfig.Think = c.Bool("think")
|
|
||||||
}
|
|
||||||
promptID := c.Int("prompt-id")
|
promptID := c.Int("prompt-id")
|
||||||
timeout := c.Int("timeout")
|
timeout := c.Int("timeout")
|
||||||
|
|
||||||
@@ -1028,7 +1018,7 @@ func printDebugInfo(file, system, commandInput string, timeout int) {
|
|||||||
fmt.Printf("📁 Файл: %s\n", file)
|
fmt.Printf("📁 Файл: %s\n", file)
|
||||||
fmt.Printf("🤖 Системный промпт: %s\n", system)
|
fmt.Printf("🤖 Системный промпт: %s\n", system)
|
||||||
fmt.Printf("💬 Запрос: %s\n", commandInput)
|
fmt.Printf("💬 Запрос: %s\n", commandInput)
|
||||||
fmt.Printf("⏱️ Таймаут: %d сек\n", timeout)
|
fmt.Printf("⏱️ Таймаут: %d сек\n", timeout)
|
||||||
fmt.Printf("🌐 Провайдер: %s\n", config.AppConfig.ProviderType)
|
fmt.Printf("🌐 Провайдер: %s\n", config.AppConfig.ProviderType)
|
||||||
fmt.Printf("🏠 Хост: %s\n", config.AppConfig.Host)
|
fmt.Printf("🏠 Хост: %s\n", config.AppConfig.Host)
|
||||||
fmt.Printf("🧠 Модель: %s\n", config.AppConfig.Model)
|
fmt.Printf("🧠 Модель: %s\n", config.AppConfig.Model)
|
||||||
|
|||||||
Reference in New Issue
Block a user