This commit is contained in:
Timothy Jaeryang Baek committed 2026-11-06 10:49:20 +09:00
1 parent 8e2ba2937e
commit d43759c2ca
3 files changed
+4 -16

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@ RAG_TOP_K=10
RAG_TOP_K_RERANKER=10
# Zero disables relevance score filtering.
RAG_RELEVANCE_THRESHOLD=0.0
# Always include full extracted text up to this character count per file or knowledge-base attachment.
# Always include full extracted text up to this character count per uploaded file.
# Only larger attachments switch to retrieval; this never truncates text. Set to 0 to always use retrieval.
RAG_FULL_TEXT_CHAR_THRESHOLD=50000
+2 -14
View File
@@ -1623,20 +1623,9 @@ async def get_sources_from_items(
extracted_collections.append(knowledge_base.id)
else:
force_full_context = item.get('context') == 'full' or bypass_embedding_and_retrieval
files = None
documents = []
if force_full_context or char_threshold > 0:
if item.get('context') == 'full' or bypass_embedding_and_retrieval:
files = await Knowledges.get_files_by_id(knowledge_base.id)
documents = [(file.data or {}).get('content') or '' for file in files]
# Missing extracted text must fall back to the index, not silently omit files.
auto_full_context = (
char_threshold > 0
and bool(documents)
and all(documents)
and sum(len(content) for content in documents) <= char_threshold
)
if force_full_context or auto_full_context:
query_result = {
'documents': [documents],
'metadatas': [
@@ -1651,8 +1640,7 @@ async def get_sources_from_items(
# Legacy KB: item.collection_names is client-supplied.
# Validate against the KB's actual files to prevent
# cross-tenant collection name substitution.
if files is None:
files = await Knowledges.get_files_by_id(knowledge_base.id)
files = await Knowledges.get_files_by_id(knowledge_base.id)
owned_names = {f'file-{f.id}' for f in files}
owned_names.add(knowledge_base.id)
valid_names = [n for n in (item.get('collection_names') or []) if n in owned_names]
+1 -1
View File
@@ -3002,7 +3002,7 @@
"settings.admin.documents.fullContextMode.description": "Include complete documents regardless of the full text threshold.",
"settings.admin.documents.fullContextMode.label": "Always Use Full Text",
"settings.admin.documents.fullTextCharThreshold.label": "Full Text Threshold (Characters)",
"settings.admin.documents.fullTextCharThreshold.description": "Include the complete extracted text of each uploaded file up to this character count. Only larger attachments switch to retrieval; text is never truncated at this threshold. Knowledge-base attachments count their files together. Set to 0 to always use retrieval. Explicit full-context selections still take priority.",
"settings.admin.documents.fullTextCharThreshold.description": "Include the complete extracted text of each uploaded file up to this character count. Only larger files switch to retrieval; text is never truncated at this threshold. Set to 0 to always use retrieval. Explicit full-context selections still take priority.",
"settings.admin.documents.googleDrive.description": "Allow Google Drive as a document source.",
"settings.admin.documents.googleDrive.label": "Google Drive",
"settings.admin.documents.headers.description": "Additional JSON headers sent to the external document loader.",