# 平台资料 ## 工单平台(Gitea) | 项目 | 值 | |------|-----| | 平台 | Gitea 1.25.2 | | 地址 | http://101.43.95.130:3001 | | 用户名 | admin | | 密码 | 123456 | | 仓库 | admin/aiagent | | 工单页 | http://101.43.95.130:3001/admin/aiagent/issues | | 分支 | rjb_win_dev | | API Token | `fbc9ee7f96635793f4844187eac5c0e573480721` | | API 文档 | http://101.43.95.130:3001/api/swagger | ## 项目(aiagent) | 项目 | 值 | |------|-----| | 名称 | 天工智能体平台 | | 前端 | `D:\aaa\aiagent\frontend` (Vue 3 + Vite + Element Plus) | | 后端 | `D:\aaa\aiagent\backend` (FastAPI + SQLAlchemy + Celery) | | 前端端口 | 3001 (Vite dev) | | 后端端口 | 8037 (Uvicorn) | ## 测试账号 | 项目 | 值 | |------|-----| | 用户名 | admin | | 密码 | 123456 | | 角色 | 管理员 | ## 前端项目结构 ``` frontend/src/ ├── api/index.ts # API 封装 (axios),DEV 走 Vite 代理到 8037 ├── main.ts # 入口 ├── router/index.ts # 路由 (/agent-chat, /agents, /workflow 等) ├── stores/ │ ├── agent.ts # Agent Store (Pinia) │ ├── user.ts # 用户 Store │ └── ... ├── views/ │ ├── AgentChat.vue # Agent 对话页 (核心) │ ├── AgentConfig.vue # Agent 配置页 │ ├── Agents.vue # Agent 列表 │ └── ... └── components/ ├── AgentChatPreview.vue # Agent 预览对话组件 └── ... ``` ## 后端项目结构 ``` backend/app/ ├── main.py # FastAPI 入口 ├── api/ │ ├── agent_chat.py # Agent 对话 API │ ├── agents.py # Agent CRUD API │ ├── auth.py # 认证 API (login/register) │ └── ... ├── agent_runtime/ │ ├── core.py # Agent 运行时核心 │ ├── context.py # 上下文管理 │ ├── memory.py # 记忆系统 │ └── orchestrator.py # 多 Agent 编排 ├── core/ │ ├── config.py # 配置 │ ├── database.py # 数据库 (MySQL) │ └── error_handler.py # 异常处理 └── models/ # SQLAlchemy 模型 ``` ## API 端点(agent-chat 相关) | 方法 | 路径 | 说明 | |------|------|------| | POST | `/api/v1/agent-chat/bare` | 默认 Agent 对话(无配置) | | POST | `/api/v1/agent-chat/bare/stream` | 默认 Agent 流式对话(SSE) | | POST | `/api/v1/agent-chat/{agent_id}` | 指定 Agent 对话 | | POST | `/api/v1/agent-chat/{agent_id}/stream` | 指定 Agent 流式对话(SSE) | | POST | `/api/v1/agent-chat/orchestrate` | 多 Agent 编排 | | GET | `/api/v1/agents` | Agent 列表 | | GET | `/api/v1/agents/{id}` | Agent 详情 | | POST | `/api/v1/auth/login` | 登录(form-encoded) | ## 快速验证命令 ```bash # 登录获取 token curl -s -X POST http://localhost:8037/api/v1/auth/login \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'username=admin&password=123456' # 测试 bare 对话 curl -s -X POST http://localhost:8037/api/v1/agent-chat/bare \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"message":"你好"}' # 测试流式对话 curl -s -X POST http://localhost:8037/api/v1/agent-chat/bare/stream \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{"message":"你好"}' ``` ## SSH / Git | 项目 | 值 | |------|-----| | SSH Clone | `ssh://git@101.43.95.130:222/admin/aiagent.git` | | HTTP Clone | `http://101.43.95.130:3001/admin/aiagent.git` |