feat: 企微菜单新增 AI 分析开关 + 白名单控制

- 新增 ai_whitelist 配置项,仅白名单用户可操作 AI 开关
- 新增 app/services/ai_state.py 运行时开关模块
- 系统管理菜单新增「AI 分析」按钮 (toggle_ai)
- 监控配置、系统状态显示 AI 状态和 AI 标记统计
- pipeline 改用运行时开关 is_ai_enabled()
This commit is contained in:
2026-05-26 16:02:26 +08:00
parent 68215aa804
commit a51161b5f3
6 changed files with 122 additions and 4 deletions
+3 -2
View File
@@ -3,6 +3,7 @@ from typing import Any
from app.config import settings
from app.crawler.base import PipelineConfig, PipelineResult
from app.services.ai_state import is_ai_enabled
from app.services.filter_service import dedup_by_hash
logger = logging.getLogger(__name__)
@@ -45,8 +46,8 @@ class PostCrawlPipeline:
if to_notify:
to_notify = await self._exclude_sent(to_notify)
# 5.5 AI 分析(可选)
if settings.ai_enabled and to_notify:
# 5.5 AI 分析(可选,支持运行时开关
if is_ai_enabled() and to_notify:
await self._ai_analyze(to_notify)
# 6. Notify