thecoderhere commited on
Commit
c8ee175
·
verified ·
1 Parent(s): bdce4c6

Update app/routes.py

Browse files
Files changed (1) hide show
  1. app/routes.py +24 -22
app/routes.py CHANGED
@@ -1,22 +1,24 @@
1
- from flask import render_template, request, jsonify
2
- from app import app
3
- from app.bot import JupiterFAQBot
4
-
5
- bot = JupiterFAQBot()
6
-
7
- @app.route('/')
8
- def index():
9
- return render_template('index.html')
10
-
11
- @app.route('/chat', methods=['POST'])
12
- def chat():
13
- data = request.json
14
- question = data.get('question', '')
15
-
16
- response = bot.generate_response(question)
17
- suggestions = bot.suggest_related_queries(question)
18
-
19
- return jsonify({
20
- 'response': response,
21
- 'suggestions': suggestions
22
- })
 
 
 
1
+ # app/routes.py
2
+
3
+ from flask import Blueprint, render_template, request, jsonify
4
+ from app.bot import JupiterFAQBot
5
+
6
+ main = Blueprint('main', __name__)
7
+ bot = JupiterFAQBot()
8
+
9
+ @main.route('/')
10
+ def index():
11
+ return render_template('index.html')
12
+
13
+ @main.route('/chat', methods=['POST'])
14
+ def chat():
15
+ data = request.json
16
+ question = data.get('question', '')
17
+
18
+ response = bot.generate_response(question)
19
+ suggestions = bot.suggest_related_queries(question)
20
+
21
+ return jsonify({
22
+ 'response': response,
23
+ 'suggestions': suggestions
24
+ })