From 0e5d37666f92bc75f12f118fc77a7e4af4a5924b Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 3 Mar 2026 11:46:03 +0300 Subject: Enha: id for card map --- tools.go | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tools.go') diff --git a/tools.go b/tools.go index 3974a34..dfa8d7b 100644 --- a/tools.go +++ b/tools.go @@ -162,13 +162,15 @@ After that you are free to respond to the user. readURLSysPrompt = `Extract and summarize the content from the webpage. Provide key information, main points, and any relevant details.` summarySysPrompt = `Please provide a concise summary of the following conversation. Focus on key points, decisions, and actions. Provide only the summary, no additional commentary.` basicCard = &models.CharCard{ + ID: models.ComputeCardID("assistant", "basic_sys"), SysPrompt: basicSysMsg, FirstMsg: defaultFirstMsg, - Role: "", - FilePath: "", + Role: "assistant", + FilePath: "basic_sys", } - sysMap = map[string]*models.CharCard{"basic_sys": basicCard} - sysLabels = []string{"basic_sys"} + sysMap = map[string]*models.CharCard{} + roleToID = map[string]string{} + sysLabels = []string{"assistant"} webAgentClient *agent.AgentClient webAgentClientOnce sync.Once @@ -206,6 +208,8 @@ var ( ) func init() { + sysMap[basicCard.ID] = basicCard + roleToID["assistant"] = basicCard.ID sa, err := searcher.NewWebSurfer(searcher.SearcherTypeScraper, "") if err != nil { panic("failed to init seachagent; error: " + err.Error()) @@ -218,6 +222,14 @@ func init() { registerWindowTools() } +func GetCardByRole(role string) *models.CharCard { + cardID, ok := roleToID[role] + if !ok { + return nil + } + return sysMap[cardID] +} + func checkWindowTools() { xdotoolPath, _ = exec.LookPath("xdotool") maimPath, _ = exec.LookPath("maim") -- cgit v1.2.3