Skip to content

Commit

Permalink
add default knowledge source dir
Browse files Browse the repository at this point in the history
  • Loading branch information
photosssa committed Sep 28, 2023
1 parent 56c0202 commit ff4875d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/aios_kernel/knowledge_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def save_email(self, mail: mailparser.MailParser):
class KnowledgeDirSource:
def __init__(self, config):
self.config = config
config["path"] = os.path.abspath(config["path"])
self.config["type"] = "dir"

@classmethod
Expand Down Expand Up @@ -342,6 +343,11 @@ def initial(self):
self.add_email_source(KnowledgeEmailSource(source_config))
if source_config['type'] == 'dir':
self.add_dir_source(KnowledgeDirSource(source_config))
user_data_dir = AIStorage.get_instance().get_myai_dir()
default_dir = os.path.abspath(f"{user_data_dir}/data")
if not os.path.exists(default_dir):
os.makedirs(default_dir)
self.add_dir_source(KnowledgeDirSource({"path": default_dir}))

return True

Expand Down
6 changes: 3 additions & 3 deletions src/service/aios_shell/aios_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ async def handle_contact_commands(self,args):

async def handle_knowledge_commands(self, args):
show_text = FormattedText([("class:title", "sub command not support!\n"
"/knowledge add email | dir\n"
"/knowledge add dir\n"
"/knowledge journal [$topn]\n")])
if len(args) < 1:
return show_text
Expand Down Expand Up @@ -585,7 +585,7 @@ def print_welcome_screen():
\033[1;94m\tGive your Agent a Telegram account :\033[0m /connect $agent_name
\033[1;94m\tAdd personal files to the AI Knowledge Base. \033[0m
\t\t1) Copy your file to ~/myai/data
\t\t2) /knowlege add dir
\t\t2) /knowledge add dir
\033[1;94m\tSearch your knowledge base :\033[0m /open Mia
\033[1;94m\tCheck the progress of AI reading personal data :\033[0m /knowledge journal
\033[1;94m\tOpen AI Bash (For Developer Only):\033[0m /open ai_bash
Expand Down Expand Up @@ -665,7 +665,7 @@ async def main():
'/history $num $offset',
'/connect $target',
'/contact $name',
'/knowledge add email | dir',
'/knowledge add dir',
'/knowledge journal [$topn]',
'/set_config $key',
'/enable $feature',
Expand Down

0 comments on commit ff4875d

Please sign in to comment.