feat: 租户管理体系建设 CRUD + 各业务模块接入 tenant_id
1. 新增 Tenant 模型(tenants 表),支持租户创建、重命名、删除 2. 新增 /api/tenants CRUD 蓝图,default 租户不可删除 3. 数据库初始化时自动创建默认租户记录 4. Dashboard 新增租户管理标签页(创建/编辑/删除租户) 5. 各业务模块写入数据时正确传递 tenant_id: - realtime_chat: create_session 和 _save_conversation 支持 tenant_id - dialogue_manager: _save_conversation 和 create_work_order 支持 tenant_id - conversation_history: save_conversation 支持 tenant_id - workorder_sync: sync_from_feishu 支持 tenant_id - websocket_server: create_session 传递 tenant_id - HTTP chat API: create_session 传递 tenant_id - feishu_sync API: 同步时传递 tenant_id - workorders API: 创建工单时传递 tenant_id 6. 网页对话入口添加租户选择器 7. 知识库搜索按租户隔离(realtime_chat 中 _search_knowledge 传递 tenant_id) 8. 初始化时自动加载租户列表填充选择器
This commit is contained in:
@@ -92,9 +92,10 @@ def sync_from_feishu():
|
||||
data = request.get_json() or {}
|
||||
generate_ai = data.get('generate_ai_suggestions', True)
|
||||
limit = data.get('limit', 10)
|
||||
tenant_id = data.get('tenant_id')
|
||||
|
||||
sync_service = get_sync_service()
|
||||
result = sync_service.sync_from_feishu(generate_ai_suggestions=generate_ai, limit=limit)
|
||||
result = sync_service.sync_from_feishu(generate_ai_suggestions=generate_ai, limit=limit, tenant_id=tenant_id)
|
||||
|
||||
if result.get("success"):
|
||||
message = f"同步完成:创建 {result['created_count']} 条,更新 {result['updated_count']} 条"
|
||||
|
||||
Reference in New Issue
Block a user