giannantonio15 commited on
Commit
b4e2f36
1 Parent(s): 5747ecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -395,7 +395,7 @@ def main():
395
  return "", history + [[user_message, None]]
396
 
397
  @spaces.GPU(duration=120)
398
- def bot(history):
399
  global chat_engine_bandi
400
  global chat_engine_bandi_sistema_puglia
401
  global memory_bandi
@@ -407,7 +407,6 @@ def main():
407
  global current_chat_mode
408
  global token_count_bandi
409
  global token_count_bandi_sistema_puglia
410
- global user_message
411
 
412
  if(current_chat_mode=="CHAT"):
413
  if(current_collection=="BANDI"):
@@ -420,7 +419,7 @@ def main():
420
  print(memory_bandi)
421
  stream_response = None
422
  print(user_message)
423
- stream_response = chat_engine_bandi.stream_chat(user_message)
424
  print("risposta con chat engine")
425
  responseHTML = ""
426
  for i, node in enumerate(stream_response.source_nodes):
@@ -446,7 +445,7 @@ def main():
446
  print(memory_bandi_sistema_puglia)
447
  stream_response = None
448
  print(user_message)
449
- stream_response = chat_engine_bandi_sistema_puglia.stream_chat(user_message)
450
  print("risposta con chat engine")
451
  responseHTML = ""
452
  for i, node in enumerate(stream_response.source_nodes):
@@ -472,7 +471,7 @@ def main():
472
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
473
  stream_response = None
474
  print(user_message)
475
- stream_response = query_engine.query(user_message)
476
  print("risposta con query engine")
477
  responseHTML = ""
478
  for i, node in enumerate(stream_response.source_nodes):
@@ -490,7 +489,7 @@ def main():
490
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
491
  stream_response = None
492
  print(user_message)
493
- stream_response = query_engine.query(user_message)
494
  print("risposta con query engine")
495
  responseHTML = ""
496
  for i, node in enumerate(stream_response.source_nodes):
@@ -512,7 +511,7 @@ def main():
512
 
513
 
514
  msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
515
- bot, chatbot, [chatbot, divDocumenti]
516
  )
517
 
518
  demo.queue()
 
395
  return "", history + [[user_message, None]]
396
 
397
  @spaces.GPU(duration=120)
398
+ def bot(userMessage, history):
399
  global chat_engine_bandi
400
  global chat_engine_bandi_sistema_puglia
401
  global memory_bandi
 
407
  global current_chat_mode
408
  global token_count_bandi
409
  global token_count_bandi_sistema_puglia
 
410
 
411
  if(current_chat_mode=="CHAT"):
412
  if(current_collection=="BANDI"):
 
419
  print(memory_bandi)
420
  stream_response = None
421
  print(user_message)
422
+ stream_response = chat_engine_bandi.stream_chat(userMessage)
423
  print("risposta con chat engine")
424
  responseHTML = ""
425
  for i, node in enumerate(stream_response.source_nodes):
 
445
  print(memory_bandi_sistema_puglia)
446
  stream_response = None
447
  print(user_message)
448
+ stream_response = chat_engine_bandi_sistema_puglia.stream_chat(userMessage)
449
  print("risposta con chat engine")
450
  responseHTML = ""
451
  for i, node in enumerate(stream_response.source_nodes):
 
471
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
472
  stream_response = None
473
  print(user_message)
474
+ stream_response = query_engine.query(userMessage)
475
  print("risposta con query engine")
476
  responseHTML = ""
477
  for i, node in enumerate(stream_response.source_nodes):
 
489
  query_engine = RetrieverQueryEngine(retriever=retriever, response_synthesizer=response_synthesizer)
490
  stream_response = None
491
  print(user_message)
492
+ stream_response = query_engine.query(userMessage)
493
  print("risposta con query engine")
494
  responseHTML = ""
495
  for i, node in enumerate(stream_response.source_nodes):
 
511
 
512
 
513
  msg.submit(user, [msg, chatbot], [msg, chatbot], queue=False).then(
514
+ bot, [msg, chatbot], [chatbot, divDocumenti]
515
  )
516
 
517
  demo.queue()