fix types and print middle dot in collections list

This commit is contained in:
2026-04-24 18:28:03 +02:00
parent c5b6b196b5
commit c6ad060e85
2 changed files with 8 additions and 2 deletions
+6 -2
View File
@@ -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: