-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
23 lines (18 loc) · 662 Bytes
/
app.py
File metadata and controls
23 lines (18 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#Flask
from flask import Flask, request, jsonify, render_template
from crag import answer
app = Flask(__name__)
@app.route('/')
def index():
return render_template('chatbot.html')
@app.route('/send_message', methods=['POST'])
def send_message():
data = request.get_json()
user_message = data.get('message')
# For simplicity, we're sending a static response.
# You can replace this with any logic, such as querying a database or calling a chatbot API.
reply= answer(user_message)
bot_reply = reply # Simple echo for demonstration
return jsonify({'reply': bot_reply})
if __name__ == '__main__':
app.run(debug=True)