Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/dependency-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ on:
- "packages/yuxi-cli/uv.lock"
- "web/package.json"
- "web/pnpm-lock.yaml"
- "web/pnpm-workspace.yaml"
- "docs/package.json"
- "docs/pnpm-lock.yaml"
- "docs/pnpm-workspace.yaml"
- "scripts/dependency-audit-fixtures/**"
push:
branches: [main]
Expand All @@ -27,8 +29,10 @@ on:
- "packages/yuxi-cli/uv.lock"
- "web/package.json"
- "web/pnpm-lock.yaml"
- "web/pnpm-workspace.yaml"
- "docs/package.json"
- "docs/pnpm-lock.yaml"
- "docs/pnpm-workspace.yaml"
- "scripts/dependency-audit-fixtures/**"
workflow_dispatch:

Expand All @@ -48,14 +52,13 @@ jobs:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@v7
with:
version: "0.11.7"
version: "0.12.6"
- uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Audit locked Python vulnerabilities
working-directory: backend
# The locked PyTorch 2.12.1 wheels require setuptools<82 and no compatible 2.13 CPU pair is available yet.
run: uv audit --locked --no-dev --ignore GHSA-h35f-9h28-mq5c --ignore GHSA-rrmf-rvhw-rf47
run: uv audit --locked --no-dev
- name: Exercise Python audit negative control
run: |
if uv audit --script scripts/dependency-audit-fixtures/vulnerable.py >python-audit-negative.log 2>&1; then
Expand Down Expand Up @@ -86,7 +89,7 @@ jobs:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
with:
version: 10.11.0
version: 11.24.0
- uses: actions/setup-node@v7
with:
node-version: 22
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-yuxi-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.7.2"
version: "0.12.6"

- name: Set up Python
uses: actions/setup-python@v7
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.7.2"
version: "0.12.6"

# 3. 设置 Python 环境
- name: Set up Python
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.7.2"
version: "0.12.6"

- name: Set up Python
uses: actions/setup-python@v7
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/trust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:
run: python3 -m unittest scripts.test_verify_engineering_contracts
- name: Verify dependency update policy
run: python3 -m unittest scripts.test_dependency_update_policy
- name: Verify release version synchronization
run: python3 -m unittest scripts.test_bump_version
2 changes: 1 addition & 1 deletion .github/workflows/web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
with:
version: 10.11.0
version: 11.24.0
- uses: actions/setup-node@v7
with:
node-version: 22
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ test:

verify-trust:
python3 scripts/verify_engineering_contracts.py
python3 -m unittest scripts.test_verify_engineering_contracts
python3 -m unittest scripts.test_verify_engineering_contracts scripts.test_bump_version

audit-dependencies:
cd backend && uv audit --locked --no-dev --ignore GHSA-h35f-9h28-mq5c --ignore GHSA-rrmf-rvhw-rf47
cd backend && uv audit --locked --no-dev
cd packages/yuxi-cli && uv audit --locked --no-dev
cd web && pnpm audit --audit-level=high --prod
cd docs && pnpm audit --audit-level=high --prod
Expand Down
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Yuxi is a strong fit for teams that need private deployment, organizational acce
**1. Clone and initialize**

```bash
git clone --branch v0.7.2.beta1 --depth 1 https://github.com/xerrors/Yuxi.git
git clone --branch v0.7.2.beta2 --depth 1 https://github.com/xerrors/Yuxi.git
cd Yuxi

# Linux/macOS
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ Yuxi 面向需要自己掌握数据、模型和权限的团队:

### 前置条件

安装 [Docker Engine](https://docs.docker.com/get-docker/) 和 Docker Compose,并准备一个可用的大模型 API。当前仓库默认配置对应 `v0.7.2.beta1`,仍处于 Beta 阶段。
安装 [Docker Engine](https://docs.docker.com/get-docker/) 和 Docker Compose,并准备一个可用的大模型 API。当前仓库默认配置对应 `v0.7.2.beta2`,仍处于 Beta 阶段。

### 1. 获取代码并初始化

```bash
git clone --branch v0.7.2.beta1 --depth 1 https://github.com/xerrors/Yuxi.git
git clone --branch v0.7.2.beta2 --depth 1 https://github.com/xerrors/Yuxi.git
cd Yuxi

