aidevhund commited on
Commit
7b8bd19
·
verified ·
1 Parent(s): f29f4f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -52,12 +52,13 @@ def query_with_retry(query, max_retries=3, wait_time=5):
52
  def respond(message, history):
53
  try:
54
  # Sorguyu query_engine üzerinde çalıştır
55
- response = query_engine.query(message)
56
-
57
- # Loglama işlemi
58
- print(f"\n{datetime.now()}:{llm.model_name}:: {message} --> {str(response)}\n")
59
 
60
- return f"{llm.model_name}:\n{str(response)}", history + [(message, str(response))]
 
 
61
  except Exception as e:
62
  if str(e) == "'NoneType' object has no attribute 'as_query_engine'":
63
  return "Please upload a file.", history
@@ -90,4 +91,4 @@ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]),
90
 
91
  # Launch the demo
92
  if __name__ == "__main__":
93
- demo.launch()
 
52
  def respond(message, history):
53
  try:
54
  # Sorguyu query_engine üzerinde çalıştır
55
+ bot_message = query_engine.query(message)
56
+
57
+ print(f"\n{datetime.now()}:{llm.model_name}:: {message} --> {str(bot_message)}\n")
 
58
 
59
+ # Geçmişi güncelle ve doğru formatta döndür
60
+ history.append((message, str(bot_message)))
61
+ return history, history # Chatbot için doğru formatta döndürülüyor
62
  except Exception as e:
63
  if str(e) == "'NoneType' object has no attribute 'as_query_engine'":
64
  return "Please upload a file.", history
 
91
 
92
  # Launch the demo
93
  if __name__ == "__main__":
94
+ demo.launch()