denizd commited on
Commit
8020138
·
verified ·
1 Parent(s): b04b0dd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -29,14 +29,9 @@ def get_top_chunks(query):
29
  return top_chunks
30
 
31
  def chatbot_response(message, history):
32
- try:
33
- top_chunks = get_top_chunks(message)
34
- numbered_response = "\n".join([f"{i+1}. {chunk}" for i, chunk in enumerate(top_chunks)])
35
- except Exception as e:
36
- numbered_response = f"Sorry, something went wrong: {e}"
37
- history = history or []
38
- history.append((message, numbered_response))
39
- return numbered_response, history
40
 
41
  chatbot = gr.ChatInterface(fn=chatbot_response, title="RAG Chatbot")
42
  chatbot.launch()
 
29
  return top_chunks
30
 
31
  def chatbot_response(message, history):
32
+ top_chunks = get_top_chunks(message)
33
+ numbered_response = "\n".join([f"{i+1}. {chunk}" for i, chunk in enumerate(top_chunks)])
34
+ return [{"role": "assistant", "content": numbered_response}]
 
 
 
 
 
35
 
36
  chatbot = gr.ChatInterface(fn=chatbot_response, title="RAG Chatbot")
37
  chatbot.launch()