chore: update something
Browse files
app.py
CHANGED
|
@@ -333,9 +333,7 @@ def search_with_wikipedia(
|
|
| 333 |
all_results = []
|
| 334 |
try:
|
| 335 |
wikipedia.set_lang(language)
|
| 336 |
-
|
| 337 |
-
content = page.content[:8192]
|
| 338 |
-
all_results.append(content)
|
| 339 |
except Exception as e:
|
| 340 |
pass
|
| 341 |
return all_results
|
|
@@ -490,6 +488,9 @@ def generate(
|
|
| 490 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 491 |
search_type = scheduled_tools_runs["arguments"]["type"]
|
| 492 |
language = scheduled_tools_runs["arguments"]["language"]
|
|
|
|
|
|
|
|
|
|
| 493 |
if search_type == "wikipedia":
|
| 494 |
gr.Info(
|
| 495 |
"Searching for information on the Wikipedia.",
|
|
@@ -504,10 +505,14 @@ def generate(
|
|
| 504 |
"Searching for information on the Google.", duration=5, visible=True
|
| 505 |
)
|
| 506 |
document_references.extend(
|
| 507 |
-
search_with_google(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 508 |
)
|
| 509 |
print(
|
| 510 |
-
"
|
| 511 |
)
|
| 512 |
|
| 513 |
apply_tools = (
|
|
|
|
| 333 |
all_results = []
|
| 334 |
try:
|
| 335 |
wikipedia.set_lang(language)
|
| 336 |
+
all_results.append(wikipedia.summary(query))
|
|
|
|
|
|
|
| 337 |
except Exception as e:
|
| 338 |
pass
|
| 339 |
return all_results
|
|
|
|
| 488 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 489 |
search_type = scheduled_tools_runs["arguments"]["type"]
|
| 490 |
language = scheduled_tools_runs["arguments"]["language"]
|
| 491 |
+
print(
|
| 492 |
+
"scheduled_tools_runs:", scheduled_tools_runs
|
| 493 |
+
)
|
| 494 |
if search_type == "wikipedia":
|
| 495 |
gr.Info(
|
| 496 |
"Searching for information on the Wikipedia.",
|
|
|
|
| 505 |
"Searching for information on the Google.", duration=5, visible=True
|
| 506 |
)
|
| 507 |
document_references.extend(
|
| 508 |
+
search_with_google(
|
| 509 |
+
query=keyword,
|
| 510 |
+
language=language,
|
| 511 |
+
num_results=2 if search_type == "wikipedia" else 3,
|
| 512 |
+
)
|
| 513 |
)
|
| 514 |
print(
|
| 515 |
+
"document_references:", document_references
|
| 516 |
)
|
| 517 |
|
| 518 |
apply_tools = (
|