7ef266e4a0
实现AI问答的function call功能,支持调用系统接口进行查询。 改动内容: 1. 数据库扩展: - 在ai_chat_messages表增加tool_calls和tool_call_id字段 - 创建数据库迁移文件 2. 模型和Schema更新: - AiChatMessage模型增加tool_calls(JSON)和tool_call_id字段 - AiChatMessageSummary schema增加对应字段 3. Function Call实现: - 定义4个可调用函数:query_tower_models、query_lines、query_users、query_system_params - 实现_execute_function处理函数调用并返回格式化结果 - 更新_call_openai_api支持tools参数 4. 消息流程更新: - 重构send_message支持完整的function call流程 - 流程:用户消息 -> AI请求function call -> 执行函数 -> AI基于结果回复 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
API Service
FastAPI 后端服务,包含用户认证和 RBAC 权限控制。
核心能力
- JWT Access Token(默认 8 小时)
- Refresh Session(HttpOnly Cookie,默认 30 天,刷新轮换)
- RBAC(用户-角色-权限)
- 用户管理接口(需
user.manage)
本地开发
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -r api/requirements.txt
python -m uvicorn api.app.main:app --reload --host 0.0.0.0 --port 8000
主要接口
GET /healthGET /api/v1/pingPOST /api/v1/auth/registerPOST /api/v1/auth/loginPOST /api/v1/auth/refreshPOST /api/v1/auth/logoutGET /api/v1/auth/meGET /api/v1/users