diff --git a/README.md b/README.md index 355cf18..21c9649 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ показать или записать файл - всё с правами пользователя. Плашка «Агент» - делает шаги сам, спрашивая перед каждой командой и записью; «Думать» - сначала рассуждает (свёрнуто над ответом). Модели задаёт администратор в «Настройки › ИИ-ассистент»: их может быть несколько, у каждой своё - название в чате (и короткое, до 9 символов, - для кнопки выбора), тип - Gradio (по умолчанию - прокси к Qwen Omni), OpenAI-совместимый API или Anthropic, + название в чате (и короткое, до 12 символов, - для кнопки выбора), тип - Gradio (по умолчанию - прокси к Qwen Omni), OpenAI-совместимый API или Anthropic, адрес, модель и ключ (хранится на сервере, в браузер не уходит). Если моделей несколько, в чате рядом с плашками появляется выбор, первая - по умолчанию; выбор запоминается за пользователем. В «Аккаунт › Вид» можно показывать выбор всегда. diff --git a/internal/server/ai.go b/internal/server/ai.go index 93a116d..0d7dc32 100644 --- a/internal/server/ai.go +++ b/internal/server/ai.go @@ -44,7 +44,7 @@ const ( func aiUserKey(id int64) string { return "ai_user_" + strconv.FormatInt(id, 10) } // aiConfig is one model the assistant can ask: its id and the names the chat -// shows (Short, up to 9 characters, on the button of the model in use), the +// shows (Short, up to 12 characters, on the button of the model in use), the // kind of API, its address, model and key. type aiConfig struct { ID string `json:"id"` @@ -77,8 +77,8 @@ func (c aiConfig) tidy() aiConfig { c.Type = "gradio" } c.Name, c.Model, c.Key = strings.TrimSpace(c.Name), strings.TrimSpace(c.Model), strings.TrimSpace(c.Key) - if r := []rune(strings.TrimSpace(c.Short)); len(r) > 9 { - c.Short = strings.TrimSpace(string(r[:9])) + if r := []rune(strings.TrimSpace(c.Short)); len(r) > 12 { + c.Short = strings.TrimSpace(string(r[:12])) } else { c.Short = string(r) } diff --git a/internal/server/aimodels_test.go b/internal/server/aimodels_test.go index 12027e8..a34dd83 100644 --- a/internal/server/aimodels_test.go +++ b/internal/server/aimodels_test.go @@ -60,11 +60,11 @@ func TestAIModelsSaveAndList(t *testing.T) { {"", "", "", "", "", "", ""}, // an empty card is dropped }) ms := s.aiModels() - if len(ms) != 2 || ms[0].Name != "Qwen" || ms[1].Name != "Claude" || ms[1].Key != "secret-key" || ms[0].ID == "" || ms[0].ID == ms[1].ID || ms[1].Short != "Сонет 4.5" { + if len(ms) != 2 || ms[0].Name != "Qwen" || ms[1].Name != "Claude" || ms[1].Key != "secret-key" || ms[0].ID == "" || ms[0].ID == ms[1].ID || ms[1].Short != "Сонет 4.5 дл" { t.Fatalf("models: %+v", ms) } body := get(t, s, c, "/api/panel/ai").Body.String() - if strings.Contains(body, "secret-key") || !strings.Contains(body, `"name":"Claude"`) || !strings.Contains(body, `"short":"Сонет 4.5"`) || !strings.Contains(body, ms[1].ID) { + if strings.Contains(body, "secret-key") || !strings.Contains(body, `"name":"Claude"`) || !strings.Contains(body, `"short":"Сонет 4.5 дл"`) || !strings.Contains(body, ms[1].ID) { t.Fatalf("state: %s", body) } // Saved again with its id, a model keeps it. diff --git a/internal/server/web/static/app.css b/internal/server/web/static/app.css index 683c5aa..df77371 100644 --- a/internal/server/web/static/app.css +++ b/internal/server/web/static/app.css @@ -963,7 +963,7 @@ dialog.uidlg { width:fit-content; min-width:min(300px, 92vw); max-width:min(560p pointed at; the list opens upwards, as a small card. */ .ai-mpick { position:relative; margin-left:auto; min-width:0; } .ai-mpick[hidden] { display:none; } -/* A short name (9 characters at most) is shown whole. */ +/* A short name (12 characters at most) is shown whole. */ .ai-mpick.short { flex-shrink:0; } .ai-mbtn { display:inline-flex; align-items:center; gap:3px; max-width:100%; height:28px; padding:0 5px 0 7px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:12.5px; font-weight:500; transition:background-color .15s, color .15s; } diff --git a/internal/server/web/templates/settings.html b/internal/server/web/templates/settings.html index 0ddcfde..7d25187 100644 --- a/internal/server/web/templates/settings.html +++ b/internal/server/web/templates/settings.html @@ -157,7 +157,7 @@ {{range .AIModels}}