add default knowledge source dir
This commit is contained in:
@@ -267,6 +267,7 @@ class KnowledgeEmailSource:
|
|||||||
class KnowledgeDirSource:
|
class KnowledgeDirSource:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.config = config
|
self.config = config
|
||||||
|
config["path"] = os.path.abspath(config["path"])
|
||||||
self.config["type"] = "dir"
|
self.config["type"] = "dir"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -342,6 +343,11 @@ class KnowledgePipline:
|
|||||||
self.add_email_source(KnowledgeEmailSource(source_config))
|
self.add_email_source(KnowledgeEmailSource(source_config))
|
||||||
if source_config['type'] == 'dir':
|
if source_config['type'] == 'dir':
|
||||||
self.add_dir_source(KnowledgeDirSource(source_config))
|
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
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ class AIOS_Shell:
|
|||||||
|
|
||||||
async def handle_knowledge_commands(self, args):
|
async def handle_knowledge_commands(self, args):
|
||||||
show_text = FormattedText([("class:title", "sub command not support!\n"
|
show_text = FormattedText([("class:title", "sub command not support!\n"
|
||||||
"/knowledge add email | dir\n"
|
"/knowledge add dir\n"
|
||||||
"/knowledge journal [$topn]\n")])
|
"/knowledge journal [$topn]\n")])
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
return show_text
|
return show_text
|
||||||
@@ -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\tGive your Agent a Telegram account :\033[0m /connect $agent_name
|
||||||
\033[1;94m\tAdd personal files to the AI Knowledge Base. \033[0m
|
\033[1;94m\tAdd personal files to the AI Knowledge Base. \033[0m
|
||||||
\t\t1) Copy your file to ~/myai/data
|
\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\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\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
|
\033[1;94m\tOpen AI Bash (For Developer Only):\033[0m /open ai_bash
|
||||||
@@ -665,7 +665,7 @@ async def main():
|
|||||||
'/history $num $offset',
|
'/history $num $offset',
|
||||||
'/connect $target',
|
'/connect $target',
|
||||||
'/contact $name',
|
'/contact $name',
|
||||||
'/knowledge add email | dir',
|
'/knowledge add dir',
|
||||||
'/knowledge journal [$topn]',
|
'/knowledge journal [$topn]',
|
||||||
'/set_config $key',
|
'/set_config $key',
|
||||||
'/enable $feature',
|
'/enable $feature',
|
||||||
|
|||||||
Reference in New Issue
Block a user