forked from answerlink/IntelliQ
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
31 lines (23 loc) · 827 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# encoding=utf-8
from models.chatbot_model import ChatbotModel
from utils.app_init import before_init
from utils.helpers import load_scene_templates
from flask import Flask, request, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
# 加载场景模板
scene_templates = load_scene_templates('scene_config/scene_templates.json')
# 实例化ChatbotModel
chatbot_model = ChatbotModel(scene_templates)
@app.route('/multi_question', methods=['POST'])
def api_multi_question():
data = request.json
question = data.get('question')
if not question:
return jsonify({"error": "No question provided"}), 400
response = chatbot_model.process_multi_question(question)
return jsonify({"answer": response})
if __name__ == '__main__':
before_init()
app.run(port=5000, debug=True)