fix(models): 系统渠道模型 - 上游 ID 重命名级联价格档并补管理端可见性
根因:价格档 provider_model_key 非空时优先于模型级上游键发往供应商,统一价格档曾把当时的顶层上游键固化为档位显式值,模型级重命名后被旧值静默遮蔽,任务请求继续发往旧上游模型(Agent 及其他入口共用该解析路径)。 - SaveAdminChannelModel 在模型级上游键变更时,把与旧值相同的档位键级联为新值;管理员显式配置的其他上游 SKU 不受影响 - 编辑无价格档旧模型不再预填顶层上游键;统一价格档检测到与模型级不一致的存量上游键时展示告警并支持一键清除恢复跟随模型默认;模型身份区提示档位独立上游键数量,比较口径统一剥 models/ 前缀 - 新增后端级联与请求解析回归测试、前端价格档表单单测 - 同步 backend-database.mdx 价格档语义与 pending-test.mdx 待验收项
This commit is contained in:
1 parent
da0531f6eb
commit
c995ad901e
8 files changed
+222
-5
No files matched your search
@@ -10,7 +10,7 @@ import { defaultModelCapabilityConfig, normalizeModelCapabilityConfig, type Mode
|
||||
import type { ModelProtocolDefinition } from "@/lib/model-protocols";
|
||||
import { createAdminChannelModel, testAdminChannelModel, updateAdminChannelModel, type ChannelModel } from "@/services/api/wallet";
|
||||
import type { ModelChannel } from "@/stores/use-config-store";
|
||||
import { defaultPriceTier, priceTierResolutionFromForm, priceTierVideoSecondsFromForm, skuSelectorFromForm } from "./channel-model-price-tier-form";
|
||||
import { defaultPriceTier, normalizeUpstreamModelKey, priceTierResolutionFromForm, priceTierVideoSecondsFromForm, skuSelectorFromForm } from "./channel-model-price-tier-form";
|
||||
import { PriceTierFields } from "./channel-model-price-tier-fields";
|
||||
import { changeChannelModelCapability, editorSectionForField, initialChannelModelValues, validateChannelModelPrices, validateChannelModelProtocol, type ChannelModelFormValues as FormValues, type EditorSection } from "./channel-model-editor-form";
|
||||
|
||||
@@ -50,6 +50,8 @@ export function ChannelModelEditor({
|
||||
const modelEnabled = Form.useWatch("enabled", form) !== false;
|
||||
const priceTiers = Form.useWatch("priceTiers", form) || [];
|
||||
const hasDefaultPriceTier = priceTiers.some((tier) => tier.matchMode === "default");
|
||||
const tiersWithOwnUpstream = priceTiers.filter((tier) => tier.providerModelKey?.trim());
|
||||
const modelUpstream = normalizeUpstreamModelKey(providerModelKey || modelKey);
|
||||
const busy = saving || testing;
|
||||
|
||||
const requestClose = () => {
|
||||
@@ -252,7 +254,7 @@ export function ChannelModelEditor({
|
||||
placeholder="例如:seedance-2-5"
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="providerModelKey" label="上游模型 ID" tooltip="实际发送给供应商;留空时使用产品模型标识。">
|
||||
<Form.Item name="providerModelKey" label="上游模型 ID" tooltip="实际发送给供应商;留空时使用产品模型标识。价格档可配置独立上游 ID,命中时优先于此处。">
|
||||
<Input placeholder="留空则使用产品模型标识" />
|
||||
</Form.Item>
|
||||
<Form.Item name="displayName" label="后台显示名称" tooltip="仅用于后台识别,不改变调用 ID。">
|
||||
@@ -262,6 +264,14 @@ export function ChannelModelEditor({
|
||||
<ModelIconPicker />
|
||||
</Form.Item>
|
||||
</div>
|
||||
{tiersWithOwnUpstream.length ? (
|
||||
<Alert
|
||||
type="info"
|
||||
showIcon
|
||||
title={`${tiersWithOwnUpstream.length} 个价格档配置了独立上游模型 ID`}
|
||||
description="命中的请求会优先使用价格档的上游 ID;修改上方上游模型 ID 时,只有与旧值相同的档位会自动跟随更新,其余保持不变。"
|
||||
/>
|
||||
) : null}
|
||||
</section>
|
||||
<section className="admin-model-editor-section">
|
||||
<SectionHeading title="能力与协议" description="先选任务类型,再选择对应的调用协议;更换后请核对参数与价格。" />
|
||||
@@ -376,6 +386,7 @@ export function ChannelModelEditor({
|
||||
capability={modelCapability}
|
||||
protocol={modelProtocol}
|
||||
capabilityConfig={capabilityConfig}
|
||||
modelUpstream={modelUpstream}
|
||||
onDirty={() => {
|
||||
dirtyRef.current = true;
|
||||
}}
|
||||
|
||||
Reference in new issue
Block a user