enh: file context model setting

This commit is contained in:
Tim Baek
2026-01-09 03:41:43 -05:00
parent 1138929f4d
commit daccf0713e
3 changed files with 31 additions and 8 deletions
+16 -7
View File
@@ -1854,13 +1854,22 @@ async def process_chat_payload(request, form_data, user, metadata, model):
except Exception as e:
log.exception(e)
try:
form_data, flags = await chat_completion_files_handler(
request, form_data, extra_params, user
)
sources.extend(flags.get("sources", []))
except Exception as e:
log.exception(e)
# Check if file context extraction is enabled for this model (default True)
file_context_enabled = (
model.get("info", {})
.get("meta", {})
.get("capabilities", {})
.get("file_context", True)
)
if file_context_enabled:
try:
form_data, flags = await chat_completion_files_handler(
request, form_data, extra_params, user
)
sources.extend(flags.get("sources", []))
except Exception as e:
log.exception(e)
# If context is not empty, insert it into the messages
if sources and prompt: