# wjlgraph/fire_agent architecture

> Architecture diagram of the GitHub repository wjlgraph/fire_agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wjlgraph/fire_agent
- Repository: https://github.com/wjlgraph/fire_agent

## Overview

焰哨 FlameSentry 是面向森林火险治理的多智能体决策平台。用户可浏览 GIS 火险大屏，也可输入自然语言，经查询服务得到摘要、表格、图表和地图结果；其他主要路径包括 RAG 文档问答、协作分析生成报告，以及图像识别和语音交互。图保留 README 描述但未在源码摘录中展开的产品能力；这类关系以 README 为证据，未展示的具体内部调用不作推断。

Main entry points: [`fire_agent_back/app/main.py`](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/main.py) (FastAPI 应用), [`fire_agent_back/app/agents/orchestrator_agent.py`](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/orchestrator_agent.py) (任务编排), [`fire_agent_back/app/api/v1/routes/query.py`](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/query.py) (查询接口), [`fire_agent_back/app/repositories/fire_repository.py`](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/repositories/fire_repository.py) (火险数据仓储)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["用户界面"]
  node_dashboard_ui["火险作战大屏<br/>[index.vue]"]
  node_query_ui["智能查询<br/>[index.vue]"]
  node_kb_ui["知识库界面<br/>[index.vue]"]
  node_agent_ui["Agent 中心<br/>[index.vue]"]
  node_report_ui["报告中心<br/>[index.vue]"]
  node_admin_ui["系统管理界面<br/>[index.vue]"]
end

subgraph group_api["API 接入"]
  node_api_entry["FastAPI 应用<br/>[main.py]"]
  node_auth_routes["认证接口<br/>[auth.py]"]
  node_dashboard_routes["大屏接口<br/>[dashboard.py]"]
  node_query_routes["查询接口<br/>[query.py]"]
  node_rag_routes["RAG 接口<br/>[rag.py]"]
  node_agent_routes["Agent 接口<br/>[agent.py]"]
  node_report_routes["报告接口<br/>[report.py]"]
  node_admin_routes["管理接口<br/>[admin.py]"]
  node_media_routes["视觉与语音接口<br/>[media.py]"]
end

subgraph group_domain["查询与知识服务"]
  node_query_service["自然语言查询服务<br/>[query_service.py]"]
  node_rag_service["RAG 文档检索<br/>[rag_service.py]"]
  node_fire_repo["火险数据仓储<br/>[fire_repository.py]"]
end

subgraph group_agents["智能分析"]
  node_orchestrator["任务编排"]
  node_data_agent["数据分析 Agent<br/>[data_agent.py]"]
  node_gis_agent["空间分析 Agent<br/>[gis_agent.py]"]
  node_rag_agent["知识检索 Agent<br/>[rag_agent.py]"]
  node_report_agent["报告生成 Agent<br/>[report_agent.py]"]
end

subgraph group_platform["平台能力"]
  node_auth_security["JWT 与权限<br/>[security.py]"]
  node_database[("业务数据库<br/>[database.py]")]
  node_llm["模型客户端<br/>[llm.py]"]
  node_weather["天气 MCP 服务<br/>[weather_server.py]"]
end

node_user(("业务用户"))
node_admin_actor(("管理员"))
node_model_provider{{"外部模型服务"}}

node_user -->|"浏览火险"| node_dashboard_ui
node_user -->|"提交问题"| node_query_ui
node_user -->|"提问与上传"| node_kb_ui
node_user -->|"发起任务"| node_agent_ui
node_user -->|"查看报告"| node_report_ui
node_admin_actor -->|"管理平台"| node_admin_ui
node_dashboard_ui -->|"请求大屏数据"| node_dashboard_routes
node_query_ui -->|"提交查询"| node_query_routes
node_kb_ui -->|"请求问答"| node_rag_routes
node_agent_ui -->|"提交分析任务"| node_agent_routes
node_report_ui -->|"管理报告"| node_report_routes
node_admin_ui -->|"配置管理"| node_admin_routes
node_api_entry -->|"注册路由"| node_dashboard_routes
node_api_entry -->|"注册路由"| node_query_routes
node_api_entry -->|"注册路由"| node_rag_routes
node_api_entry -->|"注册路由"| node_agent_routes
node_api_entry -->|"注册路由"| node_report_routes
node_api_entry -->|"注册路由"| node_admin_routes
node_api_entry -->|"注册路由"| node_auth_routes
node_api_entry -->|"注册路由"| node_media_routes
node_query_routes -->|"解析并执行"| node_query_service
node_query_service -->|"查询火险数据"| node_fire_repo
node_dashboard_routes -->|"读取大屏数据"| node_fire_repo
node_rag_routes -->|"调用检索问答"| node_rag_service
node_agent_routes -->|"启动任务"| node_orchestrator
node_orchestrator -.->|"委派数据分析"| node_data_agent
node_orchestrator -->|"委派空间分析"| node_gis_agent
node_orchestrator -->|"委派知识检索"| node_rag_agent
node_orchestrator -.->|"委派报告生成"| node_report_agent
node_rag_agent -->|"执行知识检索"| node_rag_service
node_gis_agent -->|"复用空间查询"| node_query_service
node_report_routes -.->|"管理报告记录"| node_database
node_query_routes -->|"保存查询历史"| node_database
node_auth_routes -->|"校验身份"| node_auth_security
node_auth_security -->|"读取用户"| node_database
node_fire_repo -->|"读写火险数据"| node_database
node_media_routes -.->|"调用视觉与语音"| node_llm
node_llm -->|"请求模型"| node_model_provider
node_orchestrator -->|"按需取天气"| node_weather
node_orchestrator -->|"读取分析数据"| node_fire_repo
node_orchestrator -->|"生成与评审"| node_llm

