rishisim commited on
Commit
1817ba4
1 Parent(s): 62855fd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -55,7 +55,10 @@ rag_chain = (
55
 
56
  # Define the chat response function
57
  def chatresponse(message, history):
58
- output = rag_chain.invoke(message)
 
 
 
59
  response = output.split('ANSWER: ')[-1].strip()
60
  return response
61
 
 
55
 
56
  # Define the chat response function
57
  def chatresponse(message, history):
58
+ history_text = "\n".join([f"User: {h[0]}\nAssistant: {h[1]}" for h in history])
59
+ msg = message
60
+ totalmessage = history_text + msg
61
+ output = rag_chain.invoke(totalmessage)
62
  response = output.split('ANSWER: ')[-1].strip()
63
  return response
64