fix(composite): pass the requested model through when a prefix route leaves upstream_model empty

Composite model routes support a match_type: prefix mode with an optional
upstream_model. Leaving upstream_model empty is meant to pass the concrete
requested model through to the upstream, but every request matching the prefix
collapsed to the route's public_model instead. A route with
public_model=deepseek-v4, match_type=prefix and an empty upstream_model
forwarded both deepseek-v4-flash and deepseek-v4-pro upstream as deepseek-v4.

Root cause: normalizeCompositeRouteInput backfilled an empty upstream_model with
public_model at save time, so CompositeRouteResolver.Resolve never reached its
"upstreamModel == '' -> concrete requested model" fallback.

- Skip the backfill for prefix routes only; an empty upstream_model stays empty
  and Resolve passes the concrete requested model through.
- exact routes keep the backfill (model == public_model, so persisted/display
  contract is unchanged).
- Explicit upstream_model still forwards that fixed model in every mode.
- Frontend: add an upstream_model hint (zh/en) documenting empty = passthrough.
This commit is contained in:
visa2
2026-07-25 10:20:50 +08:00
parent cb24522dd5
commit 386b57bb77
6 changed files with 93 additions and 2 deletions
+3
View File
@@ -3809,6 +3809,9 @@
class="input"
placeholder="gpt-5"
/>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
{{ t("admin.groups.compositeRoutes.upstreamModelHint") }}
</p>
</div>
<div>