shell knowledge commands
This commit is contained in:
@@ -49,7 +49,7 @@ class DocumentObjectBuilder:
|
||||
self.text = text
|
||||
return self
|
||||
|
||||
def build(self, relation_store: ObjectRelationStore) -> DocumentObject:
|
||||
def build(self) -> DocumentObject:
|
||||
chunk_list = KnowledgeStore().get_chunk_list_writer().create_chunk_list_from_text(
|
||||
self.text,
|
||||
1024 * 4,
|
||||
@@ -60,6 +60,6 @@ class DocumentObjectBuilder:
|
||||
|
||||
# Add relation to store
|
||||
for chunk_id in chunk_list.chunk_list:
|
||||
relation_store.add_relation(chunk_id, doc_id)
|
||||
KnowledgeStore().get_relation_store().add_relation(chunk_id, doc_id)
|
||||
|
||||
return doc
|
||||
|
||||
@@ -94,7 +94,7 @@ class EmailObjectBuilder:
|
||||
with open(content_file, "r", encoding="utf-8") as f:
|
||||
text = f.read()
|
||||
|
||||
document = DocumentObjectBuilder({}, {}, text).build(relation_store=relation)
|
||||
document = DocumentObjectBuilder({}, {}, text).build()
|
||||
document_id = document.calculate_id()
|
||||
store.put_object(document_id, document.encode())
|
||||
documents = {"email.txt": document_id}
|
||||
|
||||
@@ -52,7 +52,7 @@ def get_exif_data(image_path: str):
|
||||
return {
|
||||
TAGS.get(key): exif_data[key]
|
||||
for key in exif_data.keys()
|
||||
if key in TAGS and isinstance(exif_data[key], (bytes, str))
|
||||
if key in TAGS and isinstance(exif_data[key], str)
|
||||
}
|
||||
else:
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user