fix(model-picker): 模型选择 - 修复候选报价显示与同渠道模型跳回 (#556)
Original-Commit: 7a5e17e2112c3c23e081a1ecf3c33a654cf1e907 fix(model-picker): 模型选择 - 修复候选报价显示与同渠道模型跳回
This commit is contained in:
@@ -311,7 +311,7 @@ function emptyModelLabel(config: AiConfig, capability?: ModelCapability) {
|
||||
return config.models.length ? `暂无匹配的${label}模型` : "当前没有可用模型,请联系管理员或检查模型配置";
|
||||
}
|
||||
|
||||
function ModelLabel({
|
||||
export function ModelLabel({
|
||||
config,
|
||||
model,
|
||||
capability,
|
||||
@@ -358,7 +358,8 @@ function ModelLabel({
|
||||
</span>
|
||||
{showPrice ? (
|
||||
<span className="ml-auto shrink-0 pl-2">
|
||||
<ModelPrice price={modelMenuPrice(config, model, capability, !requirements, requirements)} />
|
||||
{/* 候选模型展示自身价目;当前参数的精确报价只在选中后的触发器显示。 */}
|
||||
<ModelPrice price={modelMenuPrice(config, model, capability, true, requirements)} />
|
||||
</span>
|
||||
) : null}
|
||||
{!creationVariant && meta.time ? (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { configuredModelDisplayName, groupModelsByDisplayName, type DisplayModelGroup } from "@/lib/model-selection";
|
||||
import { configuredModelDisplayName, groupModelsByDisplayName, isDirectSystemModel, type DisplayModelGroup } from "@/lib/model-selection";
|
||||
import { modelIcon, modelOptionName, PUBLIC_MODEL_CATALOG_ID, resolveModelChannel, type AiConfig } from "@/stores/use-config-store";
|
||||
|
||||
export type ModelPickerGroup = {
|
||||
@@ -10,12 +10,7 @@ export type ModelPickerGroup = {
|
||||
models: DisplayModelGroup[];
|
||||
};
|
||||
|
||||
export function isDirectSystemModel(config: AiConfig, value: string) {
|
||||
if (!value) return false;
|
||||
const channel = resolveModelChannel(config, value);
|
||||
const cost = channel.modelCosts?.find((item) => item.model === modelOptionName(value));
|
||||
return channel.scope === "system" && channel.id !== PUBLIC_MODEL_CATALOG_ID && !cost?.logicalModelId;
|
||||
}
|
||||
export { isDirectSystemModel } from "@/lib/model-selection";
|
||||
|
||||
export function modelChannelLabel(config: AiConfig, value: string) {
|
||||
const channel = resolveModelChannel(config, value);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { defaultImageCapabilityConfig, modelCapabilityConfigFor, normalizeImageValue, normalizeVideoValue, STANDARD_IMAGE_SIZE_VALUES, videoDurationAllowed, type ImageCapabilityConfig } from "@/lib/model-capabilities";
|
||||
import { videoResolutionComparisonKey } from "@/lib/video-generation-options";
|
||||
import { imageSizePresets } from "@/lib/image-size-presets";
|
||||
import { modelOptionName, resolveModelChannel, selectableModelsByCapability, type AiConfig, type ModelCapability } from "@/stores/use-config-store";
|
||||
import { modelOptionName, PUBLIC_MODEL_CATALOG_ID, resolveModelChannel, selectableModelsByCapability, type AiConfig, type ModelCapability } from "@/stores/use-config-store";
|
||||
|
||||
export type ModelInputSummary = {
|
||||
textCount: number;
|
||||
@@ -32,12 +32,20 @@ export type ModelReferenceLimits = {
|
||||
maxAudios: number;
|
||||
};
|
||||
|
||||
export function isDirectSystemModel(config: AiConfig, value: string) {
|
||||
if (!value) return false;
|
||||
const channel = resolveModelChannel(config, value);
|
||||
const cost = channel.modelCosts?.find((item) => item.model === modelOptionName(value));
|
||||
return channel.scope === "system" && channel.id !== PUBLIC_MODEL_CATALOG_ID && !cost?.logicalModelId;
|
||||
}
|
||||
|
||||
export function groupModelsByDisplayName(config: AiConfig, models: string[]): DisplayModelGroup[] {
|
||||
const groups = new Map<string, DisplayModelGroup>();
|
||||
models.forEach((model) => {
|
||||
const channel = resolveModelChannel(config, model);
|
||||
const label = configuredModelDisplayName(config, model);
|
||||
const key = `${channel.id}\u0000${label.toLocaleLowerCase()}`;
|
||||
// 平台直连模型是独立的渠道 SKU;同名只用于菜单展示,不能合并能力或自动改选。
|
||||
const key = isDirectSystemModel(config, model) ? JSON.stringify([channel.id, modelOptionName(model)]) : `${channel.id}\u0000${label.toLocaleLowerCase()}`;
|
||||
const current = groups.get(key);
|
||||
if (current) current.models.push(model);
|
||||
else groups.set(key, { key, label, models: [model] });
|
||||
|
||||
Reference in New Issue
Block a user