__init__.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. """
  2. @author: luojunhui
  3. """
  4. import pyapollos
  5. class apolloConfig(object):
  6. """
  7. apolloConfig
  8. """
  9. def __init__(self, env="pre"):
  10. """
  11. :param env:
  12. """
  13. self.apollo_connection = pyapollos.ApolloClient(
  14. app_id="LongArticlesJob",
  15. config_server_url="https://preapolloconfig-internal.piaoquantv.com/",
  16. timeout=10
  17. )
  18. match env:
  19. case "prod":
  20. self.apollo_connection = pyapollos.ApolloClient(
  21. app_id="LongArticlesJob",
  22. config_server_url="https://apolloconfig-internal.piaoquantv.com/",
  23. timeout=10
  24. )
  25. case "dev":
  26. self.apollo_connection = pyapollos.ApolloClient(
  27. app_id="LongArticlesJob",
  28. config_server_url="https://devapolloconfig-internal.piaoquantv.com/",
  29. timeout=10
  30. )
  31. case "pre":
  32. self.apollo_connection = pyapollos.ApolloClient(
  33. app_id="LongArticlesJob",
  34. config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
  35. timeout=10
  36. )
  37. def getConfigValue(self, key):
  38. """
  39. 通过 key 获取配置的 Config
  40. :param key:
  41. :return:
  42. """
  43. response = self.apollo_connection.get_value(key)
  44. return response
  45. # aigc后台数据库连接配置
  46. denet_config = {
  47. 'host': 'rm-t4na9qj85v7790tf84o.mysql.singapore.rds.aliyuncs.com',
  48. 'port': 3306,
  49. 'user': 'crawler_admin',
  50. 'password': 'cyber#crawler_2023',
  51. 'db': 'aigc-admin-prod',
  52. 'charset': 'utf8mb4'
  53. }
  54. # 长文数据库连接配置
  55. long_articles_config = {
  56. 'host': 'rm-bp14529nwwcw75yr1ko.mysql.rds.aliyuncs.com',
  57. 'port': 3306,
  58. 'user': 'changwen_admin',
  59. 'password': 'changwen@123456',
  60. 'db': 'long_articles',
  61. 'charset': 'utf8mb4'
  62. }
  63. # 票圈爬虫库数据库配置
  64. piaoquan_crawler_config = {
  65. 'host': 'rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com',
  66. 'port': 3306,
  67. 'user': 'crawler',
  68. 'password': 'crawler123456@',
  69. 'db': 'piaoquan-crawler',
  70. 'charset': 'utf8mb4'
  71. }
  72. # moonshot model config(kimi)
  73. moon_shot = {
  74. "api_key": "sk-5DqYCa88kche6nwIWjLE1p4oMm8nXrR9kQMKbBolNAWERu7q",
  75. "model": "moonshot-v1-32k",
  76. "base_url": "https://api.moonshot.cn/v1"
  77. }
  78. # deepseek official api
  79. deep_seek_official_api_key = 'sk-cfd2df92c8864ab999d66a615ee812c5'
  80. deep_seek_official_model = {
  81. "DeepSeek-R1": "deepseek-reasoner",
  82. "DeepSeek-V3": "deepseek-chat",
  83. }
  84. # deepseek volcano engine
  85. deep_seek_model = {
  86. "DeepSeek-R1": "ep-20250213194143-d8q4t",
  87. "DeepSeek-V3": "ep-20250213194558-rrmr2"
  88. }
  89. deep_seek_default_model = "ep-20250213194558-rrmr2"
  90. deep_seek_api_key_byte_dance = '5e275c38-44fd-415f-abcf-4b59f6377f72'
  91. #GeWe
  92. gewe_token = "d3fb918f-0f36-4769-b095-410181614231"
  93. gewe_app_id = "wx_GKpVW8xfEhcaxMIK9sSm6"
  94. gewe_base_url = "http://218.78.116.24:10884"
  95. # sph decrypt key
  96. decrypt_key_path = 'applications/so/libsph_decrypt.so'
  97. # toutiao js path
  98. toutiao_js_path = 'applications/js/toutiao.js'