Spaces:
Sleeping
Sleeping
Update private_gpt/server/ingest/ingest_service.py
Browse files
private_gpt/server/ingest/ingest_service.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import logging
|
2 |
import tempfile
|
3 |
from pathlib import Path
|
4 |
-
from typing import BinaryIO
|
5 |
|
6 |
from injector import inject, singleton
|
7 |
from llama_index import (
|
@@ -121,3 +121,9 @@ class IngestService:
|
|
121 |
"Deleting the ingested document=%s in the doc and index store", doc_id
|
122 |
)
|
123 |
self.ingest_component.delete(doc_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import logging
|
2 |
import tempfile
|
3 |
from pathlib import Path
|
4 |
+
from typing import BinaryIO, List
|
5 |
|
6 |
from injector import inject, singleton
|
7 |
from llama_index import (
|
|
|
121 |
"Deleting the ingested document=%s in the doc and index store", doc_id
|
122 |
)
|
123 |
self.ingest_component.delete(doc_id)
|
124 |
+
|
125 |
+
def list_ingested_filenames(self) -> List[str]:
|
126 |
+
"""Lists the filenames of ingested documents."""
|
127 |
+
ingested_documents = self.list_ingested()
|
128 |
+
unique_filenames = set(doc.doc_metadata.get("file_name", "") for doc in ingested_documents)
|
129 |
+
return list(unique_filenames)
|