test: cover the Ollama web tools, mark trimmed snippets, new icon (#2)

This commit was merged in pull request #2.
This commit is contained in:
2026-10-03 20:36:38 +00:00
parent 8b507e7953
commit 7afafdaf32
3 changed files with 253 additions and 1 deletions
+7 -1
View File
@@ -208,7 +208,13 @@ async function runWebSearch(args: Record<string, unknown>, context: ToolContext)
const rendered = results
.map((result, index) => {
const snippet = result.content.replace(/\s+/g, " ").trim().slice(0, MAX_SNIPPET_CHARS);
const collapsed = result.content.replace(/\s+/g, " ").trim();
// Mark the cut rather than silently dropping the tail: the model should
// know a snippet was trimmed, and this matches what web_fetch does.
const snippet =
collapsed.length > MAX_SNIPPET_CHARS
? `${collapsed.slice(0, MAX_SNIPPET_CHARS)} …[truncated]`
: collapsed;
return `${index + 1}. ${result.title}\n ${result.url}\n ${snippet}`;
})
.join("\n\n");