mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
Merge 8f4db96c06 into fd10463069
This commit is contained in:
commit
e50ea15149
1 changed files with 20 additions and 6 deletions
|
|
@ -576,13 +576,27 @@ class OpenVikingMemoryProvider(MemoryProvider):
|
|||
return tool_error("uri is required")
|
||||
|
||||
level = args.get("level", "overview")
|
||||
# Map our level names to OpenViking GET endpoints
|
||||
if level == "abstract":
|
||||
resp = self._client.get("/api/v1/content/abstract", params={"uri": uri})
|
||||
elif level == "full":
|
||||
|
||||
# Determine URI type so we route to the correct endpoint.
|
||||
# abstract/overview are directory-only; files must use /content/download.
|
||||
try:
|
||||
stat_resp = self._client.get("/api/v1/fs/stat", params={"uri": uri})
|
||||
is_dir = stat_resp.get("result", {}).get("isDir", False)
|
||||
except Exception:
|
||||
is_dir = False
|
||||
|
||||
if is_dir:
|
||||
# Directory — route by level as before
|
||||
if level == "abstract":
|
||||
resp = self._client.get("/api/v1/content/abstract", params={"uri": uri})
|
||||
elif level == "full":
|
||||
resp = self._client.get("/api/v1/content/read", params={"uri": uri})
|
||||
else: # overview
|
||||
resp = self._client.get("/api/v1/content/overview", params={"uri": uri})
|
||||
else:
|
||||
# File — abstract/overview endpoints don't support files;
|
||||
# use /content/read which handles both types.
|
||||
resp = self._client.get("/api/v1/content/read", params={"uri": uri})
|
||||
else: # overview
|
||||
resp = self._client.get("/api/v1/content/overview", params={"uri": uri})
|
||||
|
||||
result = resp.get("result", "")
|
||||
# result is a plain string from the content endpoints
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue