Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

feat: make temp uri readable, and enlarge timeout of add-resource (#165)

MaojiaSheng4482e7e70050
diff --git a/openviking/storage/viking_fs.py b/openviking/storage/viking_fs.py
index 2b42dc332..2b3943aba 100644
--- a/openviking/storage/viking_fs.py
+++ b/openviking/storage/viking_fs.py
@@ -1021,10 +1021,7 @@ class VikingFS:
def create_temp_uri(self) -> str:
"""Create temp directory URI."""
- import uuid
-
- temp_id = uuid.uuid4().hex[:8]
- return f"viking://temp/{temp_id}"
+ return VikingURI.create_temp_uri()
async def delete_temp(self, temp_uri: str) -> None:
"""Delete temp directory and its contents."""
diff --git a/openviking_cli/cli/commands/resources.py b/openviking_cli/cli/commands/resources.py
index 7c9ba94e6..92940dd7e 100644
--- a/openviking_cli/cli/commands/resources.py
+++ b/openviking_cli/cli/commands/resources.py
@@ -20,7 +20,7 @@ def register(app: typer.Typer) -> None:
reason: str = typer.Option("", help="Reason for import"),
instruction: str = typer.Option("", help="Additional instruction"),
wait: bool = typer.Option(False, "--wait", help="Wait until processing is complete"),
- timeout: Optional[float] = typer.Option(None, help="Wait timeout in seconds"),
+ timeout: Optional[float] = typer.Option(600.0, help="Wait timeout in seconds"),
) -> None:
"""Add resources into OpenViking."""
run(
@@ -40,7 +40,7 @@ def register(app: typer.Typer) -> None:
ctx: typer.Context,
data: str = typer.Argument(..., help="Skill directory, SKILL.md, or raw content"),
wait: bool = typer.Option(False, "--wait", help="Wait until processing is complete"),
- timeout: Optional[float] = typer.Option(None, help="Wait timeout in seconds"),
+ timeout: Optional[float] = typer.Option(600.0, help="Wait timeout in seconds"),
) -> None:
"""Add a skill into OpenViking."""
run(
diff --git a/openviking_cli/utils/uri.py b/openviking_cli/utils/uri.py
index 5437f6013..9cf6d8565 100644
--- a/openviking_cli/utils/uri.py
+++ b/openviking_cli/utils/uri.py
@@ -244,3 +244,12 @@ class VikingURI:
def __hash__(self) -> int:
return hash(self.uri)
+
+ @classmethod
+ def create_temp_uri(cls) -> str:
+ """Create temp directory URI like viking://temp/MMDDHHMM_XXXXXX"""
+ import datetime
+ import uuid
+
+ temp_id = uuid.uuid4().hex[:6]
+ return f"viking://temp/{datetime.datetime.now().strftime('%m%d%H%M')}_{temp_id}"