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

@@ -155,7 +155,8 @@ def test_query_local_text_chunks_prioritizes_relevant_policy_chunk(tmp_path) ->
def test_query_knowledge_uses_local_chunks_before_lightrag_runtime(tmp_path, monkeypatch) -> None:
workspace = tmp_path / "knowledge" / ".lightrag" / "x_financial_knowledge"
service = KnowledgeRagService(storage_root=tmp_path, tenant_id="tenant-a")
workspace = service.storage_scope.lightrag_root / service.storage_scope.workspace
workspace.mkdir(parents=True)
(workspace / "kv_store_text_chunks.json").write_text(
json.dumps(
@@ -180,7 +181,7 @@ def test_query_knowledge_uses_local_chunks_before_lightrag_runtime(tmp_path, mon
monkeypatch.setattr(KnowledgeRagService, "_get_runtime", fail_if_runtime_is_used)
payload = KnowledgeRagService(storage_root=tmp_path).query_knowledge(
payload = service.query_knowledge(
"费用发生后多久内必须报销?超过三个月还能不能报?",
limit=3,
)
@@ -257,14 +258,14 @@ def test_runtime_cache_uses_dedicated_instance_across_calling_threads(monkeypatc
lambda self: (("same-config",), {}),
)
service = KnowledgeRagService()
service = KnowledgeRagService(tenant_id="tenant-a")
main_runtime = service._get_runtime()
assert service._get_runtime() is main_runtime
worker_runtimes = []
def load_worker_runtime() -> None:
worker_runtimes.append(KnowledgeRagService()._get_runtime())
worker_runtimes.append(KnowledgeRagService(tenant_id="tenant-a")._get_runtime())
thread = threading.Thread(target=load_worker_runtime)
thread.start()