lamhieu commited on
Commit
1b91853
·
1 Parent(s): 26d4e59

chore: update something

Browse files
Files changed (1) hide show
  1. app.py +9 -9
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[:16384]
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 = 5120
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 = search_with_wikipedia(
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
  )