jupiter-faq-bot / app /routes.py
thecoderhere's picture
Update app/routes.py
c8ee175 verified
raw
history blame contribute delete
566 Bytes
# app/routes.py
from flask import Blueprint, render_template, request, jsonify
from app.bot import JupiterFAQBot
main = Blueprint('main', __name__)
bot = JupiterFAQBot()
@main.route('/')
def index():
return render_template('index.html')
@main.route('/chat', methods=['POST'])
def chat():
data = request.json
question = data.get('question', '')
response = bot.generate_response(question)
suggestions = bot.suggest_related_queries(question)
return jsonify({
'response': response,
'suggestions': suggestions
})