diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-27 11:10:03 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-27 11:10:03 +0300 |
| commit | af2684664725f3e5da79d1d53e714b48e430e6fb (patch) | |
| tree | 6394800509b9c61efcab724cf95b5ab96fc0dd04 /tools.go | |
| parent | 10b2816af15b592aeed73ce1d7fd261f397a4761 (diff) | |
Enha: summary agent
Diffstat (limited to 'tools.go')
| -rw-r--r-- | tools.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -129,6 +129,7 @@ After that you are free to respond to the user. ` webSearchSysPrompt = `Summarize the web search results, extracting key information and presenting a concise answer. Provide sources and URLs where relevant.` 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{ SysPrompt: basicSysMsg, FirstMsg: defaultFirstMsg, @@ -178,6 +179,8 @@ func registerWebAgents() { agent.Register("websearch", agent.NewWebAgentB(client, webSearchSysPrompt)) // Register read_url agent agent.Register("read_url", agent.NewWebAgentB(client, readURLSysPrompt)) + // Register summarize_chat agent + agent.Register("summarize_chat", agent.NewWebAgentB(client, summarySysPrompt)) }) } @@ -864,6 +867,15 @@ func isCommandAllowed(command string) bool { return allowedCommands[command] } +func summarizeChat(args map[string]string) []byte { + if len(chatBody.Messages) == 0 { + return []byte("No chat history to summarize.") + } + // Format chat history for the agent + chatText := chatToText(true) // include system and tool messages + return []byte(chatText) +} + type fnSig func(map[string]string) []byte var fnMap = map[string]fnSig{ @@ -884,6 +896,7 @@ var fnMap = map[string]fnSig{ "todo_read": todoRead, "todo_update": todoUpdate, "todo_delete": todoDelete, + "summarize_chat": summarizeChat, } // callToolWithAgent calls the tool and applies any registered agent. |
