A Simple and Universal Swarm Intelligence Engine, Predicting Anything. 简洁通用的群体智能引擎,预测万物
Python agent-memoryfinancial-forecastingfuture-predictionknowledge-graphllmsmulti-agent-simulationpublic-opinion-analysispython3social-predictionswarm-intelligence
fix: preserve edge paging call compatibility
666ghj7d6f6bb1354b
diff --git a/backend/app/utils/zep_paging.py b/backend/app/utils/zep_paging.pyindex 8e40226c..22c20526 100644--- a/backend/app/utils/zep_paging.py+++ b/backend/app/utils/zep_paging.py@@ -107,9 +107,9 @@ def fetch_all_edges(client: Zep,graph_id: str,page_size: int = _DEFAULT_PAGE_SIZE,- max_items: int = _MAX_EDGES,max_retries: int = _DEFAULT_MAX_RETRIES,retry_delay: float = _DEFAULT_RETRY_DELAY,+ max_items: int = _MAX_EDGES,) -> list[Any]:"""分页获取图谱所有边,最多返回 max_items 条(默认 5000)。每页请求自带重试。"""all_edges: list[Any] = []diff --git a/backend/tests/test_zep_edge_paging.py b/backend/tests/test_zep_edge_paging.pynew file mode 100644index 00000000..d0e92ff4--- /dev/null+++ b/backend/tests/test_zep_edge_paging.py@@ -0,0 +1,44 @@+from types import SimpleNamespace++from app.utils import zep_paging+++def _client():+ edge_api = SimpleNamespace(get_by_graph_id=lambda *args, **kwargs: [])+ return SimpleNamespace(graph=SimpleNamespace(edge=edge_api))+++def test_edge_cap_stops_pagination_at_requested_limit(monkeypatch):+ pages = [+ [SimpleNamespace(uuid_="e1"), SimpleNamespace(uuid_="e2")],+ [SimpleNamespace(uuid_="e3"), SimpleNamespace(uuid_="e4")],+ ]+ calls = []++ def fake_fetch(*args, **kwargs):+ calls.append(kwargs)+ return pages[len(calls) - 1]++ monkeypatch.setattr(zep_paging, "_fetch_page_with_retry", fake_fetch)++ result = zep_paging.fetch_all_edges(_client(), "graph", page_size=2, max_items=3)++ assert [edge.uuid_ for edge in result] == ["e1", "e2", "e3"]+ assert len(calls) == 2+ assert calls[1]["uuid_cursor"] == "e2"+++def test_existing_positional_retry_arguments_keep_their_meaning(monkeypatch):+ observed = {}++ def fake_fetch(*args, **kwargs):+ observed.update(kwargs)+ return []++ monkeypatch.setattr(zep_paging, "_fetch_page_with_retry", fake_fetch)++ zep_paging.fetch_all_edges(_client(), "graph", 25, 7, 0.25)++ assert observed["limit"] == 25+ assert observed["max_retries"] == 7+ assert observed["retry_delay"] == 0.25