click node_dashboard_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/dashboard/index.vue"
click node_query_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/smart-query/index.vue"
click node_kb_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/knowledge-base/index.vue"
click node_agent_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/agent-center/index.vue"
click node_report_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/report-center/index.vue"
click node_admin_ui "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/admin/index.vue"
click node_api_entry "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/main.py"
click node_auth_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/auth.py"
click node_dashboard_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/dashboard.py"
click node_query_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/query.py"
click node_rag_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/rag.py"
click node_agent_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/agent.py"
click node_report_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/report.py"
click node_admin_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/admin.py"
click node_media_routes "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/media.py"
click node_query_service "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/services/query_service.py"
click node_rag_service "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/services/rag_service.py"
click node_fire_repo "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/repositories/fire_repository.py"
click node_orchestrator "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/orchestrator_agent.py"
click node_data_agent "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/data_agent.py"
click node_gis_agent "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/gis_agent.py"
click node_rag_agent "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/rag_agent.py"
click node_report_agent "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/report_agent.py"
click node_auth_security "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/security.py"
click node_database "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/database.py"
click node_llm "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/llm.py"
click node_weather "https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/mcp_server/weather_server.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard_ui,node_query_ui,node_kb_ui,node_agent_ui,node_report_ui,node_admin_ui toneBlue
class node_api_entry,node_auth_routes,node_dashboard_routes,node_query_routes,node_rag_routes,node_agent_routes,node_report_routes,node_admin_routes,node_media_routes toneAmber
class node_query_service,node_rag_service,node_fire_repo toneMint
class node_orchestrator,node_data_agent,node_gis_agent,node_rag_agent,node_report_agent toneRose
class node_auth_security,node_database,node_llm,node_weather,node_user,node_admin_actor,node_model_provider toneIndigo
```

## Components

### 用户界面

- [火险作战大屏](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/dashboard/index.vue): `fire_agent_front/src/views/dashboard/index.vue`
- [智能查询](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/smart-query/index.vue): `fire_agent_front/src/views/smart-query/index.vue`
- [知识库界面](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/knowledge-base/index.vue): `fire_agent_front/src/views/knowledge-base/index.vue`
- [Agent 中心](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/agent-center/index.vue): `fire_agent_front/src/views/agent-center/index.vue`
- [报告中心](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/report-center/index.vue): `fire_agent_front/src/views/report-center/index.vue`
- [系统管理界面](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_front/src/views/admin/index.vue): `fire_agent_front/src/views/admin/index.vue`

### API 接入

- [FastAPI 应用](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/main.py): `fire_agent_back/app/main.py`
- [认证接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/auth.py): `fire_agent_back/app/api/v1/routes/auth.py`
- [大屏接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/dashboard.py): `fire_agent_back/app/api/v1/routes/dashboard.py`
- [查询接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/query.py): `fire_agent_back/app/api/v1/routes/query.py`
- [RAG 接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/rag.py): `fire_agent_back/app/api/v1/routes/rag.py`
- [Agent 接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/agent.py): `fire_agent_back/app/api/v1/routes/agent.py`
- [报告接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/report.py): `fire_agent_back/app/api/v1/routes/report.py`
- [管理接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/admin.py): `fire_agent_back/app/api/v1/routes/admin.py`
- [视觉与语音接口](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/api/v1/routes/media.py): `fire_agent_back/app/api/v1/routes/media.py`

### 查询与知识服务

- [自然语言查询服务](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/services/query_service.py): `fire_agent_back/app/services/query_service.py`
- [RAG 文档检索](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/services/rag_service.py): `fire_agent_back/app/services/rag_service.py`
- [火险数据仓储](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/repositories/fire_repository.py): `fire_agent_back/app/repositories/fire_repository.py`

### 智能分析

- [任务编排](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/orchestrator_agent.py): `fire_agent_back/app/agents/orchestrator_agent.py`
- [数据分析 Agent](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/data_agent.py): `fire_agent_back/app/agents/data_agent.py`
- [空间分析 Agent](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/gis_agent.py): `fire_agent_back/app/agents/gis_agent.py`
- [知识检索 Agent](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/rag_agent.py): `fire_agent_back/app/agents/rag_agent.py`
- [报告生成 Agent](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/agents/report_agent.py): `fire_agent_back/app/agents/report_agent.py`

### 平台能力

- [JWT 与权限](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/security.py): `fire_agent_back/app/core/security.py`
- [业务数据库](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/database.py): `fire_agent_back/app/core/database.py`
- [模型客户端](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/app/core/llm.py): `fire_agent_back/app/core/llm.py`
- [天气 MCP 服务](https://github.com/wjlgraph/fire_agent/blob/main/fire_agent_back/mcp_server/weather_server.py): `fire_agent_back/mcp_server/weather_server.py`

### Other components

- **业务用户**
- **管理员**
- **外部模型服务**

## Connections

- 业务用户 → 火险作战大屏: 浏览火险
- 业务用户 → 智能查询: 提交问题
- 业务用户 → 知识库界面: 提问与上传
- 业务用户 → Agent 中心: 发起任务
- 业务用户 → 报告中心: 查看报告
- 管理员 → 系统管理界面: 管理平台
- 火险作战大屏 → 大屏接口: 请求大屏数据
- 智能查询 → 查询接口: 提交查询
- 知识库界面 → RAG 接口: 请求问答
- Agent 中心 → Agent 接口: 提交分析任务
- 报告中心 → 报告接口: 管理报告
- 系统管理界面 → 管理接口: 配置管理
- FastAPI 应用 → 大屏接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → 查询接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → RAG 接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → Agent 接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → 报告接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → 管理接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → 认证接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- FastAPI 应用 → 视觉与语音接口: 注册路由 (evidence: `fire_agent_back/app/main.py`)
- 查询接口 → 自然语言查询服务: 解析并执行 (evidence: `fire_agent_back/app/api/v1/routes/query.py`)
- 自然语言查询服务 → 火险数据仓储: 查询火险数据 (evidence: `fire_agent_back/app/services/query_service.py`)
- 大屏接口 → 火险数据仓储: 读取大屏数据 (evidence: `fire_agent_back/app/api/v1/routes/dashboard.py`)
- RAG 接口 → RAG 文档检索: 调用检索问答 (evidence: `fire_agent_back/app/api/v1/routes/rag.py`)
- Agent 接口 → 任务编排: 启动任务 (evidence: `fire_agent_back/app/api/v1/routes/agent.py`)
- 任务编排 → 数据分析 Agent: 委派数据分析
- 任务编排 → 空间分析 Agent: 委派空间分析 (evidence: `fire_agent_back/app/agents/orchestrator_agent.py`)
- 任务编排 → 知识检索 Agent: 委派知识检索 (evidence: `fire_agent_back/app/agents/orchestrator_agent.py`)
- 任务编排 → 报告生成 Agent: 委派报告生成
- 知识检索 Agent → RAG 文档检索: 执行知识检索 (evidence: `fire_agent_back/app/agents/rag_agent.py`)
- 空间分析 Agent → 自然语言查询服务: 复用空间查询 (evidence: `fire_agent_back/app/agents/gis_agent.py`)
- 报告接口 → 业务数据库: 管理报告记录
- 查询接口 → 业务数据库: 保存查询历史 (evidence: `fire_agent_back/app/api/v1/routes/query.py`)
- 认证接口 → JWT 与权限: 校验身份 (evidence: `fire_agent_back/app/api/v1/routes/auth.py`)
- JWT 与权限 → 业务数据库: 读取用户 (evidence: `fire_agent_back/app/core/security.py`)
- 火险数据仓储 → 业务数据库: 读写火险数据 (evidence: `fire_agent_back/app/repositories/fire_repository.py`)
- 视觉与语音接口 → 模型客户端: 调用视觉与语音 (evidence: `fire_agent_back/app/api/v1/routes/media.py`)
- 模型客户端 → 外部模型服务: 请求模型 (evidence: `fire_agent_back/app/core/llm.py`)
- 任务编排 → 天气 MCP 服务: 按需取天气 (evidence: `fire_agent_back/app/agents/orchestrator_agent.py`)
- 任务编排 → 火险数据仓储: 读取分析数据 (evidence: `fire_agent_back/app/agents/orchestrator_agent.py`)
- 任务编排 → 模型客户端: 生成与评审 (evidence: `fire_agent_back/app/agents/orchestrator_agent.py`)
