This commit is contained in:
pablodanswer
2025-01-26 13:51:17 -08:00
committed by Chris Weaver
parent 519ec20d05
commit b2ce848b53
2 changed files with 13 additions and 23 deletions

View File

@@ -220,6 +220,13 @@ class InternetSearchTool(Tool):
) )
results = response.json() results = response.json()
# If no hits, Bing does not include the webPages key
search_results = (
results["webPages"]["value"][: self.num_results]
if "webPages" in results
else []
)
return InternetSearchResponse( return InternetSearchResponse(
revised_query=query, revised_query=query,
internet_results=[ internet_results=[
@@ -228,7 +235,7 @@ class InternetSearchTool(Tool):
link=result["url"], link=result["url"],
snippet=result["snippet"], snippet=result["snippet"],
) )
for result in results["webPages"]["value"][: self.num_results] for result in search_results
], ],
) )

View File

@@ -910,28 +910,11 @@ export function AssistantEditor({
{internetSearchTool && ( {internetSearchTool && (
<> <>
<div className="flex items-center content-start mb-2"> <BooleanFormField
<Checkbox
size="sm"
id={`enabled_tools_map.${internetSearchTool.id}`}
checked={
values.enabled_tools_map[internetSearchTool.id]
}
onCheckedChange={() => {
toggleToolInValues(internetSearchTool.id);
}}
name={`enabled_tools_map.${internetSearchTool.id}`} name={`enabled_tools_map.${internetSearchTool.id}`}
label={internetSearchTool.display_name}
subtext="Access real-time information and search the web for up-to-date results"
/> />
<div className="flex flex-col ml-2">
<span className="text-sm">
{internetSearchTool.display_name}
</span>
<span className="text-xs text-subtle">
Access real-time information and search the web
for up-to-date results
</span>
</div>
</div>
</> </>
)} )}