Skip to content

Commit

Permalink
Merge pull request #123 from mindflowai/patch
Browse files Browse the repository at this point in the history
Patch broken release
  • Loading branch information
steegecs authored Jun 20, 2023
2 parents d4bbccb + fad88e8 commit 5a32999
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mindflow/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.5.0"
__version__ = "0.5.1"
Empty file added mindflow/core/__init__.py
Empty file.
17 changes: 13 additions & 4 deletions mindflow/core/commands/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@

def run_delete(document_paths: List[str]) -> str:
"""Delete documents from MindFlow index."""
document_references: List[DocumentReference] = resolve_paths_to_document_references(document_paths)

document_ids = [document_id for document_id in [get_document_id(document_reference.path, document_reference.document_type) for document_reference in document_references] if document_id is not None]
document_references: List[DocumentReference] = resolve_paths_to_document_references(
document_paths
)

document_ids = [
document_id
for document_id in [
get_document_id(document_reference.path, document_reference.document_type)
for document_reference in document_references
]
if document_id is not None
]

if not document_ids:
return "No document IDs resolved. Nothing to delete."
Expand All @@ -30,4 +39,4 @@ def run_delete(document_paths: List[str]) -> str:
Document.delete_bulk(document_ids)
DocumentChunk.delete_bulk(document_chunk_ids)

return True, "Documents and associated chunks deleted successfully."
return "Documents and associated chunks deleted successfully."
2 changes: 1 addition & 1 deletion mindflow/core/commands/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def run_index(document_paths: List[str]) -> str:
indexable_documents := get_indexable_documents(
document_references, completion_model
)
):
):
return "No documents to index"

print_total_size_of_documents(indexable_documents)
Expand Down
4 changes: 3 additions & 1 deletion mindflow/core/commands/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def run_query(document_paths: List[str], query: str) -> str:
top_k=100,
)
):
return "No index for requested hashes. Please generate index for passed content."
return (
"No index for requested hashes. Please generate index for passed content."
)

document_selection_batch: List[Tuple[str, DocumentChunk]] = [
(document_hash_to_path[document_chunk.id.split("_")[0]], document_chunk)
Expand Down
2 changes: 1 addition & 1 deletion mindflow/core/file_processing/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ def get_all_unignored_git_files_from_path(path: Union[str, os.PathLike]) -> List
)
git_files = output.stdout.decode().strip().split("\n")
return [os.path.abspath(os.path.join(os.fspath(path), f)) for f in git_files]
except GitError as error:
except subprocess.CalledProcessError as error:
logging.debug("Failed extract git files with 'git ls-files': %s", error)
return []

0 comments on commit 5a32999

Please sign in to comment.