From 5f780287aecedf08f94b6a1e0ae2a8822683a3fc Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 10 Dec 2024 17:55:10 +0300 Subject: Fix: display and upsert correct roles and icons --- models/models.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'models/models.go') diff --git a/models/models.go b/models/models.go index 82ff63d..2c5c99c 100644 --- a/models/models.go +++ b/models/models.go @@ -1,6 +1,7 @@ package models import ( + "elefant/config" "fmt" "strings" ) @@ -55,21 +56,21 @@ type RoleMsg struct { Content string `json:"content"` } -func (m RoleMsg) ToText(i int) string { +func (m RoleMsg) ToText(i int, cfg *config.Config) string { icon := "" switch m.Role { case "assistant": - icon = fmt.Sprintf("(%d) <🤖>: ", i) + icon = fmt.Sprintf("(%d) %s", i, cfg.AssistantIcon) case "user": - icon = fmt.Sprintf("(%d) : ", i) + icon = fmt.Sprintf("(%d) %s", i, cfg.UserIcon) case "system": icon = fmt.Sprintf("(%d) : ", i) case "tool": - icon = fmt.Sprintf("(%d) : ", i) + icon = fmt.Sprintf("(%d) %s", i, cfg.ToolIcon) default: icon = fmt.Sprintf("(%d) <%s>: ", i, m.Role) } - textMsg := fmt.Sprintf("[-:-:u]%s[-:-:-]\n%s\n", icon, m.Content) + textMsg := fmt.Sprintf("[-:-:b]%s[-:-:-]\n%s\n", icon, m.Content) return strings.ReplaceAll(textMsg, "\n\n", "\n") } -- cgit v1.2.3