chore: update something
Browse files
app.py
CHANGED
@@ -334,7 +334,7 @@ def search_with_wikipedia(
|
|
334 |
try:
|
335 |
wikipedia.set_lang(language)
|
336 |
page = wikipedia.page(query)
|
337 |
-
content = page.content[:
|
338 |
all_results.append(content)
|
339 |
except Exception as e:
|
340 |
pass
|
@@ -349,7 +349,7 @@ def search_with_google(
|
|
349 |
ssl_verify: bool = None,
|
350 |
):
|
351 |
all_results = []
|
352 |
-
max_chars_per_page =
|
353 |
with requests.Session() as session:
|
354 |
resp = session.get(
|
355 |
url="https://www.google.com/search",
|
@@ -485,14 +485,14 @@ def generate(
|
|
485 |
language = scheduled_tools_runs["arguments"]["language"]
|
486 |
if search_type == "wikipedia":
|
487 |
gr.Info("Searching for information on the Wikipedia.")
|
488 |
-
document_references
|
489 |
-
query=keyword, language=language
|
490 |
-
)
|
491 |
-
else:
|
492 |
-
gr.Info("Searching for information on the Google.")
|
493 |
-
document_references = search_with_google(
|
494 |
-
query=keyword, language=language
|
495 |
)
|
|
|
|
|
|
|
|
|
|
|
496 |
print(
|
497 |
"scheduled_tools_runs:", scheduled_tools_runs, document_references
|
498 |
)
|
|
|
334 |
try:
|
335 |
wikipedia.set_lang(language)
|
336 |
page = wikipedia.page(query)
|
337 |
+
content = page.content[:8192]
|
338 |
all_results.append(content)
|
339 |
except Exception as e:
|
340 |
pass
|
|
|
349 |
ssl_verify: bool = None,
|
350 |
):
|
351 |
all_results = []
|
352 |
+
max_chars_per_page = 4096
|
353 |
with requests.Session() as session:
|
354 |
resp = session.get(
|
355 |
url="https://www.google.com/search",
|
|
|
485 |
language = scheduled_tools_runs["arguments"]["language"]
|
486 |
if search_type == "wikipedia":
|
487 |
gr.Info("Searching for information on the Wikipedia.")
|
488 |
+
document_references.extend(
|
489 |
+
search_with_wikipedia(query=keyword, language=language)
|
|
|
|
|
|
|
|
|
|
|
490 |
)
|
491 |
+
|
492 |
+
gr.Info("Searching for information on the Google.")
|
493 |
+
document_references = search_with_google(
|
494 |
+
query=keyword, language=language
|
495 |
+
)
|
496 |
print(
|
497 |
"scheduled_tools_runs:", scheduled_tools_runs, document_references
|
498 |
)
|