chore(database): 优化镜像配置与部分 SQLite 残留

This commit is contained in:
Wenjie Zhang 2026-01-22 12:48:52 +08:00
parent 3b903bcef4
commit d538527e7a
9 changed files with 27 additions and 36 deletions

View File

@ -16,6 +16,7 @@ services:
- .env.prod
environment:
- HOST_IP=${HOST_IP:-}
- POSTGRES_URL=${POSTGRES_URL:-postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-yuxi_know}}
- NEO4J_URI=${NEO4J_URI:-bolt://graph:7687}
- NEO4J_USERNAME=${NEO4J_USERNAME:-neo4j}
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-0123456789}
@ -150,6 +151,27 @@ services:
- app-network
restart: unless-stopped
postgres:
image: postgres:16
container_name: postgres
ports:
- "5432:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER:-postgres}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
- POSTGRES_DB=${POSTGRES_DB:-yuxi_know}
- TZ=${TZ:-Asia/Shanghai}
volumes:
- ./docker/volumes/postgresql:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-yuxi_know} || exit 1"]
interval: 5s
timeout: 3s
retries: 30
networks:
- app-network
restart: unless-stopped
mineru-vllm-server:
build:
context: .

View File

@ -28,9 +28,7 @@ services:
# region api_envs
environment:
- HOST_IP=${HOST_IP:-}
# - DATABASE_URL=postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-yuxi_know}
# 知识库元数据数据库连接(独立于用户数据库)
- YUXI_KNOWLEDGE_DATABASE_URL=${YUXI_KNOWLEDGE_DATABASE_URL:-postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-yuxi_know}}
- POSTGRES_URL=${POSTGRES_URL:-postgresql+asyncpg://${POSTGRES_USER:-postgres}:${POSTGRES_PASSWORD:-postgres}@postgres:5432/${POSTGRES_DB:-yuxi_know}}
- NEO4J_URI=${NEO4J_URI:-bolt://graph:7687}
- NEO4J_USERNAME=${NEO4J_USERNAME:-neo4j}
- NEO4J_PASSWORD=${NEO4J_PASSWORD:-0123456789}
@ -45,7 +43,7 @@ services:
- NO_PROXY=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio,mineru,paddlex,api.siliconflow.cn
- no_proxy=localhost,127.0.0.1,milvus,graph,milvus-minio,milvus-etcd-dev,etcd,minio,mineru,paddlex,api.siliconflow.cn
# endregion api_envs
command: uv run --no-dev uvicorn server.main:app --host 0.0.0.0 --port 5050 # --reload
command: uv run --no-dev uvicorn server.main:app --host 0.0.0.0 --port 5050 --reload
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:5050/api/system/health || exit 1"]
@ -184,17 +182,6 @@ services:
- app-network
restart: unless-stopped
sqlite-web:
image: coleifer/sqlite-web:latest
container_name: sqlite-web
volumes:
- ./saves/database:/data
ports:
- "9092:8080"
environment:
SQLITE_DATABASE: server.db
restart: unless-stopped
postgres:
image: postgres:16
container_name: postgres

View File

@ -42,10 +42,10 @@
| **7474/7687** | Neo4j | graph | 图数据库 |
| **9000/9001** | MinIO | milvus-minio | 对象存储 |
| **19530/9091** | Milvus | milvus | 向量数据库 |
| **5432** | postgres | postgres | PostgreSQL 数据库 |
| **30000** | MinerU | mineru | PDF 解析(可选)|
| **8080** | PP-StructureV3 | paddlex-ocr | OCR 服务(可选)|
| **8081** | vLLM | - | 本地推理(可选)|
| **9092** | SQLite Web UI | sqlite-web | SQLite 数据库管理界面(可选)|
::: tip 端口访问
- Web 界面: `http://localhost:5173`

View File

@ -35,7 +35,6 @@
- 优化 RAG 检索,支持根据文件 pattern 来检索Agentic Mode
- 重构智能体对于“工具变更/模型变更”的处理逻辑,无需导入更复杂的中间件
- 重构知识库的 Agentic 配置逻辑,与 Tools 解耦
- 新增Sqlite Web UI 方便通过Web页面管理数据库中数据[#463](https://github.com/xerrors/Yuxi-Know/pull/463)
- 将工具与知识库解耦,在 context 中就完成解耦,虽然最终都是在 Agent 中的 get_tools 中获取
- 优化chunk逻辑移除 QA 分割,集成到普通分块中,并优化可视化逻辑
- 重构知识库处理逻辑,分为 上传—解析—入库 三个阶段

View File

@ -8,7 +8,7 @@ Yuxi-Know语析是一个基于知识图谱和向量数据库的智能知
- **后端服务**: [FastAPI](https://github.com/tiangolo/fastapi) + Python 3.12+
- **前端界面**: [Vue.js 3](https://github.com/vuejs/vue) + [Ant Design Vue](https://github.com/vueComponent/ant-design-vue)
- **数据库存储**: [SQLite](https://github.com/sqlite/sqlite) + [MinIO](https://github.com/minio/minio)
- **数据库存储**: [PostgreSQL](https://github.com/postgres/postgres) + [MinIO](https://github.com/minio/minio)
- **知识存储**: [Milvus](https://github.com/milvus-io/milvus)(向量数据库)+ [Neo4j](https://github.com/neo4j/neo4j)(图数据库)
- **智能体框架**: [LangGraph](https://github.com/langchain-ai/langgraph)
- **文档解析**: [LightRAG](https://github.com/HKUDS/LightRAG) + [MinerU](https://github.com/HKUDS/MinerU) + [PP-Structure-V3](https://github.com/PaddlePaddle/PaddleOCR)

View File

@ -9,7 +9,6 @@ from typing import Annotated, get_args, get_origin
import yaml
from src import config as sys_config
from src.knowledge import knowledge_base
from src.services.mcp_service import get_mcp_server_names
from src.utils import logger

View File

@ -28,7 +28,7 @@ class PostgresManager(metaclass=SingletonMeta):
"""PostgreSQL 数据库管理器 - 支持知识库和业务数据"""
# 知识库 PostgreSQL URL 环境变量名
KB_DATABASE_URL_ENV = "YUXI_KNOWLEDGE_DATABASE_URL"
KB_DATABASE_URL_ENV = "POSTGRES_URL"
def __init__(self):
self.async_engine = None

View File

@ -8,8 +8,6 @@ TEST_BASE_URL=http://localhost:5050
TEST_USERNAME=
TEST_PASSWORD=
# 数据库连接(如果需要)
# DATABASE_URL=sqlite:///test.db
# 其他测试相关配置
# ENABLE_DEBUG=true

View File

@ -146,20 +146,6 @@
访问
</a-button>
</div>
<div class="service-link-card">
<div class="service-info">
<h4>SQLite WebUI</h4>
<p>SQLite 数据库管理界面</p>
</div>
<a-button
type="default"
@click="openLink('http://localhost:9092/')"
:icon="h(GlobalOutlined)"
>
访问
</a-button>
</div>
</div>
</div>
</div>