Files
XH-202626/系统部署与运行维护手册_XH-202626.md
T

143 lines
4.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 中国青基会平安励志计划 · 2026竞赛作品
# 《数智风控:AI 科创企业新型风险前瞻治理方案》
## 原型系统部署与运行维护手册 (XH-202626)
---
### 一、 系统概述与体验入口
本系统交付了完备的金融级 Web 风控系统原型,已完成全套生产环境部署与 SSL 证书加密,支持公网在线实时访问与本地一键部署运行。
- **公网加密访问入口**`https://risk.aiformat.cn`
- **公网服务器 IP**`159.75.81.121`
- **技术栈规范**
- **核心语言**Python 3.10+
- **Web 交互框架**Streamlit 1.32+
- **大模型推理引擎**DeepSeek API (`deepseek-chat` 深度推理底座)
- **图谱计算引擎**NetworkX 3.0+ (广度优先 BFS 风险传染算法)
- **可视化组件**Plotly 5.18+ / PyVis 0.3+
- **反向代理与守护**Nginx 1.18+ + Systemd 服务守护 + Let's Encrypt SSL
---
### 二、 本地快速一键运行指南
若评审专家或用户需要在本地环境直接运行本源码系统,请按以下步骤操作:
#### 1. 环境准备
确保本地安装了 **Python 3.10** 或更高版本:
```bash
python --version
```
#### 2. 解压与安装依赖
解压源码包后进入项目根目录,运行依赖安装命令:
```bash
pip install -r requirements.txt
```
#### 3. 配置 DeepSeek 大模型 API Key (可选)
系统默认内置了 DeepSeek 演示 API 接口。如需使用自定义密钥,可打开 `config.py` 文件配置:
```python
DEEPSEEK_API_KEY = "your-deepseek-api-key"
```
#### 4. 一键启动 Web 系统
在终端运行以下命令启动本地交互服务:
```bash
streamlit run 🏠_系统首页.py
```
终端启动成功后,浏览器将自动弹窗并打开系统界面:
`http://localhost:8501`
---
### 三、 服务器生产环境部署规范 (CentOS / Ubuntu)
本系统已在生产服务器 `159.75.81.121` 上完成了生产级部署,配置规范如下:
#### 1. 代码目录结构
```text
/opt/risk_system/
├── 🏠_系统首页.py # 系统控制台大屏入口
├── config.py # 全局参数与风控规则配置
├── requirements.txt # Python 依赖清单
├── pages/ # 4 大业务功能子模块
│ ├── 01_📊_企业风险概览.py
│ ├── 02_🕸️_供应链知识图谱.py
│ ├── 03_🤖_多智能体辩论诊断.py
│ └── 04_💰_动态定价与核保.py
├── risk_engine/ # Multi-Agent 专家辩论与冲突平息引擎
├── knowledge_graph/ # NetworkX 图谱拓扑与 BIS 穿透算法
└── collectors/ # AKShare 财报与网信办/BIS 提取器
```
#### 2. Systemd 服务守护配置 (`/etc/systemd/system/risk_app.service`)
使用 Systemd 实现无人值守自动拉起与宕机自愈:
```ini
[Unit]
Description=Streamlit Risk App Service
After=network.target
[Service]
User=root
WorkingDirectory=/opt/risk_system
ExecStart=/usr/local/bin/streamlit run 🏠_系统首页.py --server.port 8501 --server.headless true
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
```
启动与状态检查命令:
```bash
systemctl daemon-reload
systemctl enable risk_app
systemctl restart risk_app
systemctl status risk_app
```
#### 3. Nginx 反向代理与 WebSocket 连通配置 (`/etc/nginx/conf.d/risk.conf`)
配置文件支持 HTTP(80) 自动强制重定向至 HTTPS(443),并开启 WebSocket 实时推流支持:
```nginx
server {
listen 80;
server_name risk.aiformat.cn;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name risk.aiformat.cn;
ssl_certificate /etc/letsencrypt/live/risk.aiformat.cn/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/risk.aiformat.cn/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8501;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
---
### 四、 提交材料清单 (Checklist)
| 序号 | 材料名称 | 文件类型 | 描述 |
|:---|:---|:---|:---|
| 01 | **研究报告** | `.md` / `.pdf` | 完整的学术研究报告与六维风控理论推导 |
| 02 | **竞赛汇报 PPT** | `.pptx` | 包含 22 页大字架构与 4 大模块实操截图的演示文稿 |
| 03 | **原型系统完整源码** | Python 代码包 | 包含 Agent 辩论、知识图谱、动态精算与 Web 源码 |
| 04 | **部署与运行手册** | `.md` | 本文档,提供本地运行与云服务器守护指引 |
---
*中国青基会平安励志计划 · 2026 挑战杯“揭榜挂帅”擂台赛 XH-202626 课题研发团队*