feat: add {{MODEL_ID}} placeholder for custom connection headers (#32426)

Custom headers on connections and tool servers could pass the chat, message, user and task to downstream services, but not which model the request was for. Chat requests can now use {{MODEL_ID}}, which holds the ID of the model handling the request; for a workspace model that is the workspace model's own ID. In a multi-model chat each model's request carries its own ID, so downstream services can route by model or log usage per model.

Fixes #30006
This commit is contained in:
Classic298 2026-10-14 22:00:41 +02:00 • committed by GitHub
parent fb3d92a6ef
commit bae22752d3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -144,6 +144,7 @@ def parse_custom_headers(
'{{FILE_NAME}}': metadata.get('file_name', '') or '',
'{{FILE_CONTENT_TYPE}}': metadata.get('file_content_type', '') or '',
'{{TASK}}': metadata.get('task', '') or '',
'{{MODEL_ID}}': metadata.get('model_id', '') or '',
'{{USER_ID}}': (user.id if user else '') or '',
'{{USER_NAME}}': (user.name.strip() if user else '') or '',
'{{USER_EMAIL}}': (user.email.strip() if user else '') or '',