fix assistant widget configuration
This commit is contained in:
1 parent
8d06201b41
commit
1f60b4b4be
16 files changed
+696
-11
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] };
|
||||
};
|
||||
Reference in new issue
Block a user