Skip to content

Commit 8116025

Browse files
authored
feat: add graph RAG service routing and storage configuration (#255)
1 parent 09a8f75 commit 8116025

6 files changed

Lines changed: 15 additions & 2 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,5 @@ Thumbs.db
190190

191191
# Milvus
192192
**/volumes/
193+
194+
**/rag_storage/

backend/api-gateway/src/main/java/com/datamate/gateway/ApiGatewayApplication.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
3939

4040
// 数据归集服务路由
4141
.route("data-collection", r -> r.path("/api/data-collection/**")
42-
.uri("http://datamate-backend-python:18000"))
42+
.uri("http://datamate-backend-python:18000"))
43+
44+
// 知识图谱RAG服务路由
45+
.route("graph-rag", r -> r.path("/api/rag/**")
46+
.uri("http://datamate-backend-python:18000"))
4347

4448
.route("deer-flow-frontend", r -> r.path("/chat/**")
4549
.uri("http://deer-flow-frontend:3000"))

deployment/docker/datamate/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ services:
3232
- dataset_volume:/dataset
3333
- flow_volume:/flow
3434
- log_volume:/var/log/datamate
35+
- graph_data_volume:/data/rag_storage
3536
networks: [ datamate ]
3637
depends_on:
3738
- datamate-database
@@ -335,6 +336,8 @@ volumes:
335336
name: datamate-operator-packages-volume
336337
mineru_log_volume:
337338
name: datamate-mineru_log_volume
339+
graph_data_volume:
340+
name: datamate-graph-data-volume
338341

339342
# Deer Flow
340343
deer-flow-log-volume:

runtime/datamate-python/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PORT=18000
55
DEBUG=true
66
LOG_LEVEL=DEBUG
77
LOG_FILE_DIR=./logs
8+
RAG_STORAGE_DIR=./rag_storage
89

910
# DataBase
1011
MYSQL_HOST=localhost

runtime/datamate-python/app/core/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class Config:
2727
log_level: str = "INFO"
2828
debug: bool = True
2929
log_file_dir: str = "/var/log/datamate/backend-python"
30+
rag_storage_dir: str = "/data/rag_storage"
3031

3132
# Database
3233
pgsql_host: str = "datamate-database"

runtime/datamate-python/app/module/rag/service/graph_rag.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os
2+
from pathlib import Path
23
from typing import Awaitable, Callable, Optional
4+
from app.core.config import settings
35

46
import numpy as np
57
from lightrag import LightRAG
@@ -9,7 +11,7 @@
911
from lightrag.utils import setup_logger, EmbeddingFunc, get_env_value
1012

1113
setup_logger("lightrag", level="INFO")
12-
DEFAULT_WORKING_DIR = os.path.join(os.getcwd(), "rag_storage")
14+
DEFAULT_WORKING_DIR = Path(settings.rag_storage_dir)
1315

1416

1517
async def build_llm_model_func(model_name: str, base_url: str, api_key: str) -> Callable[..., Awaitable[str]]:

0 commit comments

Comments
 (0)