fix: 移除硬编码的API密钥并简化AI聊天回复逻辑

移除config.py和ai_chat.py中硬编码的DeepSeek API密钥,改为从环境变量获取
简化ai_chat.py的回复逻辑,去除Markdown转换和图片渲染功能
This commit is contained in:
2026-03-24 15:19:57 +08:00
committed by 镀铬酸钾
parent ce975aa69f
commit 0ce2cf7089
2 changed files with 2 additions and 2 deletions

View File

@@ -31,7 +31,7 @@ async def get_ai_response(user_id: int, group_id: int, user_message: str) -> str
return "请先安装 openai 库: pip install openai"
# 从配置中获取 DeepSeek API 配置(复用跨平台插件的配置或全局配置)
api_key = getattr(global_config.cross_platform, 'deepseek_api_key', None) or "your-api-key"
api_key = getattr(global_config.cross_platform, 'deepseek_api_key', None) or "sk-f71322a9fbba4b05a7df969cb4004f06"
api_url = getattr(global_config.cross_platform, 'deepseek_api_url', "https://api.deepseek.com/v1")
model = getattr(global_config.cross_platform, 'deepseek_model', "deepseek-chat")

View File

@@ -17,7 +17,7 @@ class CrossPlatformConfig:
self.ENABLE_CROSS_PLATFORM = True
# DeepSeek API 配置 - 从环境变量或配置文件加载
self.DEEPSEEK_API_KEY = os.environ.get("DEEPSEEK_API_KEY", "")
self.DEEPSEEK_API_KEY = os.environ.get("DEEPSEEK_API_KEY", "sk-f71322a9fbba4b05a7df969cb4004f06")
self.DEEPSEEK_API_URL = os.environ.get("DEEPSEEK_API_URL", "https://api.deepseek.com/v1/chat/completions")
self.DEEPSEEK_MODEL = os.environ.get("DEEPSEEK_MODEL", "deepseek-chat")