env update
This commit is contained in:
parent
8ef114c304
commit
be0801dce8
1
.python-version
Normal file
1
.python-version
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.11
|
||||||
131
docker-compose.yml
Normal file
131
docker-compose.yml
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
services:
|
||||||
|
api:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/api.Dockerfile
|
||||||
|
container_name: api-dev
|
||||||
|
working_dir: /app
|
||||||
|
volumes:
|
||||||
|
- ./server:/app/server
|
||||||
|
- ./src:/app/src
|
||||||
|
- ./saves_dev:/app/saves
|
||||||
|
# - ${MODEL_DIR}:/models # 如果出现 undefined volume MODEL_DIR: invalid compose project,请添加此环境变量或者注释此行
|
||||||
|
ports:
|
||||||
|
- "5050:5050"
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
extra_hosts:
|
||||||
|
- "host.docker.internal:host-gateway"
|
||||||
|
environment:
|
||||||
|
- NEO4J_URI=bolt://graph:7687
|
||||||
|
- NEO4J_USERNAME=neo4j
|
||||||
|
- NEO4J_PASSWORD=0123456789
|
||||||
|
- MILVUS_URI=http://milvus:19530
|
||||||
|
- MODEL_DIR=/models # 优先级高于 .env 中的 MODEL_DIR
|
||||||
|
- RUNNING_IN_DOCKER=true
|
||||||
|
command: uvicorn server.main:app --host 0.0.0.0 --port 5050 --reload
|
||||||
|
|
||||||
|
web:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: docker/web.Dockerfile
|
||||||
|
target: development
|
||||||
|
container_name: web-dev
|
||||||
|
volumes:
|
||||||
|
- ./web:/app
|
||||||
|
- /app/node_modules
|
||||||
|
ports:
|
||||||
|
- "5173:5173"
|
||||||
|
depends_on:
|
||||||
|
- api
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- VITE_API_URL=http://api:5050 # 添加这行
|
||||||
|
command: pnpm run server
|
||||||
|
|
||||||
|
graph:
|
||||||
|
image: neo4j:5.26
|
||||||
|
container_name: graph-dev
|
||||||
|
ports:
|
||||||
|
- "7474:7474"
|
||||||
|
- "7687:7687"
|
||||||
|
volumes:
|
||||||
|
- ./volumes/neo4j/data:/data
|
||||||
|
- ./volumes/neo4j/logs:/var/lib/neo4j/logs
|
||||||
|
environment:
|
||||||
|
- NEO4J_AUTH=neo4j/0123456789
|
||||||
|
- NEO4J_server_bolt_listen__address=0.0.0.0:7687
|
||||||
|
- NEO4J_server_http_listen__address=0.0.0.0:7474
|
||||||
|
- ENTITY_EMBEDDING=true
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
etcd:
|
||||||
|
container_name: milvus-etcd-dev
|
||||||
|
image: quay.io/coreos/etcd:v3.5.5
|
||||||
|
environment:
|
||||||
|
- ETCD_AUTO_COMPACTION_MODE=revision
|
||||||
|
- ETCD_AUTO_COMPACTION_RETENTION=1000
|
||||||
|
- ETCD_QUOTA_BACKEND_BYTES=4294967296
|
||||||
|
- ETCD_SNAPSHOT_COUNT=50000
|
||||||
|
volumes:
|
||||||
|
- ./volumes/milvus/etcd:/etcd
|
||||||
|
command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 --data-dir /etcd
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "etcdctl", "endpoint", "health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 3
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
minio:
|
||||||
|
container_name: milvus-minio-dev
|
||||||
|
image: minio/minio:RELEASE.2023-03-20T20-16-18Z
|
||||||
|
environment:
|
||||||
|
MINIO_ACCESS_KEY: minioadmin
|
||||||
|
MINIO_SECRET_KEY: minioadmin
|
||||||
|
volumes:
|
||||||
|
- ./volumes/milvus/minio:/minio_data
|
||||||
|
command: minio server /minio_data
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 3
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
milvus:
|
||||||
|
image: milvusdb/milvus:v2.5.6
|
||||||
|
container_name: milvus-standalone-dev
|
||||||
|
command: ["milvus", "run", "standalone"]
|
||||||
|
security_opt:
|
||||||
|
- seccomp:unconfined
|
||||||
|
environment:
|
||||||
|
ETCD_ENDPOINTS: etcd:2379
|
||||||
|
MINIO_ADDRESS: minio:9000
|
||||||
|
MILVUS_LOG_LEVEL: error # Add this line to reduce log output
|
||||||
|
volumes:
|
||||||
|
- ./volumes/milvus/milvus:/var/lib/milvus
|
||||||
|
- ./volumes/milvus/logs:/var/lib/milvus/logs
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:9091/healthz"]
|
||||||
|
interval: 30s
|
||||||
|
start_period: 90s
|
||||||
|
timeout: 20s
|
||||||
|
retries: 3
|
||||||
|
ports:
|
||||||
|
- "19530:19530"
|
||||||
|
- "9091:9091"
|
||||||
|
depends_on:
|
||||||
|
- "etcd"
|
||||||
|
- "minio"
|
||||||
|
networks:
|
||||||
|
- app-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
@ -5,11 +5,14 @@ FROM python:3.12
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# 复制 requirements.txt 文件(这一步如果文件没变,Docker 会使用缓存)
|
# 复制 requirements.txt 文件(这一步如果文件没变,Docker 会使用缓存)
|
||||||
COPY ../requirements.txt /app/requirements.txt
|
# COPY../requirements.txt /app/requirements.txt
|
||||||
|
COPY ../pyproject.toml /app/pyproject.toml
|
||||||
|
COPY ../uv.lock /app/uv.lock
|
||||||
|
COPY ../.python-version /app/.python-version
|
||||||
|
|
||||||
# 安装依赖(Docker 会缓存这一步,除非 requirements.txt 发生变化)
|
# 安装依赖(Docker 会缓存这一步,除非 requirements.txt 发生变化)
|
||||||
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
RUN pip install uv
|
||||||
RUN pip install -U gunicorn -i https://pypi.tuna.tsinghua.edu.cn/simple
|
RUN uv sync
|
||||||
|
|
||||||
RUN apt-get clean
|
RUN apt-get clean
|
||||||
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
||||||
|
|||||||
@ -43,7 +43,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- NODE_ENV=development
|
- NODE_ENV=development
|
||||||
- VITE_API_URL=http://api:5050 # 添加这行
|
- VITE_API_URL=http://api:5050 # 添加这行
|
||||||
command: npm run server
|
command: pnpm run server
|
||||||
|
|
||||||
graph:
|
graph:
|
||||||
image: neo4j:5.26
|
image: neo4j:5.26
|
||||||
@ -6,7 +6,8 @@ WORKDIR /app
|
|||||||
COPY ./web/package*.json ./
|
COPY ./web/package*.json ./
|
||||||
|
|
||||||
# 安装依赖
|
# 安装依赖
|
||||||
RUN npm install --verbose --force
|
RUN npm install -g pnpm@latest-10
|
||||||
|
RUN pnpm install
|
||||||
# RUN npm install --registry http://mirrors.cloud.tencent.com/npm/ --verbose --force
|
# RUN npm install --registry http://mirrors.cloud.tencent.com/npm/ --verbose --force
|
||||||
|
|
||||||
# 复制源代码
|
# 复制源代码
|
||||||
|
|||||||
33
pyproject.toml
Normal file
33
pyproject.toml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[project]
|
||||||
|
name = "yuxi-know"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Add your description here"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = ">=3.11"
|
||||||
|
dependencies = [
|
||||||
|
"dashscope>=1.23.2",
|
||||||
|
"docx2txt>=0.9",
|
||||||
|
"fastapi>=0.115.12",
|
||||||
|
"flagembedding>=1.3.4",
|
||||||
|
"langchain-community>=0.3.22",
|
||||||
|
"langchain-openai>=0.3.14",
|
||||||
|
"langgraph>=0.3.34",
|
||||||
|
"langsmith>=0.3.37",
|
||||||
|
"llama-index>=0.12.33",
|
||||||
|
"llama-index-readers-file>=0.4.7",
|
||||||
|
"neo4j>=5.28.1",
|
||||||
|
"openai>=1.76.0",
|
||||||
|
"opencv-python-headless>=4.11.0.86",
|
||||||
|
"paddleocr>=2.10.0",
|
||||||
|
"pymilvus>=2.5.8",
|
||||||
|
"pymupdf>=1.25.5",
|
||||||
|
"python-dotenv>=1.1.0",
|
||||||
|
"python-multipart>=0.0.20",
|
||||||
|
"pyyaml>=6.0.2",
|
||||||
|
"qianfan>=0.4.12.3",
|
||||||
|
"rapidocr-onnxruntime>=1.4.4",
|
||||||
|
"sentencepiece>=0.2.0",
|
||||||
|
"tavily-python>=0.7.0",
|
||||||
|
"uvicorn[standard]>=0.34.2",
|
||||||
|
"zhipuai>=2.1.5.20250421",
|
||||||
|
]
|
||||||
@ -20,5 +20,5 @@ app.add_middleware(
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run(app, host="0.0.0.0", port=5000, threads=10, workers=10)
|
uvicorn.run(app, host="0.0.0.0", port=5050, threads=10, workers=10, reload=True)
|
||||||
|
|
||||||
|
|||||||
@ -192,9 +192,6 @@ class Config(SimpleConfig):
|
|||||||
else:
|
else:
|
||||||
logger.warning(f"Unknown config file type {self.filename}")
|
logger.warning(f"Unknown config file type {self.filename}")
|
||||||
|
|
||||||
else:
|
|
||||||
logger.warning(f"\n\n{'='*70}\n{'Config file not found':^70}\n{'You can custum your config in `' + self.filename + '`':^70}\n{'='*70}\n\n")
|
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
logger.info(f"Saving config to {self.filename}")
|
logger.info(f"Saving config to {self.filename}")
|
||||||
if self.filename is None:
|
if self.filename is None:
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class GraphDatabase:
|
|||||||
|
|
||||||
# 尝试加载已保存的图数据库信息
|
# 尝试加载已保存的图数据库信息
|
||||||
if not self.load_graph_info():
|
if not self.load_graph_info():
|
||||||
logger.info(f"未找到已保存的图数据库信息,将创建新的配置")
|
logger.debug(f"未找到已保存的图数据库信息,将创建新的配置")
|
||||||
|
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
@ -516,7 +516,7 @@ class GraphDatabase:
|
|||||||
try:
|
try:
|
||||||
info_file_path = os.path.join(self.work_dir, "graph_info.json")
|
info_file_path = os.path.join(self.work_dir, "graph_info.json")
|
||||||
if not os.path.exists(info_file_path):
|
if not os.path.exists(info_file_path):
|
||||||
logger.warning(f"图数据库信息文件不存在:{info_file_path}")
|
logger.debug(f"图数据库信息文件不存在:{info_file_path}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
with open(info_file_path, 'r', encoding='utf-8') as f:
|
with open(info_file_path, 'r', encoding='utf-8') as f:
|
||||||
|
|||||||
4214
web/pnpm-lock.yaml
Normal file
4214
web/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user