__init__.py 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. """
  2. @author: luojunhui
  3. """
  4. from quart import Blueprint, jsonify, request
  5. from .accountArticleRank import AccountArticleRank
  6. from .nlpServer import NLPServer
  7. # from .articleDBServer import ArticleDB
  8. from .accountServer import AccountServer
  9. def AlgRoutes(mysql_client, model):
  10. """
  11. ALG ROUTES
  12. :return:
  13. """
  14. blueprint = Blueprint("LongArticlesAlgServer", __name__)
  15. @blueprint.route("/healthCheck")
  16. def helloFuture():
  17. """
  18. 测试服务连通性
  19. :return:
  20. """
  21. response = {"msg": "Hello, World! Hello, Future"}
  22. return jsonify(response)
  23. @blueprint.route("/articleRank", methods=["POST"])
  24. async def articleRankRoute():
  25. """
  26. 文章排序接口
  27. :return:
  28. """
  29. params = await request.get_json()
  30. AAR = AccountArticleRank(params, mysql_client=mysql_client)
  31. response = await AAR.deal()
  32. # print(response)
  33. return jsonify(response)
  34. @blueprint.route("/nlp", methods=["POST"])
  35. async def nlper():
  36. """
  37. nlper ma
  38. :return:
  39. """
  40. params = await request.get_json()
  41. nlpS = NLPServer(params=params, model=model)
  42. response = nlpS.deal()
  43. return jsonify(response)
  44. @blueprint.route("/score_list", methods=["POST"])
  45. async def articleAccount():
  46. """
  47. 公众号文章功能等接口
  48. :return:
  49. """
  50. params = await request.get_json()
  51. AS = AccountServer(mysql_client=mysql_client, params=params)
  52. response = await AS.deal()
  53. return jsonify(response)
  54. # @blueprint.route("/article_db", methods=["POST"])
  55. # async def articleMysql():
  56. # """
  57. # 长文数据库相关接口
  58. # :return:
  59. # """
  60. # params = await request.get_json()
  61. # ADB = ArticleDB(params=params, mysql_client=mysql_client)
  62. # response = await ADB.deal()
  63. # return jsonify(response)
  64. return blueprint