feat: the model's short name up to 9 characters, the chat 408px wide so nine of the widest letters fit

This commit is contained in:
redtea committed 2026-10-17 15:07:49 +03:00
1 parent 6a17f40042
commit 6c1da79b4a
5 files changed
+10 -10

No files matched your search

+3 -3
View File
@@ -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 7 characters, on the button of the model in use), the
// shows (Short, up to 9 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) > 7 {
c.Short = strings.TrimSpace(string(r[:7]))
if r := []rune(strings.TrimSpace(c.Short)); len(r) > 9 {
c.Short = strings.TrimSpace(string(r[:9]))
} else {
c.Short = string(r)
}