docs: update all agent md files with latest architecture
- Container App URLs (not Web App) - ACR in AuthData resource group - 5 sub-agents (enterprise/searcher/coder/writer/generalInput) - New components (web-read-progress, force-summary) - Logs unified to AuthData/LoGSOC + SOC Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
257a4412aa
commit
ac16f38821
@@ -33,24 +33,23 @@ tools:
|
||||
## 项目信息
|
||||
|
||||
- **项目根路径**: `/Users/gongzhiyong/go/SOC/`
|
||||
- **后端路径**: `/Users/gongzhiyong/go/SOC/backend/`
|
||||
- **前端路径**: `/Users/gongzhiyong/go/SOC/frontend/`(只读,未经明确指定不允许修改)
|
||||
- **代码路径**: `/Users/gongzhiyong/go/SOC/langgraph/`
|
||||
- **前端代码**: `/Users/gongzhiyong/go/SOC/langgraph/src/`(前端相关只读)
|
||||
- **GitHub**: https://github.com/Fasthei/so-c-chat-clone(main 分支)
|
||||
- **设计文档**: `/Users/gongzhiyong/go/SOC/gpthd.md`(完整功能方案,开发前必读)
|
||||
- **后端 URL**: https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
- **前端 URL**: https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
|
||||
## 技术栈
|
||||
|
||||
### 核心框架
|
||||
- **LangChain** — 模型调用、Prompt 组织、Tool 封装、Memory 适配
|
||||
- **LangGraph** — 对话状态机、工具路由、任务编排、长链路执行
|
||||
- **LangGraph.js** — Agent 状态机、工具路由、Gen-UI 卡片推送
|
||||
- **LangChain.js** — LLM 调用、Tool binding
|
||||
|
||||
### 数据层
|
||||
- **PostgreSQL** — 会话/消息/工具调用/任务持久化(`dataope.postgres.database.azure.com`)
|
||||
- **Redis** — 缓存、短状态、限流(Azure Redis,Operation 资源组)
|
||||
- **Azure Blob Storage** — 附件、产物、文档存储(Operation 资源组)
|
||||
- **Azure Service Bus** — 异步任务编排(Operation 资源组)
|
||||
- **SQLAlchemy / SQLModel** — ORM
|
||||
- **Alembic** — 迁移管理
|
||||
- **Redis** — 缓存(Azure Redis,AuthData 资源组 oper.redis.cache.windows.net)
|
||||
- **Azure Blob Storage** — 附件存储(AuthData 资源组)
|
||||
- **Azure Service Bus** — 异步告警(AuthData 资源组 databus.servicebus.windows.net)
|
||||
|
||||
### AI 与搜索
|
||||
- **Azure OpenAI** — LLM 生成与总结(gpt-5.4)
|
||||
|
||||
@@ -40,30 +40,40 @@ tools:
|
||||
## 当前部署架构
|
||||
|
||||
### 后端 (soc-langgraph)
|
||||
- **Azure Web App**: soc-langgraph (Node.js 20, Southeast Asia, Operation 资源组)
|
||||
- **App Service Plan**: soc-langgraph-plan (B1 Linux)
|
||||
- **URL**: https://soc-langgraph.azurewebsites.net
|
||||
- **WEBSITES_PORT**: 2024
|
||||
- **启动命令**: `bash startup.sh` → pnpm install + langgraphjs dev --port $PORT
|
||||
- **Azure Container App**: soc-langgraph (Operation 资源组, Southeast Asia)
|
||||
- **Container App Environment**: soc-cae (Operation 资源组)
|
||||
- **URL**: https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
- **容器镜像**: socsocacr.azurecr.io/soc-langgraph:latest
|
||||
- **ACR**: socsocacr (Basic, Southeast Asia, Operation 资源组)
|
||||
- **ACR**: socsocacr (Basic, Southeast Asia, **AuthData 资源组**) ← 注意不是 Operation!
|
||||
- **副本**: min 1 / max 3, CPU 1.0, Memory 2Gi
|
||||
|
||||
### 前端 (soc-langgraph-ui)
|
||||
- **Azure Static Web App**: soc-langgraph-ui (East Asia)
|
||||
- **URL**: https://salmon-mushroom-0d8872e00.7.azurestaticapps.net
|
||||
- **Azure Static Web App**: soc-langgraph-ui (East Asia, Operation 资源组)
|
||||
- **URL**: https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
- **构建**: pnpm vite build → dist/ upload
|
||||
|
||||
### 日志与监控
|
||||
- **Log Analytics Workspace**: LoGSOC (**AuthData 资源组**)
|
||||
- **Application Insights**: SOC (**AuthData 资源组**)
|
||||
- Container App 和所有服务的日志统一写入 AuthData/LoGSOC
|
||||
|
||||
### CI/CD
|
||||
| Workflow | 触发条件 | 部署方式 |
|
||||
|----------|---------|---------|
|
||||
| `deploy-langgraph.yml` | push to main, paths langgraph/** | ACR cloud build → Web App container update → restart |
|
||||
| `deploy-langgraph.yml` | push to main, paths langgraph/** | ACR cloud build (--resource-group **AuthData**) → Container App update |
|
||||
| `deploy-langgraph-ui.yml` | push to main, paths langgraph/** | pnpm vite build → SWA upload |
|
||||
|
||||
### 认证
|
||||
- **OIDC**: azure/login@v2 + Federated Identity (oidc-msi-8ac6, Operation 资源组 Contributor)
|
||||
- **OIDC**: azure/login@v2 + Federated Identity (oidc-msi-8ac6, Operation + AuthData 资源组 Contributor)
|
||||
- **SWA Token**: secrets.SWA_LANGGRAPH_TOKEN
|
||||
- **ACR**: socsocacr admin credentials
|
||||
|
||||
### ⚠️ 关键注意事项
|
||||
- **ACR `socsocacr` 在 AuthData 资源组**,`az acr build` 必须用 `--resource-group AuthData`
|
||||
- **Container App 在 Operation 资源组**,`az containerapp update` 用 `--resource-group Operation`
|
||||
- **OIDC 服务主体**需要同时拥有 Operation 和 AuthData 两个资源组的 Contributor 角色
|
||||
- **已废弃的旧 Web App (soc-langgraph) 和 App Service Plan (soc-langgraph-plan) 已删除**
|
||||
|
||||
## 环境变量清单
|
||||
|
||||
后端 Web App 需配置的环境变量:
|
||||
@@ -95,13 +105,15 @@ WEBSITES_PORT=2024
|
||||
|
||||
前端 Vite build-time 环境变量:
|
||||
```
|
||||
VITE_LANGGRAPH_URL=https://soc-langgraph.azurewebsites.net
|
||||
VITE_LANGGRAPH_URL=https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
```
|
||||
|
||||
## 已废弃(已删除)
|
||||
- soc-backend (Python Web App)
|
||||
- soc-frontend (旧 Static Web App)
|
||||
- Container App soc-langgraph + soc-cae
|
||||
- soc-langgraph (旧 Azure Web App + App Service Plan)
|
||||
- workspace-perationIZVj (旧 Log Analytics)
|
||||
- soc-backend / soc-langgraph / soc-langgraph-insights (旧 Application Insights)
|
||||
|
||||
## 核心职责
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ tools:
|
||||
- **代码路径**: `/Users/gongzhiyong/go/SOC/langgraph/`
|
||||
- **前端入口**: `src/main.tsx`
|
||||
- **Gen-UI 卡片**: `src/agent-uis/enterprise/`(5 个组件)
|
||||
- **后端 URL (生产)**: `https://soc-langgraph.azurewebsites.net`
|
||||
- **前端 URL (生产)**: `https://salmon-mushroom-0d8872e00.7.azurestaticapps.net`
|
||||
- **后端 URL (生产)**: `https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io`
|
||||
- **前端 URL (生产)**: `https://agreeable-smoke-0364d4000.7.azurestaticapps.net`
|
||||
- **GitHub**: https://github.com/Fasthei/so-c-chat-clone(main 分支)
|
||||
|
||||
## 技术栈
|
||||
@@ -68,7 +68,8 @@ langgraph/
|
||||
│ ├── ticket-summary/index.tsx ← 工单列表摘要
|
||||
│ ├── ticket-detail/index.tsx ← 工单详情
|
||||
│ ├── search-result/index.tsx ← 网络搜索结果
|
||||
│ └── sandbox-result/index.tsx ← 沙盒执行结果
|
||||
│ ├── sandbox-result/index.tsx ← 沙盒执行结果
|
||||
│ └── web-read-progress/index.tsx ← 网页阅读进度
|
||||
├── src/components/ ← 通用 UI 组件
|
||||
├── src/lib/ ← 工具函数
|
||||
├── index.html ← HTML 模板
|
||||
@@ -87,12 +88,13 @@ langgraph/
|
||||
| `ticket-detail` | id, title, status, priority, customer, engineer, created, description | 工单详情 |
|
||||
| `search-result` | query, total, results[] | 网络搜索 |
|
||||
| `sandbox-result` | language, exit_code, stdout, has_more, duration_ms | 沙盒执行 |
|
||||
| `web-read-progress` | card_id, status, current_url, pages[], sourceType, confidence | 网页阅读进度 |
|
||||
|
||||
## 构建和部署
|
||||
|
||||
```bash
|
||||
cd langgraph
|
||||
VITE_LANGGRAPH_URL=https://soc-langgraph.azurewebsites.net pnpm vite build
|
||||
VITE_LANGGRAPH_URL=https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io pnpm vite build
|
||||
# Output: langgraph/dist/ → Azure Static Web Apps
|
||||
```
|
||||
|
||||
|
||||
@@ -30,22 +30,29 @@ tools:
|
||||
- **项目根路径**: `/Users/gongzhiyong/go/SOC/`
|
||||
- **代码路径**: `/Users/gongzhiyong/go/SOC/langgraph/`
|
||||
- **GitHub**: https://github.com/Fasthei/so-c-chat-clone(main 分支)
|
||||
- **后端 URL**: https://soc-langgraph.azurewebsites.net
|
||||
- **后端 URL**: https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
- **前端 URL**: https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
|
||||
## 技术栈(AI 相关)
|
||||
|
||||
### Agent 架构
|
||||
```
|
||||
Supervisor (Gemini 2.0 Flash) → router → route to enterprise or generalInput
|
||||
Enterprise Agent (Azure OpenAI gpt-5.4) → bindTools → call tools → ui.push() → final LLM answer
|
||||
Supervisor (Gemini 2.0 Flash) → router
|
||||
├── enterprise → KB + 工单(ReAct, MAX_ITERATIONS=6)
|
||||
├── searcher → Google + Jina 搜索 + web_read(ReAct, MAX_ITERATIONS=3, force-summary)
|
||||
├── coder → Daytona 沙盒(ReAct, MAX_ITERATIONS=5)
|
||||
├── writer → Canvas 文档 + 报告 + 草稿
|
||||
└── generalInput → 通用对话
|
||||
```
|
||||
|
||||
### 关键文件
|
||||
- **Supervisor router**: `src/agent/supervisor/nodes/router.ts` — Gemini Flash 意图路由
|
||||
- **Enterprise tools node**: `src/agent/enterprise/nodes/tools.ts` — 工具调用 + Gen-UI
|
||||
- **Tool schemas**: 同文件内 Zod schemas(kbSearchSchema 等)
|
||||
- **System prompt**: `tools.ts` 内 LLM invoke 的 system message
|
||||
- **Enterprise agent+tool-executor**: `src/agent/enterprise/nodes/agent.ts` + `tool-executor.ts`
|
||||
- **Searcher agent+tool-executor**: `src/agent/searcher/nodes/agent.ts` + `tool-executor.ts` + `force-summary.ts`
|
||||
- **Writer/Coder**: `src/agent/writer/` + `src/agent/coder/`
|
||||
- **外部 API 客户端**: `src/agent/enterprise/tools/soc-client.ts`
|
||||
- **工具配置(超时/重试)**: `src/agent/utils/toolConfig.ts`
|
||||
- **HTTP 中间件(安全头过滤)**: `src/agent/http.ts`
|
||||
|
||||
### LLM 配置
|
||||
- **Supervisor**: Gemini 2.0 Flash(路由分类,低延迟)
|
||||
|
||||
@@ -39,8 +39,8 @@ tools:
|
||||
|
||||
## 线上地址
|
||||
|
||||
- **后端 LangGraph Server**: https://soc-langgraph.azurewebsites.net
|
||||
- **前端 Static Web App**: https://salmon-mushroom-0d8872e00.7.azurestaticapps.net
|
||||
- **后端 Container App**: https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
- **前端 Static Web App**: https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
|
||||
## 测试端点
|
||||
|
||||
@@ -57,12 +57,12 @@ GET /threads/{id} ← 线程详情
|
||||
### SSE 流式调用测试
|
||||
```bash
|
||||
# 通用对话(路由到 generalInput)
|
||||
curl -N --max-time 60 https://soc-langgraph.azurewebsites.net/runs/stream \
|
||||
curl -N --max-time 60 https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io/runs/stream \
|
||||
-X POST -H "Content-Type: application/json" \
|
||||
-d '{"assistant_id":"agent","input":{"messages":[{"role":"user","content":"你好"}]},"stream_mode":["messages","updates"]}'
|
||||
|
||||
# Enterprise Agent(路由到 enterprise)
|
||||
curl -N --max-time 60 https://soc-langgraph.azurewebsites.net/runs/stream \
|
||||
curl -N --max-time 60 https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io/runs/stream \
|
||||
-X POST -H "Content-Type: application/json" \
|
||||
-d '{"assistant_id":"agent","input":{"messages":[{"role":"user","content":"查询最近的工单"}]},"stream_mode":["messages","updates"]}'
|
||||
```
|
||||
@@ -80,11 +80,11 @@ curl -N --max-time 60 https://soc-langgraph.azurewebsites.net/runs/stream \
|
||||
### 前端测试
|
||||
```bash
|
||||
# 页面可访问
|
||||
curl -s -o /dev/null -w "%{http_code}" https://salmon-mushroom-0d8872e00.7.azurestaticapps.net
|
||||
curl -s -o /dev/null -w "%{http_code}" https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
|
||||
# CORS(前端→后端)
|
||||
curl -s -X OPTIONS https://soc-langgraph.azurewebsites.net/ok \
|
||||
-H "Origin: https://salmon-mushroom-0d8872e00.7.azurestaticapps.net" \
|
||||
curl -s -X OPTIONS https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io/ok \
|
||||
-H "Origin: https://agreeable-smoke-0364d4000.7.azurestaticapps.net" \
|
||||
-H "Access-Control-Request-Method: POST" \
|
||||
-D -
|
||||
```
|
||||
@@ -97,8 +97,8 @@ curl -s -X OPTIONS https://soc-langgraph.azurewebsites.net/ok \
|
||||
# SOC 部署复测报告
|
||||
|
||||
## 测试环境
|
||||
- 后端: https://soc-langgraph.azurewebsites.net
|
||||
- 前端: https://salmon-mushroom-0d8872e00.7.azurestaticapps.net
|
||||
- 后端: https://soc-langgraph.victorioussand-69befc84.southeastasia.azurecontainerapps.io
|
||||
- 前端: https://agreeable-smoke-0364d4000.7.azurestaticapps.net
|
||||
- 测试时间: YYYY-MM-DD
|
||||
|
||||
## 测试结果汇总
|
||||
|
||||
Reference in New Issue
Block a user