forked from agent0ai/agent-zero
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathknowledge_path_get.py
More file actions
25 lines (20 loc) · 909 Bytes
/
Copy pathknowledge_path_get.py
File metadata and controls
25 lines (20 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from python.helpers.api import ApiHandler, Request, Response
from python.helpers import files, memory, notification, projects, notification
import os
from werkzeug.utils import secure_filename
class GetKnowledgePath(ApiHandler):
async def process(self, input: dict, request: Request) -> dict | Response:
ctxid = input.get("ctxid", "")
if not ctxid:
raise Exception("No context id provided")
context = self.use_context(ctxid)
project_name = projects.get_context_project_name(context)
if project_name:
knowledge_folder = projects.get_project_meta_folder(project_name, "knowledge")
else:
knowledge_folder = memory.get_custom_knowledge_subdir_abs(context.agent0)
knowledge_folder = files.normalize_a0_path(knowledge_folder)
return {
"ok": True,
"path": knowledge_folder,
}