Fixed a source for documents uploaded from GCS (#8912)

Sets source for documents uploaded from GCS to source on gcs
#8911

Co-authored-by: Leonid Kuligin <kuligin@google.com>
This commit is contained in:
Leonid Kuligin 2023-08-08 15:34:43 +02:00 committed by GitHub
parent e74a605379
commit 52d6b91c18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,4 +69,8 @@ class GCSFileLoader(BaseLoader):
# Download the file to a destination
blob.download_to_filename(file_path)
loader = self._loader_func(file_path)
return loader.load()
docs = loader.load()
for doc in docs:
if "source" in doc.metadata:
doc.metadata["source"] = f"gs://{self.bucket}/{self.blob}"
return docs