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:
+7
-1
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user