This commit is contained in:
Timothy Jaeryang Baek committed 2026-08-16 22:10:24 -07:00
1 parent 9c54711cc6
commit 705d1aeaf2
1 file changed
+13 -1
+13 -1
View File
@@ -505,6 +505,11 @@ _UTILITY_PATTERNS = [
"tags_generation",
]
_UTILITY_MODEL_CONFIG_KEYS = {
"summary_generation": "chat.context_compaction.model",
"title_generation": "chat.title_generation.model",
}
async def _intercept_task(
request: Request,
@@ -694,6 +699,13 @@ async def _resolve_utility_model(request: Request, workspace: str, app_state=Non
)
candidates: list[str] = []
task_header = request.headers.get(OWUI_TASK_HEADER, "").strip()
preferred_config_key = _UTILITY_MODEL_CONFIG_KEYS.get(task_header)
if preferred_config_key:
preferred_model = await Config.get(preferred_config_key)
if isinstance(preferred_model, str) and preferred_model.strip():
candidates.append(preferred_model.strip())
gateway_model = await Config.get("gateway.model")
if isinstance(gateway_model, str) and gateway_model.strip():
candidates.append(gateway_model.strip())
@@ -710,7 +722,7 @@ async def _resolve_utility_model(request: Request, workspace: str, app_state=Non
if isinstance(default_model, str) and default_model.strip():
candidates.append(default_model.strip())
for model_id in candidates:
for model_id in dict.fromkeys(candidates):
try:
target = await resolve_model_target(model_id, app_state)
if isinstance(target, ApiModelTarget):