add: WhatsApp, Slack and Telegram bots (#438)
This commit is contained in:
committed by
GitHub
parent
09c02954ba
commit
e3ae84b80d
@@ -26,6 +26,19 @@ def add():
|
||||
|
||||
@app.route("/query", methods=["POST"])
|
||||
def query():
|
||||
data = request.get_json()
|
||||
question = data.get("question")
|
||||
if question:
|
||||
try:
|
||||
response = chat_bot.query(question)
|
||||
return jsonify({"data": response}), 200
|
||||
except Exception:
|
||||
return jsonify({"error": "An error occurred. Please try again!"}), 500
|
||||
return jsonify({"error": "Invalid request. Please provide 'question' in JSON format."}), 400
|
||||
|
||||
|
||||
@app.route("/chat", methods=["POST"])
|
||||
def chat():
|
||||
data = request.get_json()
|
||||
question = data.get("question")
|
||||
if question:
|
||||
|
||||
Reference in New Issue
Block a user