1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- """
- @author: luojunhui
- """
- from quart import Blueprint, jsonify, request
- from .accountArticleRank import AccountArticleRank
- from .nlpServer import NLPServer
- from .articleDBServer import ArticleDB
- from .accountServer import AccountServer
- def AlgRoutes(mysql_client, model):
- """
- ALG ROUTES
- :return:
- """
- blueprint = Blueprint("LongArticlesAlgServer", __name__)
- @blueprint.route("/healthCheck")
- def helloFuture():
- """
- 测试服务连通性
- :return:
- """
- response = {"msg": "Hello, World! Hello, Future"}
- return jsonify(response)
- @blueprint.route("/articleRank", methods=["POST"])
- async def articleRankRoute():
- """
- 文章排序接口
- :return:
- """
- params = await request.get_json()
- AAR = AccountArticleRank(params, mysql_client=mysql_client)
- response = await AAR.deal()
- # print(response)
- return jsonify(response)
- @blueprint.route("/nlp", methods=["POST"])
- async def nlper():
- """
- nlper ma
- :return:
- """
- params = await request.get_json()
- nlpS = NLPServer(params=params, model=model)
- response = nlpS.deal()
- return jsonify(response)
- @blueprint.route("/score_list", methods=["POST"])
- async def articleAccount():
- """
- 公众号文章功能等接口
- :return:
- """
- params = await request.get_json()
- AS = AccountServer(mysql_client=mysql_client, params=params)
- response = await AS.deal()
- return jsonify(response)
- @blueprint.route("/article_db", methods=["POST"])
- async def articleMysql():
- """
- 长文数据库相关接口
- :return:
- """
- params = await request.get_json()
- ADB = ArticleDB(params=params, mysql_client=mysql_client)
- response = await ADB.deal()
- return jsonify(response)
- return blueprint
|