def chatbot_start(): global chatbot chatbot =ChatBot() chatbot.start_all_bots() print('启动成功') return json.dumps('启动成功', ensure_ascii=False)
# coding=utf-8 import flask from flask import Flask, g, render_template, request from chatbot import ChatBot import json __all__ = ['app'] app = Flask(__name__) chatbot = None chatbot =ChatBot() chatbot.start_all_bots() print('启动成功') @app.after_request def after_request(response): response.headers['Access-Control-Allow-Origin'] = '*' return response @app.route('/') def index(): return 'Hello World</br>' @app.route('/start', methods=['GET']) def chatbot_start(): global chatbot chatbot =ChatBot() chatbot.start_all_bots()