Spaces:
Runtime error
Runtime error
File size: 551 Bytes
838e061 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
from flask import Flask, request, jsonify
from chatbot_multiagent import submitUserMessage
app = Flask(__name__)
@app.route('/', methods=['POST'])
def chatbot():
user_message = request.json.get('message', '')
if not user_message:
return jsonify({"error": "Message is required"}), 400
try:
response = submitUserMessage(user_message)
return jsonify({"response": response})
except Exception as e:
return jsonify({"error": str(e)}), 500
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5050) |