__init__.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. # growth数据库连接
  46. growth_config = {
  47. "host": "rm-bp17q95335a99272b.mysql.rds.aliyuncs.com",
  48. "port": 3306,
  49. "user": "crawler",
  50. "password": "crawler123456@",
  51. "db": "growth",
  52. "charset": "utf8mb4"
  53. }
  54. # aigc后台数据库连接配置
  55. denet_config = {
  56. 'host': 'rm-t4na9qj85v7790tf84o.mysql.singapore.rds.aliyuncs.com',
  57. 'port': 3306,
  58. 'user': 'crawler_admin',
  59. 'password': 'cyber#crawler_2023',
  60. 'db': 'aigc-admin-prod',
  61. 'charset': 'utf8mb4'
  62. }
  63. # 长文数据库连接配置
  64. long_articles_config = {
  65. 'host': 'rm-bp14529nwwcw75yr1ko.mysql.rds.aliyuncs.com',
  66. 'port': 3306,
  67. 'user': 'changwen_admin',
  68. 'password': 'changwen@123456',
  69. 'db': 'long_articles',
  70. 'charset': 'utf8mb4'
  71. }
  72. # 票圈爬虫库数据库配置
  73. piaoquan_crawler_config = {
  74. 'host': 'rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com',
  75. 'port': 3306,
  76. 'user': 'crawler',
  77. 'password': 'crawler123456@',
  78. 'db': 'piaoquan-crawler',
  79. 'charset': 'utf8mb4'
  80. }
  81. # moonshot model config(kimi)
  82. moon_shot = {
  83. "api_key": "sk-5DqYCa88kche6nwIWjLE1p4oMm8nXrR9kQMKbBolNAWERu7q",
  84. "model": "moonshot-v1-32k",
  85. "base_url": "https://api.moonshot.cn/v1"
  86. }
  87. # deepseek official api
  88. deep_seek_official_api_key = 'sk-cfd2df92c8864ab999d66a615ee812c5'
  89. deep_seek_official_model = {
  90. "DeepSeek-R1": "deepseek-reasoner",
  91. "DeepSeek-V3": "deepseek-chat",
  92. }
  93. # deepseek volcano engine
  94. deep_seek_model = {
  95. "DeepSeek-R1": "ep-20250213194143-d8q4t",
  96. "DeepSeek-V3": "ep-20250213194558-rrmr2"
  97. }
  98. deep_seek_default_model = "ep-20250213194558-rrmr2"
  99. deep_seek_api_key_byte_dance = '5e275c38-44fd-415f-abcf-4b59f6377f72'
  100. #GeWe
  101. gewe_token = "d3fb918f-0f36-4769-b095-410181614231"
  102. gewe_app_id = "wx_GKpVW8xfEhcaxMIK9sSm6"
  103. gewe_base_url = "http://218.78.116.24:10884"
  104. # sph decrypt key
  105. decrypt_key_path = 'applications/so/libsph_decrypt.so'
  106. # toutiao js path
  107. toutiao_js_path = 'applications/js/toutiao.js'