From 3ae71d81c426d5526827da1df3d930b991d0d62f Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 16 Feb 2025 13:43:42 +0300 Subject: Fix: card edit --- tables.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'tables.go') diff --git a/tables.go b/tables.go index 41ea61b..e281dd2 100644 --- a/tables.go +++ b/tables.go @@ -112,15 +112,23 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { if err := notifyUser("error", "no such card: "+agentName); err != nil { logger.Warn("failed ot notify", "error", err) } + return + } + if chatBody.Messages[0].Role != "system" || chatBody.Messages[1].Role != agentName { + if err := notifyUser("error", "unexpected chat structure; card: "+agentName); err != nil { + logger.Warn("failed ot notify", "error", err) + } + return } + // change sys_prompt + first msg + cc.SysPrompt = chatBody.Messages[0].Content + cc.FirstMsg = chatBody.Messages[1].Content if err := pngmeta.WriteToPng(cc.ToSpec(cfg.UserRole), cc.FilePath, cc.FilePath); err != nil { logger.Error("failed to write charcard", "error", err) } - // pages.RemovePage(historyPage) return default: - // pages.RemovePage(historyPage) return } }) -- cgit v1.2.3