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(storage): pass context_type in _enqueue_direct_vectorization and handle str from read_file (#1853)
yc1112330d0318a66c13
diff --git a/openviking/storage/local_fs.py b/openviking/storage/local_fs.pyindex d68bd615d..9ecfd26d2 100644--- a/openviking/storage/local_fs.py+++ b/openviking/storage/local_fs.py@@ -6,6 +6,7 @@ import osimport reimport zipfile+from openviking.core.directories import get_context_type_for_urifrom openviking.resource.watch_storage import is_watch_task_control_urifrom openviking.server.identity import RequestContextfrom openviking.utils.embedding_utils import vectorize_directory_meta, vectorize_file@@ -132,11 +133,17 @@ async def _enqueue_direct_vectorization(viking_fs, uri: str, ctx: RequestContextoverview = content.decode("utf-8") if isinstance(content, bytes) else contentexcept Exception:return- await vectorize_directory_meta(dir_uri, abstract, overview, ctx=ctx)+ await vectorize_directory_meta(+ dir_uri, abstract, overview, context_type=get_context_type_for_uri(dir_uri), ctx=ctx+ )async def index_file(file_uri: str, parent_uri: str, name: str) -> None:await vectorize_file(- file_path=file_uri, summary_dict={"name": name}, parent_uri=parent_uri, ctx=ctx+ file_path=file_uri,+ summary_dict={"name": name},+ parent_uri=parent_uri,+ context_type=get_context_type_for_uri(file_uri),+ ctx=ctx,)await asyncio.gather(*(index_dir(dir_uri) for dir_uri in dir_uris))diff --git a/openviking/utils/embedding_utils.py b/openviking/utils/embedding_utils.pyindex 04148b9cc..451163c5c 100644--- a/openviking/utils/embedding_utils.py+++ b/openviking/utils/embedding_utils.py@@ -454,13 +454,11 @@ async def index_resource(if await viking_fs.exists(abstract_uri, ctx=ctx):content = await viking_fs.read_file(abstract_uri, ctx=ctx)- if isinstance(content, bytes):- abstract = content.decode("utf-8")+ abstract = content.decode("utf-8") if isinstance(content, bytes) else contentif await viking_fs.exists(overview_uri, ctx=ctx):content = await viking_fs.read_file(overview_uri, ctx=ctx)- if isinstance(content, bytes):- overview = content.decode("utf-8")+ overview = content.decode("utf-8") if isinstance(content, bytes) else contentif abstract or overview:await vectorize_directory_meta(uri, abstract, overview, context_type=context_type, ctx=ctx)