mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-20 04:37:09 +02:00
add fix
This commit is contained in:
committed by
Chris Weaver
parent
519ec20d05
commit
b2ce848b53
@@ -220,6 +220,13 @@ class InternetSearchTool(Tool):
|
||||
)
|
||||
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(
|
||||
revised_query=query,
|
||||
internet_results=[
|
||||
@@ -228,7 +235,7 @@ class InternetSearchTool(Tool):
|
||||
link=result["url"],
|
||||
snippet=result["snippet"],
|
||||
)
|
||||
for result in results["webPages"]["value"][: self.num_results]
|
||||
for result in search_results
|
||||
],
|
||||
)
|
||||
|
||||
|
@@ -910,28 +910,11 @@ export function AssistantEditor({
|
||||
|
||||
{internetSearchTool && (
|
||||
<>
|
||||
<div className="flex items-center content-start mb-2">
|
||||
<Checkbox
|
||||
size="sm"
|
||||
id={`enabled_tools_map.${internetSearchTool.id}`}
|
||||
checked={
|
||||
values.enabled_tools_map[internetSearchTool.id]
|
||||
}
|
||||
onCheckedChange={() => {
|
||||
toggleToolInValues(internetSearchTool.id);
|
||||
}}
|
||||
<BooleanFormField
|
||||
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>
|
||||
</>
|
||||
)}
|
||||
|
||||
|
Reference in New Issue
Block a user