From 1db4f1f3bdfc4b4dd7a19e8261b4b905ed843e8b Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Sat, 28 Feb 2026 13:38:54 +0200 Subject: [PATCH] fix(MAT-64): Improve web search formatting and require source links - Format search results as markdown links: [Title](URL) - System prompt now requires a "Quellen:/Sources:" section with clickable links whenever web_search is used Co-Authored-By: Claude Opus 4.6 --- bot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bot.py b/bot.py index 0c8837b..a639ccb 100644 --- a/bot.py +++ b/bot.py @@ -96,6 +96,7 @@ IMPORTANT RULES — FOLLOW THESE STRICTLY: - You can read and analyze PDF documents that users send. Summarize content and answer questions about them. - You can generate images when asked — use the generate_image tool for any image creation, drawing, or illustration requests. - You can search the web using the web_search tool. Use it when users ask about current events, facts, or anything that needs up-to-date information. +- When you use web_search, you MUST include a "Quellen:" (or "Sources:" in English) section at the end of your response with clickable markdown links to all sources you used, formatted as: [Title](URL). Never omit source links. - You can search Confluence and Jira using tools. When users ask about documentation, wiki pages, tickets, or tasks, use the appropriate tool. Use confluence_recent_pages FIRST to show recently edited pages before searching. - When creating Jira issues, always confirm the project key and summary with the user before creating. - If a user's Atlassian account is not connected, tell them to connect it at matrixhost.eu/settings and provide the link. @@ -1959,7 +1960,10 @@ class Bot: return "No results found." lines = [] for r in results[:count]: - lines.append(f"- {r.get('title', '')}: {r.get('description', '')} ({r.get('url', '')})") + title = r.get("title", "") + desc = r.get("description", "") + url = r.get("url", "") + lines.append(f"- [{title}]({url}): {desc}") return "\n".join(lines) except Exception as exc: logger.warning("Brave search error: %s", exc)