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 <noreply@anthropic.com>
This commit is contained in:
Christian Gick
2026-02-28 13:38:54 +02:00
parent 2826455036
commit 1db4f1f3bd

6
bot.py
View File

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