refactor: 架构缺陷 6-12 修复

6. SECRET_KEY 从硬编码改为环境变量读取,未设置时自动生成随机值
7. 登录时 session 存储 tenant_id,auth_manager 返回用户的 tenant_id
8. 前端共享状态集中声明并添加注释,标注每个状态由哪个模块管理
9. 数据库启动时自动检测并添加缺失的 tenant_id 列(SQLite ADD COLUMN 迁移)
10. Webhook handler 添加文档说明双通道互斥建议
11. LLM chat_completion 添加自动重试(max_retries=2),服务端错误和超时自动重试
12. 知识库向量化器和 Embedding 禁用日志从 INFO 降为 DEBUG,减少噪音
This commit is contained in:
2026-04-02 22:19:56 +08:00
parent 61ef86d779
commit 587933f668
10 changed files with 99 additions and 33 deletions

View File

@@ -193,7 +193,9 @@ def _process_message_in_background(app, event_data: dict):
@feishu_bot_bp.route('/event', methods=['POST'])
def handle_feishu_event():
"""
接收并处理飞书事件回调
接收并处理飞书事件回调Webhook 模式)。
如果系统同时运行了长连接模式,消息去重机制会自动跳过已处理的消息。
建议生产环境只启用一种模式(长连接 OR Webhook避免重复处理。
"""
# 1. 解析请求
data = request.json