Fix: new chat from json

This commit is contained in:
Grail Finder
2025-07-20 15:57:01 +03:00
parent e4b8a89f25
commit 6c0a290cec
2 changed files with 11 additions and 6 deletions

View File

@@ -144,13 +144,18 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table {
return
}
// Reload card from disk
newCard := &models.CharCard{}
newCard, err := pngmeta.ReadCard(cc.FilePath, cfg.UserRole)
if err != nil {
logger.Error("failed to reload charcard", "path", cc.FilePath, "error", err)
if err := notifyUser("error", "failed to reload card: "+cc.FilePath); err != nil {
logger.Warn("failed to notify", "error", err)
newCard, err = pngmeta.ReadCardJson(cc.FilePath)
if err != nil {
logger.Error("failed to reload charcard", "path", cc.FilePath, "error", err)
if err := notifyUser("error", "failed to reload card: "+cc.FilePath); err != nil {
logger.Warn("failed to notify", "error", err)
}
return
}
return
}
// Update sysMap with fresh card data
sysMap[agentName] = newCard