基于 OpenViking 构建的投研知识库基础设施,提供语义搜索、LLM 对话、Agent 自主搜索、PDF 解析、语音转录等能力。
外部 Agent / Web UI
│
▼
Gateway (:8191) ─── 统一入口,鉴权,RAG 增强,ReAct Agent
│
├── Key Scheduler (:8850) ─── MiniMax API 负载均衡 (3 key × 65 并发)
│ └── MiniMax API (api.minimaxi.com)
│
├── OV1 (:1933) ─── 主知识库 (21 目录,投资策略/行业研究,NVMe)
│
├── OV2 (:1935) ─── 扩展知识库 (11 目录,研报/纪要/REITs,SSD)
│
├── Embedding (:8480) ─── bge-m3 向量化 (1024 维)
│
├── MinerU (:8888) ─── PDF GPU OCR
│
├── STT (:10095) ─── FunASR 语音转文字
│
└── TTS (:9880) ─── GPT-SoVITS 语音合成
| 组件 | 端口 | 说明 |
|---|---|---|
| Gateway | 8191 | 统一 API 入口,合并 OV1+OV2 搜索,RAG 增强,ReAct Agent |
| Key Scheduler | 8850 | MiniMax API Key 轮转、动态并发控制 (2-65)、15 种 agent 伪装 |
| OV1 | 1933 | OpenViking 主实例,NVMe 存储 |
| OV2 | 1935 | OpenViking 扩展实例,SSD 存储 |
| Embedding | 8480 | bge-m3 向量嵌入服务 |
| MinerU | 8888 | PDF 解析 (OCR + 文本提取) |
| STT | 10095 | FunASR Paraformer 语音识别 |
| TTS | 9880 | GPT-SoVITS 语音合成 |
通过 Gateway (:8191) 统一提供,所有请求需携带 X-API-Key 鉴权。
| 端点 | 用途 |
|---|---|
POST /v1/chat/completions |
LLM 对话(支持 mode: "react" 切换 ReAct 模式) |
POST /v1/agent/search |
ReAct 多轮自主搜索(自动搜索→阅读→评估→再搜索) |
POST /api/v1/search/find |
跨知识库语义搜索(OV1+OV2 合并) |
GET /api/v1/content/read |
读取知识库文档 |
GET /api/v1/fs/ls |
浏览知识库目录(OV1+OV2 合并) |
POST /api/v1/resources |
入库(支持 to/parent 指定目标路径) |
POST /bot/v1/chat |
Bot RAG 对话 |
POST /v1/embeddings |
文本向量化 (bge-m3) |
POST /v1/parse |
PDF 解析 |
POST /v1/audio/transcriptions |
语音转文字 |
GET /v1/tts |
文字转语音 |
Agent 自动分析问题→搜索知识库→阅读文档→评估信息充分性→迭代搜索,最终综合回答。
# 独立端点
curl -X POST http://HOST:8191/v1/agent/search \
-H "X-API-Key: gw-xxx" \
-H "Content-Type: application/json" \
-d '{"query": "REITs投资机会分析", "stream": true, "max_rounds": 6}'
# 或通过 chat 接口
curl -X POST http://HOST:8191/v1/chat/completions \
-H "X-API-Key: gw-xxx" \
-H "Content-Type: application/json" \
-d '{"model":"MiniMax-M2.7-highspeed","messages":[{"role":"user","content":"分析REITs"}],"mode":"react"}'| 脚本 | 说明 |
|---|---|
batch_upload_kb.py |
批量上传文件到知识库(PDF/文本/音频混合,音频自动 STT 转录) |
parallel_pdf_parser.py |
高速并行 PDF 转 Markdown(~1480 文件/分钟) |
nas_cleaner.py |
NAS 文件清洗转换 |
auto_cleanup.py |
OV1 upload 目录自动整理 |
auto_ingest_ov2.py |
OV2 自动入库监控 |
key_scheduler.py |
MiniMax API Key 调度服务 |
manage.sh |
服务管理脚本(start/stop/restart 代理到 systemd --user,status 做统一健康检查) |
当前生产环境默认使用 systemd --user 托管,不再依赖临时 shell 后台进程。
# 启动整套服务
systemctl --user start infra-stack.target
# 停止整套服务
systemctl --user stop infra-stack.target
# 重启整套服务
systemctl --user restart infra-stack.target
# 查看整套服务状态
systemctl --user status infra-stack.target
# 查看某个服务日志
journalctl --user -u infra-gateway.service -f主要 unit:
infra-openviking-ov1.serviceinfra-openviking-ov2.serviceinfra-embedding.serviceinfra-stt.serviceinfra-tts.serviceinfra-mineru.serviceinfra-key-scheduler.serviceinfra-paipai-relay.serviceinfra-mempalace.serviceinfra-sentiment.serviceinfra-gateway.service
补充:
manage.sh status仍可用于统一健康检查manage.sh start|stop|restart仅代理systemd --user,不要再手工python ... &或nohup启同名服务- 用户级
systemd已启用linger,用户退出登录后服务仍会保活
Gateway 内置 Web 界面:
http://HOST:8191/ui/chat?api_key=gw-xxx # LLM Chat(支持传统/ReAct模式切换)
http://HOST:8191/ui/openviking?api_key=gw-xxx # 知识库管理
OV1(NVMe):策略、行业、行业投研、动量股池、混天绫、风火轮、萌、投知君君 等 21 个目录
OV2(SSD):非音视频纪要 2019-2025、Reits、并购优塾-塔尖、调研会议录音 等 11 个目录
详细文档在 docs/ 目录:
| 文档 | 面向 | 内容 |
|---|---|---|
agent-tools-api.md |
Agent 开发者 | API 工具定义、Function Calling 格式、ReAct Agent |
openviking-api-guide.md |
外部用户 | API 使用指南、curl 示例 |
openviking-customizations.md |
内部开发 | 定制化改造记录、Key Scheduler、AgentPool |
ops-manual.md |
运维 | 启停、健康检查、故障排查、配置说明 |
migration-reproducibility.md |
迁移/复现 | GitHub 安全提交、私密配置、数据包和 systemd 复现步骤 |
- 知识库引擎: OpenViking (语义搜索 + AGFS 文件系统)
- 向量模型: bge-m3 (1024 维)
- LLM: MiniMax-M2.7-highspeed (通过 Key Scheduler 负载均衡)
- PDF 解析: MinerU (GPU OCR) + PyMuPDF (快速文本提取)
- 语音: FunASR Paraformer (STT) + GPT-SoVITS (TTS)
- Gateway: FastAPI + httpx
- 运行环境: Python 3.11 (miniconda3/envs/infra)