Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -231,17 +231,30 @@ class OpenFloorAgentServer:
|
|
231 |
@app.route('/openfloor/conversation', methods=['POST'])
|
232 |
def handle_conversation():
|
233 |
try:
|
|
|
|
|
234 |
# Parse incoming OpenFloor envelope
|
235 |
envelope_data = request.get_json()
|
|
|
|
|
236 |
envelope = Envelope.from_json(json.dumps(envelope_data))
|
|
|
237 |
|
238 |
# Process the request
|
|
|
239 |
response_envelope = self.agent.handle_utterance_event(envelope)
|
|
|
240 |
|
241 |
# Return OpenFloor response
|
242 |
-
|
|
|
|
|
243 |
|
244 |
except Exception as e:
|
|
|
|
|
|
|
|
|
245 |
error_response = self.agent._create_error_response(
|
246 |
envelope if 'envelope' in locals() else None,
|
247 |
str(e)
|
|
|
231 |
@app.route('/openfloor/conversation', methods=['POST'])
|
232 |
def handle_conversation():
|
233 |
try:
|
234 |
+
print(f"π DEBUG: Flask route called for agent {self.agent.tool.name}")
|
235 |
+
|
236 |
# Parse incoming OpenFloor envelope
|
237 |
envelope_data = request.get_json()
|
238 |
+
print(f"π DEBUG: Received envelope data: {str(envelope_data)[:200]}...")
|
239 |
+
|
240 |
envelope = Envelope.from_json(json.dumps(envelope_data))
|
241 |
+
print(f"π DEBUG: Envelope parsed successfully")
|
242 |
|
243 |
# Process the request
|
244 |
+
print(f"π DEBUG: Calling handle_utterance_event...")
|
245 |
response_envelope = self.agent.handle_utterance_event(envelope)
|
246 |
+
print(f"π DEBUG: handle_utterance_event completed")
|
247 |
|
248 |
# Return OpenFloor response
|
249 |
+
response_json = json.loads(response_envelope.to_json())
|
250 |
+
print(f"π DEBUG: Returning response: {str(response_json)[:200]}...")
|
251 |
+
return jsonify(response_json)
|
252 |
|
253 |
except Exception as e:
|
254 |
+
print(f"π DEBUG: Exception in Flask route: {e}")
|
255 |
+
import traceback
|
256 |
+
traceback.print_exc()
|
257 |
+
|
258 |
error_response = self.agent._create_error_response(
|
259 |
envelope if 'envelope' in locals() else None,
|
260 |
str(e)
|