Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions context_chat_backend/chain/ingest/injest.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ def embed_sources(
f'{source.filename} ({_decode_latin_1(source.headers["title"])})'
for source in sources_filtered
],
'invalid_source_ids': [
source.filename for source in sources
if not is_valid_source_id(source.filename) # pyright: ignore[reportArgumentType]
],
'not_allowed_file_ids': [
source.filename for source in sources
if not _allowed_file(source)
],
'len(source_ids)': len(sources_filtered),
'len(total_source_ids)': len(sources),
})

vectordb = vectordb_loader.load()
Expand Down
3 changes: 2 additions & 1 deletion context_chat_backend/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def exec_in_proc(group=None, target=None, name=None, args=(), kwargs={}, *, daem


def is_valid_source_id(source_id: str) -> bool:
return re.match(r'^[a-zA-Z0-9_-]+__[a-zA-Z0-9_-]+: \d+$', source_id) is not None
# note the ":" in the item id part
return re.match(r'^[a-zA-Z0-9_-]+__[a-zA-Z0-9_-]+: [a-zA-Z0-9:-]+$', source_id) is not None


def is_valid_provider_id(provider_id: str) -> bool:
Expand Down
Loading