summaryrefslogtreecommitdiff
path: root/tools.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2026-03-03 11:46:03 +0300
committerGrail Finder <wohilas@gmail.com>2026-03-03 11:46:03 +0300
commit0e5d37666f92bc75f12f118fc77a7e4af4a5924b (patch)
tree967b9de608288a3cfbd40aaf284b6bd7b640a4b9 /tools.go
parent093103bdd7cd02e10f2339e7beeb71375fb16256 (diff)
Enha: id for card map
Diffstat (limited to 'tools.go')
-rw-r--r--tools.go20
1 files changed, 16 insertions, 4 deletions
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")