fix assistant widget configuration

This commit is contained in:
ajnart committed 2026-08-03 16:43:08 +02:00
1 parent bd3e4c33f3
commit 35673f113e
20 files changed
+762 -12

No files matched your search

@@ -0,0 +1,21 @@
const openRouterWebSearchTool = {
type: "openrouter:web_search",
parameters: { max_results: 5 },
} as const;
export const withOpenRouterWebSearch = (body: Record<string, unknown>) => {
const tools = Array.isArray(body.tools) ? body.tools : [];
if (
tools.some(
(candidate) =>
typeof candidate === "object" &&
candidate !== null &&
"type" in candidate &&
candidate.type === openRouterWebSearchTool.type,
)
) {
return body;
}
return { ...body, tools: [...tools, openRouterWebSearchTool] };
};