"""
@author: luojunhui
"""
import pyapollos


class apolloConfig(object):
    """
    apolloConfig
    """

    def __init__(self, env="pre"):
        """

        :param env:
        """
        self.apollo_connection = pyapollos.ApolloClient(
            app_id="LongArticlesJob",
            config_server_url="https://preapolloconfig-internal.piaoquantv.com/",
            timeout=10
        )
        match env:
            case "prod":
                self.apollo_connection = pyapollos.ApolloClient(
                    app_id="LongArticlesJob",
                    config_server_url="https://apolloconfig-internal.piaoquantv.com/",
                    timeout=10
                )
            case "dev":
                self.apollo_connection = pyapollos.ApolloClient(
                    app_id="LongArticlesJob",
                    config_server_url="https://devapolloconfig-internal.piaoquantv.com/",
                    timeout=10
                )
            case "pre":
                self.apollo_connection = pyapollos.ApolloClient(
                    app_id="LongArticlesJob",
                    config_server_url="http://preapolloconfig-internal.piaoquantv.com/",
                    timeout=10
                )

    def getConfigValue(self, key):
        """
        通过 key 获取配置的 Config
        :param key:
        :return:
        """
        response = self.apollo_connection.get_value(key)
        return response


# aigc后台数据库连接配置
denet_config = {
    'host': 'rm-t4na9qj85v7790tf84o.mysql.singapore.rds.aliyuncs.com',
    'port': 3306,
    'user': 'crawler_admin',
    'password': 'cyber#crawler_2023',
    'db': 'aigc-admin-prod',
    'charset': 'utf8mb4'
}


# 长文数据库连接配置
long_articles_config = {
    'host': 'rm-bp14529nwwcw75yr1ko.mysql.rds.aliyuncs.com',
    'port': 3306,
    'user': 'changwen_admin',
    'password': 'changwen@123456',
    'db': 'long_articles',
    'charset': 'utf8mb4'
}


# 票圈爬虫库数据库配置
piaoquan_crawler_config = {
    'host': 'rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com',
    'port': 3306,
    'user': 'crawler',
    'password': 'crawler123456@',
    'db': 'piaoquan-crawler',
    'charset': 'utf8mb4'
}

deep_seek_model = {
    "DeepSeek-R1": "ep-20250213194143-d8q4t",
    "DeepSeek-V3": "ep-20250213194558-rrmr2"
}

deep_seek_default_model = "ep-20250213194558-rrmr2"

deep_seek_api_key_byte_dance = '5e275c38-44fd-415f-abcf-4b59f6377f72'