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: derive context_type from URI in index_resource (#1346)
yc111233077e20e3e04b
diff --git a/openviking/utils/embedding_utils.py b/openviking/utils/embedding_utils.pyindex cf442cc0a..bb0e7dcf1 100644--- a/openviking/utils/embedding_utils.py+++ b/openviking/utils/embedding_utils.py@@ -11,6 +11,7 @@ from datetime import datetimefrom typing import Dict, Optionalfrom openviking.core.context import Context, ContextLevel, ResourceContentType, Vectorize+from openviking.core.directories import get_context_type_for_urifrom openviking.server.identity import RequestContextfrom openviking.storage.queuefs import get_queue_managerfrom openviking.storage.queuefs.embedding_msg_converter import EmbeddingMsgConverter@@ -326,8 +327,13 @@ async def index_resource(1. Reads .abstract.md and .overview.md and vectorizes them.2. Scans files in the directory and vectorizes them.++ The context_type is derived from the URI so that memory directories+ (``/memories/``) are indexed as ``"memory"`` rather than the default+ ``"resource"``."""viking_fs = get_viking_fs()+ context_type = get_context_type_for_uri(uri)# 1. Index Directory Metadataabstract_uri = f"{uri}/.abstract.md"@@ -347,7 +353,9 @@ async def index_resource(overview = content.decode("utf-8")if abstract or overview:- await vectorize_directory_meta(uri, abstract, overview, ctx=ctx)+ await vectorize_directory_meta(+ uri, abstract, overview, context_type=context_type, ctx=ctx+ )# 2. Index Filestry:@@ -368,7 +376,11 @@ async def index_resource(# For direct indexing, we might not have summaries.# We pass empty summary_dict, vectorize_file will try to read content for text files.await vectorize_file(- file_path=file_uri, summary_dict={"name": file_name}, parent_uri=uri, ctx=ctx+ file_path=file_uri,+ summary_dict={"name": file_name},+ parent_uri=uri,+ context_type=context_type,+ ctx=ctx,)except Exception as e: