mod allegro

This commit is contained in:
l.gabrysiak 2025-02-28 21:05:03 +01:00
parent 4a264e38eb
commit 8d74e3becb
1 changed files with 4 additions and 2 deletions

View File

@ -21,13 +21,15 @@ client = weaviate.WeaviateClient(
# 2⃣ Pobranie dokumentów z Weaviate # 2⃣ Pobranie dokumentów z Weaviate
def fetch_documents(): def fetch_documents():
query = client.query.get("Document", ["content", "fileName"]).do() collection = client.collections.get("Documents")
response = collection.query.fetch_objects()
documents = [] documents = []
for item in query["data"]["Get"]["Document"]: for item in response["data"]["Get"]["Document"]:
file_name = item.get("fileName", "unknown_file") file_name = item.get("fileName", "unknown_file")
content = item.get("content", "") content = item.get("content", "")
if content: if content:
documents.append(f"fileName: {file_name}, content: {content}") documents.append(f"fileName: {file_name}, content: {content}")
print(f"fileName: {file_name}")
return documents return documents
documents = fetch_documents() documents = fetch_documents()