From 128b65d770b86d5b6a493b7333e867e34fb91f77 Mon Sep 17 00:00:00 2001 From: wizardchen Date: Mon, 20 Apr 2026 20:48:29 +0800 Subject: [PATCH] refactor: Update wiki page output format for improved link handling - Modified the XML output structure in the wikiReadPageTool to replace title and slug elements with a unified link format, enhancing clarity and consistency in the representation of wiki pages. - Adjusted the wikiSearchTool to align with the new output format, ensuring that search results maintain the same structure for better integration and usability. These changes streamline the output format for wiki pages, contributing to a more coherent and user-friendly experience when accessing wiki content. --- internal/agent/tools/wiki_tools.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/internal/agent/tools/wiki_tools.go b/internal/agent/tools/wiki_tools.go index 5c234d65..8f071a1c 100644 --- a/internal/agent/tools/wiki_tools.go +++ b/internal/agent/tools/wiki_tools.go @@ -138,8 +138,7 @@ func (t *wikiReadPageTool) Execute(ctx context.Context, args json.RawMessage) (* return fmt.Sprintf(` %s -%s -%s +[[%s|%s]] %s %s @@ -158,7 +157,7 @@ func (t *wikiReadPageTool) Execute(ctx context.Context, args json.RawMessage) (* `, kbID, - page.Title, page.Slug, page.PageType, + page.Slug, page.Title, page.PageType, strings.Join(page.Aliases, ", "), strings.Join(outLinksDesc, ", "), strings.Join(inLinksDesc, ", "), @@ -361,8 +360,8 @@ func (t *wikiSearchTool) Execute(ctx context.Context, args json.RawMessage) (*ty summary = "(summary omitted, already seen in previous search)" } fmt.Fprintf(&sb, - "\n%s\n%s\n%s\n[[%s|%s]]\n%s%s\n%s%s\n\n", - h.kbID, p.Title, p.Slug, p.Slug, p.Title, p.PageType, aliasesTag, summary, snippetTag, + "\n%s\n[[%s|%s]]\n%s%s\n%s%s\n\n", + h.kbID, p.Slug, p.Title, p.PageType, aliasesTag, summary, snippetTag, ) } sb.WriteString("")