feat: the model's short name up to 12 characters
This commit is contained in:
1 parent
6c1da79b4a
commit
37ef886503
5 files changed
+9
-9
No files matched your search
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user