Skip to content

Commit 397d509

Browse files
committed
Merge branch 'refactor/backend-restructuring'
2 parents 42aa4f4 + 9147a59 commit 397d509

File tree

269 files changed

+1294
-4630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

269 files changed

+1294
-4630
lines changed

.github/ISSUE_TEMPLATE/提交一个docker启动问题.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ assignees: ''
3535
# 例如
3636
docker compose up -d
3737
#
38-
make start
38+
make up
3939
```
4040

4141

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# 项目目录结构 (Project Overview)
33

4-
Yuxi-Know 是一个基于大模型的智能知识库与知识图谱智能体开发平台,融合了 RAG 技术与知识图谱技术,基于 LangGraph v1 + Vue.js + FastAPI + LightRAG 架构构建。项目完全通过 Docker Compose 进行管理,支持热重载开发。
4+
Yuxi 是一个基于大模型的智能知识库与知识图谱智能体开发平台,融合了 RAG 技术与知识图谱技术,基于 LangGraph v1 + Vue.js + FastAPI + LightRAG 架构构建。项目完全通过 Docker Compose 进行管理,支持热重载开发。
55

66
## 开发准则
77

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# 项目目录结构 (Project Overview)
33

4-
Yuxi-Know 是一个基于大模型的智能知识库与知识图谱智能体开发平台,融合了 RAG 技术与知识图谱技术,基于 LangGraph v1 + Vue.js + FastAPI + LightRAG 架构构建。项目完全通过 Docker Compose 进行管理,支持热重载开发。
4+
Yuxi 是一个基于大模型的智能知识库与知识图谱智能体开发平台,融合了 RAG 技术与知识图谱技术,基于 LangGraph v1 + Vue.js + FastAPI + LightRAG 架构构建。项目完全通过 Docker Compose 进行管理,支持热重载开发。
55

66
## 开发准则
77

Makefile

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,16 @@
11

2-
.PHONY: start stop logs lint format format_diff router-tests
2+
.PHONY: up down logs lint format format_diff router-tests
33

44
PYTEST_ARGS ?=
55

6-
pull:
7-
bash docker/pull_image.sh python:3.12-slim
8-
bash docker/pull_image.sh node:20-slim
9-
bash docker/pull_image.sh node:20-alpine
10-
bash docker/pull_image.sh milvusdb/milvus:v2.5.6
11-
bash docker/pull_image.sh neo4j:5.26
12-
bash docker/pull_image.sh minio/minio:RELEASE.2023-03-20T20-16-18Z
13-
bash docker/pull_image.sh ghcr.io/astral-sh/uv:0.7.2
14-
bash docker/pull_image.sh nginx:alpine
15-
bash docker/pull_image.sh quay.io/coreos/etcd:v3.5.5
16-
17-
start:
6+
up:
187
@if [ ! -f .env ]; then \
198
echo "Error: .env file not found. Please create it from .env.template"; \
209
exit 1; \
2110
fi
2211
docker compose up -d
2312

24-
stop:
13+
down:
2514
docker compose down
2615

2716
logs:
@@ -35,15 +24,15 @@ logs:
3524
######################
3625

3726
lint:
38-
uv run python -m ruff check .
39-
uv run python -m ruff format --check src
40-
uv run python -m ruff check --select I src
27+
uv run python -m ruff check backend/package
28+
uv run python -m ruff format --check backend/package
29+
uv run python -m ruff check --select I backend/package
4130

4231
format:
43-
uv run python -m ruff format .
44-
uv run python -m ruff check . --fix
45-
uv run python -m ruff check --select I src --fix
46-
cd web && npm run format
32+
uv run python -m ruff format backend/package
33+
uv run python -m ruff check backend/package --fix
34+
uv run python -m ruff check --select I backend/package --fix
35+
docker compose exec -T web pnpm run format
4736

4837
router-tests:
4938
docker compose exec -T api uv run --group test pytest test/api $(PYTEST_ARGS)
File renamed without changes.
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
import os # noqa: E402
66
from concurrent.futures import ThreadPoolExecutor # noqa: E402
77

8-
from src.config import config as config # noqa: E402
8+
from yuxi.config import config as config # noqa: E402
99

1010
__version__ = "0.5.3"
1111

1212
if os.getenv("YUXI_SKIP_APP_INIT") != "1":
13-
from src.knowledge import graph_base as graph_base # noqa: E402
14-
from src.knowledge import knowledge_base as knowledge_base # noqa: E402
13+
from yuxi.knowledge import graph_base as graph_base # noqa: E402
14+
from yuxi.knowledge import knowledge_base as knowledge_base # noqa: E402
1515

1616
executor = ThreadPoolExecutor() # noqa: E402
1717

1818

1919
def get_version():
20-
"""Return the Yuxi-Know version."""
20+
"""Return the Yuxi version."""
2121
return __version__
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# 从 buildin 模块导入 agent_manager
2+
from yuxi.agents.buildin import agent_manager
3+
4+
__all__ = ["agent_manager"]

src/agents/__init__.py renamed to backend/package/yuxi/agents/buildin/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from pathlib import Path
55

66
from server.utils.singleton import SingletonMeta
7-
from src.agents.common import BaseAgent
8-
from src.utils import logger
7+
from yuxi.agents.common import BaseAgent
8+
from yuxi.utils import logger
99

1010

1111
class AgentManager(metaclass=SingletonMeta):
@@ -46,9 +46,9 @@ async def get_agents_info(self, include_configurable_items: bool = True):
4646
)
4747

4848
def auto_discover_agents(self):
49-
"""自动发现并注册 src/agents/ 下的所有智能体。
49+
"""自动发现并注册 yuxi/agents/buildin/ 下的所有智能体。
5050
51-
遍历 src/agents/ 目录下的所有子文件夹,如果子文件夹包含 __init__.py,
51+
遍历 yuxi/agents/buildin/ 目录下的所有子文件夹,如果子文件夹包含 __init__.py,
5252
则尝试从中导入 BaseAgent 的子类并注册。(使用自动导入的方式,支持私有agent)
5353
"""
5454
# 获取 agents 目录的路径
@@ -58,7 +58,7 @@ def auto_discover_agents(self):
5858
for item in agents_dir.iterdir():
5959
# logger.info(f"尝试导入模块:{item}")
6060
# 跳过非目录、common 目录、__pycache__ 等
61-
if not item.is_dir() or item.name.startswith("_") or item.name == "common":
61+
if not item.is_dir() or item.name.startswith("_"):
6262
continue
6363

6464
# 检查是否有 __init__.py 文件
@@ -69,7 +69,7 @@ def auto_discover_agents(self):
6969

7070
# 尝试导入模块
7171
try:
72-
module_name = f"src.agents.{item.name}"
72+
module_name = f"yuxi.agents.buildin.{item.name}"
7373
module = importlib.import_module(module_name)
7474

7575
# 查找模块中所有 BaseAgent 的子类

src/agents/chatbot/__init__.py renamed to backend/package/yuxi/agents/buildin/chatbot/__init__.py

File renamed without changes.

src/agents/chatbot/graph.py renamed to backend/package/yuxi/agents/buildin/chatbot/graph.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
TodoListMiddleware,
77
)
88

9-
from src.agents.common import BaseAgent, load_chat_model
10-
from src.agents.common.backends import create_agent_composite_backend
11-
from src.agents.common.middlewares import (
9+
from yuxi.agents.common import BaseAgent, load_chat_model
10+
from yuxi.agents.common.backends import create_agent_composite_backend
11+
from yuxi.agents.common.middlewares import (
1212
RuntimeConfigMiddleware,
1313
save_attachments_to_fs,
1414
)
15-
from src.agents.common.middlewares.knowledge_base_middleware import KnowledgeBaseMiddleware
16-
from src.agents.common.middlewares.skills_middleware import SkillsMiddleware
17-
from src.services.mcp_service import get_tools_from_all_servers
15+
from yuxi.agents.common.middlewares.knowledge_base_middleware import KnowledgeBaseMiddleware
16+
from yuxi.agents.common.middlewares.skills_middleware import SkillsMiddleware
17+
from yuxi.services.mcp_service import get_tools_from_all_servers
1818

1919

2020
def _create_fs_backend(rt):

0 commit comments

Comments
 (0)