MaiBot/config_keys.py

104 lines
4.4 KiB
Python

"""
配置键常量定义
集中管理所有配置键,避免硬编码
"""
class ConfigKeys:
"""配置键常量类"""
# ========== Plugin 配置 ==========
PLUGIN_ENABLED = "plugin.enabled"
PLUGIN_CONFIG_VERSION = "plugin.config_version"
# ========== General 通用配置 ==========
GENERAL_DEFAULT_BACKEND = "general.default_backend"
GENERAL_TIMEOUT = "general.timeout"
GENERAL_MAX_TEXT_LENGTH = "general.max_text_length"
GENERAL_USE_REPLYER_REWRITE = "general.use_replyer_rewrite"
GENERAL_AUDIO_OUTPUT_DIR = "general.audio_output_dir"
GENERAL_USE_BASE64_AUDIO = "general.use_base64_audio"
GENERAL_SPLIT_SENTENCES = "general.split_sentences"
GENERAL_SPLIT_DELAY = "general.split_delay"
GENERAL_SPLIT_MIN_TOTAL_CHARS = "general.split_min_total_chars"
GENERAL_SPLIT_MIN_SENTENCE_CHARS = "general.split_min_sentence_chars"
GENERAL_SPLIT_MAX_SEGMENTS = "general.split_max_segments"
GENERAL_SPLIT_CHUNK_CHARS = "general.split_chunk_chars"
GENERAL_SEND_ERROR_MESSAGES = "general.send_error_messages"
# ========== Components 组件配置 ==========
COMPONENTS_ACTION_ENABLED = "components.action_enabled"
COMPONENTS_COMMAND_ENABLED = "components.command_enabled"
COMPONENTS_INSTRUCT_COMMAND_ENABLED = "components.instruct_command_enabled"
# ========== Probability 概率控制配置 ==========
PROBABILITY_ENABLED = "probability.enabled"
PROBABILITY_BASE_PROBABILITY = "probability.base_probability"
PROBABILITY_KEYWORD_FORCE_TRIGGER = "probability.keyword_force_trigger"
PROBABILITY_FORCE_KEYWORDS = "probability.force_keywords"
# ========== AI Voice 配置 ==========
AI_VOICE_DEFAULT_CHARACTER = "ai_voice.default_character"
AI_VOICE_ALIAS_MAP = "ai_voice.alias_map"
# ========== GSV2P 配置 ==========
GSV2P_API_URL = "gsv2p.api_url"
GSV2P_API_TOKEN = "gsv2p.api_token"
GSV2P_DEFAULT_VOICE = "gsv2p.default_voice"
GSV2P_TIMEOUT = "gsv2p.timeout"
GSV2P_MODEL = "gsv2p.model"
GSV2P_RESPONSE_FORMAT = "gsv2p.response_format"
GSV2P_SPEED = "gsv2p.speed"
# ========== GPT-SoVITS 配置 ==========
GPT_SOVITS_SERVER = "gpt_sovits.server"
GPT_SOVITS_STYLES = "gpt_sovits.styles"
# ========== Doubao 豆包配置 ==========
DOUBAO_API_URL = "doubao.api_url"
DOUBAO_APP_ID = "doubao.app_id"
DOUBAO_ACCESS_KEY = "doubao.access_key"
DOUBAO_RESOURCE_ID = "doubao.resource_id"
DOUBAO_DEFAULT_VOICE = "doubao.default_voice"
DOUBAO_TIMEOUT = "doubao.timeout"
DOUBAO_AUDIO_FORMAT = "doubao.audio_format"
DOUBAO_SAMPLE_RATE = "doubao.sample_rate"
DOUBAO_BITRATE = "doubao.bitrate"
DOUBAO_SPEED = "doubao.speed"
DOUBAO_VOLUME = "doubao.volume"
DOUBAO_CONTEXT_TEXTS = "doubao.context_texts"
# ========== CosyVoice 配置 ==========
COSYVOICE_GRADIO_URL = "cosyvoice.gradio_url"
COSYVOICE_DEFAULT_MODE = "cosyvoice.default_mode"
COSYVOICE_DEFAULT_INSTRUCT = "cosyvoice.default_instruct"
COSYVOICE_REFERENCE_AUDIO = "cosyvoice.reference_audio"
COSYVOICE_PROMPT_TEXT = "cosyvoice.prompt_text"
COSYVOICE_TIMEOUT = "cosyvoice.timeout"
COSYVOICE_AUDIO_FORMAT = "cosyvoice.audio_format"
# ========== ComfyUI (Workflow API) 配置 ==========
COMFYUI_SERVER = "comfyui.server"
COMFYUI_INPUT_DIR = "comfyui.input_dir"
COMFYUI_TIMEOUT = "comfyui.timeout"
COMFYUI_DEFAULT_STYLE = "comfyui.default_style"
COMFYUI_STYLES = "comfyui.styles"
# Convenience aliases to split voiceclone/customvoice at the plugin level.
# Both backends still use comfyui.styles, but these keys let you pick different defaults.
COMFYUI_VOICECLONE_DEFAULT_STYLE = "comfyui.voiceclone_default_style"
COMFYUI_CUSTOMVOICE_DEFAULT_STYLE = "comfyui.customvoice_default_style"
COMFYUI_AUDIO_QUALITY = "comfyui.audio_quality"
COMFYUI_MLX_PYTHON = "comfyui.mlx_python"
COMFYUI_MLX_CLI = "comfyui.mlx_cli"
COMFYUI_PAUSE_LINEBREAK = "comfyui.pause_linebreak"
COMFYUI_PERIOD_PAUSE = "comfyui.period_pause"
COMFYUI_COMMA_PAUSE = "comfyui.comma_pause"
COMFYUI_QUESTION_PAUSE = "comfyui.question_pause"
COMFYUI_HYPHEN_PAUSE = "comfyui.hyphen_pause"
# Auto instruct (CustomVoice)
COMFYUI_AUTO_INSTRUCT_ENABLED = "comfyui.auto_instruct_enabled"
COMFYUI_AUTO_INSTRUCT_BASE_TONE = "comfyui.auto_instruct_base_tone"
COMFYUI_AUTO_INSTRUCT_PROMPT = "comfyui.auto_instruct_prompt"
COMFYUI_AUTO_INSTRUCT_MAX_CHARS = "comfyui.auto_instruct_max_chars"