email parser document
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
class KnowledgeEmailSource:
|
||||
def __init__(self, config:dict):
|
||||
def __init__(self, env: KnowledgePipelineEnvironment, config:dict):
|
||||
self.config = config
|
||||
self.config["type"] = "email"
|
||||
|
||||
@@ -15,11 +15,6 @@ class KnowledgeEmailSource:
|
||||
("imap_port", "imap port")
|
||||
]
|
||||
|
||||
@classmethod
|
||||
def local_root(cls):
|
||||
user_data_dir = AIStorage.get_instance().get_myai_dir()
|
||||
return os.path.abspath(f"{user_data_dir}/knowledge/email")
|
||||
|
||||
async def run_once(self):
|
||||
# read config from toml file
|
||||
# and read from config config.local.toml if exists (config.local.toml is ignored by git)
|
||||
|
||||
@@ -46,7 +46,7 @@ class KnowledgePipelineManager:
|
||||
input_init = runpy.run_path(input_module)["init"]
|
||||
else:
|
||||
input_init = self.input_modules.get(input_module)
|
||||
input_params = config["input"]["params"]
|
||||
input_params = config["input"].get("params")
|
||||
|
||||
parser_module = config["parser"]["module"]
|
||||
_, ext = os.path.splitext(parser_module)
|
||||
@@ -55,7 +55,7 @@ class KnowledgePipelineManager:
|
||||
parser_init = runpy.run_path(parser_module)["init"]
|
||||
else:
|
||||
parser_init = self.parser_modules.get(parser_module)
|
||||
parser_params = config["parser"]["params"]
|
||||
parser_params = config["parser"].get("params")
|
||||
|
||||
|
||||
data_path = os.path.join(self.root_dir, name)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import datetime
|
||||
import sqlite3
|
||||
import os
|
||||
import logging
|
||||
from . import ObjectID, KnowledgeStore
|
||||
from enum import Enum
|
||||
|
||||
@@ -66,12 +67,16 @@ class KnowledgePipelineEnvironment:
|
||||
os.makedirs(pipeline_path)
|
||||
self.pipeline_path = pipeline_path
|
||||
self.journal = KnowledgePipelineJournalClient(pipeline_path)
|
||||
self.logger = logging.getLogger()
|
||||
|
||||
def get_journal(self) -> KnowledgePipelineJournalClient:
|
||||
return self.journal
|
||||
|
||||
def get_knowledge_store(self) -> KnowledgeStore:
|
||||
return self.knowledge_store
|
||||
|
||||
def get_logger(self) -> logging.Logger:
|
||||
return self.logger
|
||||
|
||||
class KnowledgePipelineState(Enum):
|
||||
INIT = 0
|
||||
|
||||
Reference in New Issue
Block a user