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: 修复s3fs适配 (#52)
chuanbao666e82d94021c8f
diff --git a/.gitignore b/.gitignoreindex 618ee4eb3..09ae241fd 100644--- a/.gitignore+++ b/.gitignore@@ -151,4 +151,5 @@ cython_debug/openviking/bin/test_scripts/test_large_scale_collection/+third_party/agfs/bin/openviking/_version.pydiff --git a/openviking/agfs_manager.py b/openviking/agfs_manager.pyindex 161b7e769..6e3d18123 100644--- a/openviking/agfs_manager.py+++ b/openviking/agfs_manager.py@@ -77,6 +77,9 @@ class AGFSManager:self.s3_region = config.s3_regionself.s3_access_key = config.s3_access_keyself.s3_secret_key = config.s3_secret_key+ self.s3_endpoint = config.s3_endpoint+ self.s3_prefix = config.s3_prefix+ self.s3_use_ssl = config.s3_use_sslself.process: Optional[subprocess.Popen] = Noneself.config_file: Optional[Path] = None@@ -145,14 +148,20 @@ class AGFSManager:},}elif self.backend == "s3":+ # AGFS S3 backend configuration (s3fs plugin)+ # This enables AGFS to mount an S3 bucket as a local filesystem.+ # Implementation details: third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.goconfig["plugins"]["s3fs"] = {"enabled": True,"path": "/local","config": {"bucket": self.s3_bucket,"region": self.s3_region,- "access_key": self.s3_access_key,- "secret_key": self.s3_secret_key,+ "access_key_id": self.s3_access_key,+ "secret_access_key": self.s3_secret_key,+ "endpoint": self.s3_endpoint,+ "prefix": self.s3_prefix,+ "disable_ssl": not self.s3_use_ssl,},}elif self.backend == "memory":diff --git a/openviking/storage/viking_fs.py b/openviking/storage/viking_fs.pyindex 8525ad2c2..b83db3d85 100644--- a/openviking/storage/viking_fs.py+++ b/openviking/storage/viking_fs.py@@ -147,7 +147,8 @@ class VikingFS:except Exception:passpath = self._uri_to_path(uri)- return await asyncio.to_thread(self.agfs.mkdir, path, mode)+ # fix s3fs+ return self._ensure_parent_dirs(path)async def rm(self, uri: str, recursive: bool = False) -> Dict[str, Any]:"""Delete file/directory + recursively update vector index."""diff --git a/openviking/utils/config/agfs_config.py b/openviking/utils/config/agfs_config.pyindex 166f1ae40..454b23552 100644--- a/openviking/utils/config/agfs_config.py+++ b/openviking/utils/config/agfs_config.py@@ -27,13 +27,40 @@ class AGFSConfig(BaseModel):retry_times: int = Field(default=3, description="AGFS retry times on failure")# S3 backend configuration+ # These settings are used when backend is set to 's3'.+ # AGFS will act as a gateway to the specified S3 bucket.s3_bucket: Optional[str] = Field(default=None, description="S3 bucket name")- s3_region: Optional[str] = Field(default=None, description="S3 region")+ s3_region: Optional[str] = Field(+ default=None,+ description="AWS region where the bucket is located (e.g., us-east-1, cn-beijing)",+ )- s3_access_key: Optional[str] = Field(default=None, description="S3 access key")+ s3_access_key: Optional[str] = Field(+ default=None,+ description="S3 access key ID. If not provided, AGFS may attempt to use environment variables or IAM roles.",+ )- s3_secret_key: Optional[str] = Field(default=None, description="S3 secret key")+ s3_secret_key: Optional[str] = Field(+ default=None,+ description="S3 secret access key corresponding to the access key ID.",+ )++ s3_endpoint: Optional[str] = Field(+ default=None,+ description="Custom S3 endpoint URL. Required for S3-compatible services like MinIO or LocalStack. "+ "Leave empty for standard AWS S3.",+ )++ s3_prefix: Optional[str] = Field(+ default="",+ description="Optional key prefix for namespace isolation. All objects will be stored under this prefix.",+ )++ s3_use_ssl: bool = Field(+ default=True,+ description="Enable/Disable SSL (HTTPS) for S3 connections. Set to False for local testing without HTTPS.",+ )@model_validator(mode="after")def validate_config(self):@@ -51,6 +78,8 @@ class AGFSConfig(BaseModel):missing = []if not self.s3_bucket:missing.append("s3_bucket")+ if not self.s3_endpoint:+ missing.append("s3_endpoint")if not self.s3_region:missing.append("s3_region")if not self.s3_access_key:diff --git a/openviking/utils/config/open_viking_config.py b/openviking/utils/config/open_viking_config.pyindex fe5c17051..ada70a23d 100644--- a/openviking/utils/config/open_viking_config.py+++ b/openviking/utils/config/open_viking_config.py@@ -290,7 +290,7 @@ def initialize_openviking_config(# Configure storage based on provided parametersif path:# Embedded mode: local storage- config.storage.agfs.backend = "local"+ config.storage.agfs.backend = config.storage.agfs.backend or "local"config.storage.agfs.path = pathconfig.storage.vectordb.backend = "local"config.storage.vectordb.path = path