diff --git a/chromy/chroma_functions.py b/chromy/chroma_functions.py index c74b6f0..33b11b1 100644 --- a/chromy/chroma_functions.py +++ b/chromy/chroma_functions.py @@ -8,6 +8,7 @@ import chromadb from chromadb.api import ClientAPI from chromadb.api.types import QueryResult, Where from chromadb.errors import NotFoundError +from rich.text import Text from chromy.embed import EmbeddingRecord @@ -25,14 +26,17 @@ def _get_client_and_collection( return client, collection -def list_collections() -> list[str]: +def list_collections() -> list[Text]: client = chromadb.PersistentClient() collections = client.list_collections() if not collections: return [] - return [getattr(collection, "name", str(collection)) for collection in collections] + return [ + Text("ยท " + getattr(collection, "name", str(collection))) + for collection in collections + ] def create_collection(name: str) -> str: diff --git a/chromy/handlers/list_collections.py b/chromy/handlers/list_collections.py index 40b251f..6762583 100644 --- a/chromy/handlers/list_collections.py +++ b/chromy/handlers/list_collections.py @@ -6,9 +6,11 @@ from chromy.utilities import print_lines def handle_list_collections() -> int: collections = list_collections() + if not collections: print("No collections found.") return 0 print_lines(collections) + return 0