summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-02-09 10:11:56 +0300
committerGrail Finder <wohilas@gmail.com>2026-02-09 10:11:56 +0300
commit67733ad8dd0151f700e9e43748fb1700101fe651 (patch)
tree806ff45e7cf9b952998a5f48a1073bfd9cce11f7
parent5e7ddea6827765ac56155577cf7dcc809fe1128c (diff)
Enha: add bool to apply card
-rw-r--r--bot.go8
-rw-r--r--tables.go2
2 files changed, 5 insertions, 5 deletions
diff --git a/bot.go b/bot.go
index 7209679..2869fa0 100644
--- a/bot.go
+++ b/bot.go
@@ -1150,16 +1150,16 @@ func addNewChat(chatName string) {
activeChatName = chat.Name
}
-func applyCharCard(cc *models.CharCard) {
+func applyCharCard(cc *models.CharCard, loadHistory bool) {
cfg.AssistantRole = cc.Role
history, err := loadAgentsLastChat(cfg.AssistantRole)
- if err != nil {
+ if err != nil || !loadHistory {
// too much action for err != nil; loadAgentsLastChat needs to be split up
- logger.Warn("failed to load last agent chat;", "agent", cc.Role, "err", err)
history = []models.RoleMsg{
{Role: "system", Content: cc.SysPrompt},
{Role: cfg.AssistantRole, Content: cc.FirstMsg},
}
+ logger.Warn("failed to load last agent chat;", "agent", cc.Role, "err", err, "new_history", history)
addNewChat("")
}
chatBody.Messages = history
@@ -1170,7 +1170,7 @@ func charToStart(agentName string) bool {
if !ok {
return false
}
- applyCharCard(cc)
+ applyCharCard(cc, true)
return true
}
diff --git a/tables.go b/tables.go
index ee2b145..740b7c8 100644
--- a/tables.go
+++ b/tables.go
@@ -206,7 +206,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table {
}
// Update sysMap with fresh card data
sysMap[agentName] = newCard
- applyCharCard(newCard)
+ applyCharCard(newCard, false)
startNewChat()
pages.RemovePage(historyPage)
return