Ritesh-hf commited on
Commit
10732be
·
verified ·
1 Parent(s): 9f8f895

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
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
- try:
188
- for chunk in chain.stream(
189
- {"input": question, 'language': language},
190
- config={"configurable": {"session_id": session_id}},
191
- ):
192
- emit('response', chunk, room=request.sid)
193
- except Exception as e:
194
- print(f"Error during message handling: {e}")
195
- emit('response', {"error": "An error occurred while processing your request."+ str(e)}, room=request.sid)
 
 
 
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