Enha: id for card map

This commit is contained in:
Grail Finder
2026-03-03 11:46:03 +03:00
parent 093103bdd7
commit 0e5d37666f
6 changed files with 57 additions and 38 deletions

View File

@@ -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")