lamhieu commited on
Commit
b37a05b
·
1 Parent(s): 0f942b5

chore: update something

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -459,12 +459,11 @@ def generate(
459
  gr.Info("Searching for information on the Google.")
460
  document_references = search_with_google(keyword)
461
 
 
 
 
462
  input_ids = build_input_ids(
463
- apply_tools=(
464
- True
465
- if allow_used_tools is True and previous_response is None
466
- else False
467
- ),
468
  references=document_references,
469
  )
470
  streamer = TextIteratorStreamer(
@@ -496,12 +495,16 @@ def generate(
496
  if state["mark"] is None:
497
  state["mark"] = time.time()
498
  outputs.append(text)
499
- if state["mark"] + waiting_tools_timeout < time.time():
 
 
 
500
  state["respond"] = True
501
  yield "".join(outputs)
502
 
503
  if (
504
- state["respond"] is False
 
505
  and state["mark"] + waiting_tools_timeout > time.time()
506
  ):
507
  gr.Info("Searching for information on the internet.")
 
459
  gr.Info("Searching for information on the Google.")
460
  document_references = search_with_google(keyword)
461
 
462
+ apply_tools = (
463
+ True if allow_used_tools is True and previous_response is None else False
464
+ )
465
  input_ids = build_input_ids(
466
+ apply_tools=apply_tools,
 
 
 
 
467
  references=document_references,
468
  )
469
  streamer = TextIteratorStreamer(
 
495
  if state["mark"] is None:
496
  state["mark"] = time.time()
497
  outputs.append(text)
498
+ if (
499
+ apply_tools is False
500
+ or state["mark"] + waiting_tools_timeout < time.time()
501
+ ):
502
  state["respond"] = True
503
  yield "".join(outputs)
504
 
505
  if (
506
+ apply_tools is True
507
+ and state["respond"] is False
508
  and state["mark"] + waiting_tools_timeout > time.time()
509
  ):
510
  gr.Info("Searching for information on the internet.")