Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
fix(vectordb): read the items key HttpCollection's own server returns (#6193)
ordinary beingb15fa86f50f2
diff --git a/openviking/storage/vectordb/collection/http_collection.py b/openviking/storage/vectordb/collection/http_collection.pyindex c461c8eff..55c973f5b 100644--- a/openviking/storage/vectordb/collection/http_collection.py+++ b/openviking/storage/vectordb/collection/http_collection.py@@ -337,8 +337,8 @@ class HttpCollection(ICollection):fetch_result = FetchDataInCollectionResult()if isinstance(data, dict):- if "fetch" in data:- fetch = data.get("fetch", [])+ if "items" in data:+ fetch = data.get("items", [])fetch_result.items = [DataItem(id=item.get("id"),diff --git a/tests/storage/test_volcengine_clients.py b/tests/storage/test_volcengine_clients.pyindex b5fb1fc13..a206458ec 100644--- a/tests/storage/test_volcengine_clients.py+++ b/tests/storage/test_volcengine_clients.py@@ -1164,42 +1164,47 @@ def test_volcengine_adapter_update_data_supports_api_key_mode():assert result == ["doc-1"]-def test_http_collection_update_data_posts_to_update_endpoint(monkeypatch):- captured = {}+def test_http_collection_update_and_fetch_data(monkeypatch):+ import json+ from dataclasses import asdict+ from types import SimpleNamespace- class _Response:- status_code = 200- text = '{"data": ["doc-1"]}'+ from openviking.storage.vectordb.collection.http_collection import HttpCollection+ from openviking.storage.vectordb.collection.result import DataItem, FetchDataInCollectionResult++ record = {"id": "doc-1", "name": "updated"}+ expected = FetchDataInCollectionResult(+ items=[DataItem(id="doc-1", fields=record)], ids_not_exist=["doc-2"]+ )+ captured = {}def _fake_post(url, headers=None, json=None, timeout=None):- captured["url"] = url- captured["headers"] = headers- captured["json"] = json- captured["timeout"] = timeout- return _Response()+ captured.update(url=url, json=json)+ return SimpleNamespace(status_code=200, text='{"data": ["doc-1"]}')+ monkeypatch.setattr(requests, "post", _fake_post)+ # The bundled service serializes FetchDataInCollectionResult with asdict().monkeypatch.setattr(- "openviking.storage.vectordb.collection.http_collection.requests.post",- _fake_post,+ requests,+ "get",+ lambda *args, **kwargs: SimpleNamespace(+ status_code=200, text=json.dumps({"code": 0, "data": asdict(expected)})+ ),)-- from openviking.storage.vectordb.collection.http_collection import HttpCollection-collection = HttpCollection(ip="127.0.0.1",port=1933,meta_data={"ProjectName": "default", "CollectionName": "context"},)- result = collection.update_data([{"id": "doc-1", "name": "updated"}])-- assert result == ["doc-1"]+ assert collection.update_data([record]) == ["doc-1"]assert captured["url"] == "http://127.0.0.1:1933/api/vikingdb/data/update"assert captured["json"] == {"project": "default","collection_name": "context",- "fields": '[{"id": "doc-1", "name": "updated"}]',+ "fields": json.dumps([record]),}+ assert collection.fetch_data(["doc-1", "doc-2"]) == expecteddef test_http_adapter_strict_count_propagates_http_failure(monkeypatch):