# Linux/macOS
Expand Down
2 changes: 1 addition & 1 deletion backend/package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "yuxi"
version = "0.7.2.beta1"
version = "0.7.2.beta2"
description = "Yuxi 智能知识库与知识图谱平台核心后端包"
readme = "README.md"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "yuxi-workspace"
version = "0.7.2.beta1"
version = "0.7.2.beta2"
description = "基于大模型的智能知识库与知识图谱智能体开发平台,融合了 RAG 技术与知识图谱技术,基于 LangGraph v1 + Vue.js + FastAPI + LightRAG 架构构建"
readme = "README.md"
license = { text = "MIT" }
Expand Down
5 changes: 4 additions & 1 deletion backend/server/routers/knowledge_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,10 @@ async def run_ingest(context: TaskContext):

try:
file_meta = await knowledge_base.add_file_record(
kb_id, item, params=params, operator_id=current_user.uid
kb_id,
item,
params=_params_for_uploaded_document_item(item, params),
operator_id=current_user.uid,
)
added_files.append(
{
Expand Down
52 changes: 52 additions & 0 deletions backend/test/unit/routers/test_knowledge_router_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,58 @@ async def fake_enqueue(name: str, task_type: str, payload: dict, coroutine):
assert context.result["items"] == [{"file_id": "file_1", "status": "indexed", "error": None}]


async def test_add_documents_passes_source_path_to_file_record(monkeypatch):
"""验证包含 source_paths 的批量上传会将单文件 source_path 传递给 add_file_record。"""
context = FakeTaskContext()
item1 = "minio://knowledgebases/kb_1/upload/doc1.txt"
item2 = "minio://knowledgebases/kb_1/upload/doc2.txt"
captured_records = []

async def fake_ensure_database_supports_documents(kb_id: str, operation: str) -> None:
return None

async def fake_get_database_info(kb_id: str) -> KnowledgeBaseDetail:
return _database_detail()

async def fake_add_file_record(kb_id: str, item_path: str, params: dict, operator_id: str | None = None):
captured_records.append({"kb_id": kb_id, "item": item_path, "params": params, "operator_id": operator_id})
return {"file_id": f"file_{len(captured_records)}", "status": "uploaded"}

async def fake_parse_file(kb_id: str, file_id: str, operator_id: str | None = None):
return {"file_id": file_id, "status": "parsed", "error": None}

async def fake_enqueue(name: str, task_type: str, payload: dict, coroutine):
await coroutine(context)
return SimpleNamespace(id="task_1")

monkeypatch.setattr(
knowledge_router,
"_ensure_database_supports_documents",
fake_ensure_database_supports_documents,
)
monkeypatch.setattr(knowledge_router.knowledge_base, "get_database_info", fake_get_database_info)
monkeypatch.setattr(knowledge_router.knowledge_base, "add_file_record", fake_add_file_record)
monkeypatch.setattr(knowledge_router.knowledge_base, "parse_file", fake_parse_file)
monkeypatch.setattr(knowledge_router.tasker, "enqueue", fake_enqueue)

await knowledge_router.add_documents(
"kb_1",
[item1, item2],
params={
"content_type": "file",
"content_hashes": {item1: "hash_1", item2: "hash_2"},
"source_paths": {item1: "folder_a/sub/doc1.txt", item2: "folder_a/doc2.txt"},
},
current_user=SimpleNamespace(uid="uid-user"),
)

assert len(captured_records) == 2
assert captured_records[0]["params"]["source_path"] == "folder_a/sub/doc1.txt"
assert "source_paths" not in captured_records[0]["params"]
assert captured_records[1]["params"]["source_path"] == "folder_a/doc2.txt"
assert "source_paths" not in captured_records[1]["params"]


@pytest.mark.parametrize(
("payload", "error_detail"),
[
Expand Down
Loading
Loading