mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-30 16:23:31 +00:00
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:
@@ -1031,6 +1031,7 @@ export default {
|
||||
endpoint: 'Endpoint',
|
||||
targetPlatform: 'Target Platform',
|
||||
upstreamModel: 'Upstream Model',
|
||||
upstreamModelHint: 'Leave empty to pass the original requested model through: under prefix match each matched model forwards verbatim (e.g. deepseek-v4-flash and deepseek-v4-pro each forwarded as-is); set a value to forward every matched request to that fixed model.',
|
||||
notes: 'Notes',
|
||||
enabled: 'Enabled',
|
||||
preview: 'Preview',
|
||||
|
||||
@@ -1028,6 +1028,7 @@ export default {
|
||||
endpoint: '端点',
|
||||
targetPlatform: '目标平台',
|
||||
upstreamModel: '上游模型',
|
||||
upstreamModelHint: '留空表示透传原始请求模型:前缀匹配下每个命中模型各自原样转发(如 deepseek-v4-flash、deepseek-v4-pro 分别转发);填写则所有命中请求都固定转发该模型。',
|
||||
notes: '备注',
|
||||
enabled: '启用',
|
||||
preview: '预览',
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user