feat(platform): close AI expense value loop

Add tenant-safe value, telemetry, connector, commercial, and production-readiness foundations.
This commit is contained in:
caoxiaozhu
2026-07-17 14:14:08 +08:00
parent 242d68c36f
commit 787bc3a481
507 changed files with 82072 additions and 6344 deletions

View File

@@ -30,7 +30,7 @@ def build_session() -> Session:
def test_list_library_returns_closed_folder_icons_by_default(tmp_path) -> None:
service = KnowledgeService(storage_root=tmp_path)
service = KnowledgeService(storage_root=tmp_path, tenant_id="tenant-a")
library = service.list_library()
@@ -43,7 +43,7 @@ def test_reconcile_document_ingest_status_keeps_failed_when_linked_run_failed(
monkeypatch,
) -> None:
with build_session() as db:
service = KnowledgeService(storage_root=tmp_path, db=db)
service = KnowledgeService(storage_root=tmp_path, db=db, tenant_id="tenant-a")
uploaded = service.upload_document(
"报销制度",
"demo.txt",
@@ -53,6 +53,7 @@ def test_reconcile_document_ingest_status_keeps_failed_when_linked_run_failed(
name="管理员",
role_codes=["manager"],
is_admin=True,
tenant_id="tenant-a",
),
)
@@ -60,6 +61,7 @@ def test_reconcile_document_ingest_status_keeps_failed_when_linked_run_failed(
agent=AgentName.HERMES.value,
source=AgentRunSource.USER_MESSAGE.value,
status=AgentRunStatus.FAILED.value,
tenant_id="tenant-a",
route_json={"job_type": "knowledge_index_sync"},
)
service.set_document_ingest_statuses(
@@ -95,7 +97,7 @@ def test_reconcile_document_ingest_status_preserves_ingested_when_status_map_mis
tmp_path,
monkeypatch,
) -> None:
service = KnowledgeService(storage_root=tmp_path)
service = KnowledgeService(storage_root=tmp_path, tenant_id="tenant-a")
uploaded = service.upload_document(
"报销制度",
"demo.txt",
@@ -105,6 +107,7 @@ def test_reconcile_document_ingest_status_preserves_ingested_when_status_map_mis
name="管理员",
role_codes=["manager"],
is_admin=True,
tenant_id="tenant-a",
),
)
service.set_document_ingest_statuses(