Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -184,15 +184,18 @@ def handle_message(data):
|
|
184 |
session_id = data.get('session_id', SESSION_ID_DEFAULT)
|
185 |
chain = conversational_rag_chain.pick("answer")
|
186 |
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
|
|
|
|
|
|
196 |
|
197 |
|
198 |
# Home route
|
|
|
184 |
session_id = data.get('session_id', SESSION_ID_DEFAULT)
|
185 |
chain = conversational_rag_chain.pick("answer")
|
186 |
|
187 |
+
for chunk in chain.stream({"input": question, 'language': language}, config={"configurable": {"session_id": session_id}}):
|
188 |
+
emit('response', chunk, room=request.sid)
|
189 |
+
|
190 |
+
# try:
|
191 |
+
# for chunk in chain.stream(
|
192 |
+
# {"input": question, 'language': language},
|
193 |
+
# config={"configurable": {"session_id": session_id}},
|
194 |
+
# ):
|
195 |
+
# emit('response', chunk, room=request.sid)
|
196 |
+
# except Exception as e:
|
197 |
+
# print(f"Error during message handling: {e}")
|
198 |
+
# emit('response', {"error": "An error occurred while processing your request."+ str(e)}, room=request.sid)
|
199 |
|
200 |
|
201 |
# Home route
|