Skip to content

Commit 0bd9dd3

Browse files
authored
fix(assistants): remove websearch from assistant tool options, add websearch in backend logic (#1465)
closes #1464
1 parent 423902c commit 0bd9dd3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/lib/server/textGeneration/tools.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ export async function getTools(
3232
if (assistant) {
3333
if (assistant?.tools?.length) {
3434
preferences = assistant.tools;
35-
} else if (assistantHasWebSearch(assistant)) {
36-
return [directlyAnswer, websearch];
35+
36+
if (assistantHasWebSearch(assistant)) {
37+
preferences.push(websearch._id.toString());
38+
}
3739
} else {
40+
if (assistantHasWebSearch(assistant)) {
41+
return [websearch, directlyAnswer];
42+
}
3843
return [directlyAnswer];
3944
}
4045
}

src/routes/api/tools/search/+server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export async function GET({ url, locals }) {
3333

3434
const matchingConfigTools = toolFromConfigs
3535
.filter((tool) => !tool?.isHidden)
36+
.filter((tool) => tool.name !== "websearch") // filter out websearch tool from config tools since its added separately
3637
.filter((tool) => {
3738
if (queryTokens) {
3839
return generateSearchTokens(tool.displayName).some((token) =>

0 commit comments

Comments
 (0)