Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,10 @@ rag_chain = (
|
|
| 55 |
|
| 56 |
# Define the chat response function
|
| 57 |
def chatresponse(message, history):
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 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 |
|