fix(admin): identify local edit model providers

This commit is contained in:
134 2026-08-10 21:52:49 +08:00
parent 667bba8f53
commit cd1639b4d7
4 changed files with 11 additions and 12 deletions

View File

@ -55,6 +55,7 @@ import {
export function LocalAiImagePipelineSections({ export function LocalAiImagePipelineSections({
modelsData, modelsData,
providersData,
rmbgConfig, rmbgConfig,
setRmbgConfig, setRmbgConfig,
enhanceConfig, enhanceConfig,
@ -115,22 +116,17 @@ export function LocalAiImagePipelineSections({
const availableImageModels = (modelsData?.models || []).filter( const availableImageModels = (modelsData?.models || []).filter(
(model) => model.supportsImageGen && model.isEnabled (model) => model.supportsImageGen && model.isEnabled
); );
const duplicateRuntimeModelIds = new Set( const providerNamesById = new Map(
availableImageModels (providersData?.providers || []).map((provider) => [
.filter( provider.id,
(model, index, models) => provider.name,
models.findIndex((candidate) => candidate.modelId === model.modelId) !== ])
index
)
.map((model) => model.modelId)
); );
const formatAiWashModelOptionLabel = ( const formatAiWashModelOptionLabel = (
model: (typeof availableImageModels)[number] model: (typeof availableImageModels)[number]
) => ) =>
`${model.displayName || model.modelId}${ `${model.displayName || model.modelId} · ${
duplicateRuntimeModelIds.has(model.modelId) providerNamesById.get(model.providerId) || model.modelId
? ` · 供应商 ${model.providerId.slice(0, 8)}`
: ""
}${model.isHidden ? " · 前台隐藏" : ""}`; }${model.isHidden ? " · 前台隐藏" : ""}`;
const resolveCanvasLocalEditSelectValue = (modelRef: string) => const resolveCanvasLocalEditSelectValue = (modelRef: string) =>
resolveCanvasLocalEditModelRef(availableImageModels, modelRef)?.id || resolveCanvasLocalEditModelRef(availableImageModels, modelRef)?.id ||

View File

@ -307,6 +307,7 @@ export type LayerSplitConfig = {
export type LocalAiImagePipelineSectionsProps = LocalAiSectionControlProps & { export type LocalAiImagePipelineSectionsProps = LocalAiSectionControlProps & {
modelsData?: AdminModelsData; modelsData?: AdminModelsData;
providersData?: AdminProvidersData;
rmbgConfig: RmbgConfig; rmbgConfig: RmbgConfig;
setRmbgConfig: Dispatch<SetStateAction<RmbgConfig>>; setRmbgConfig: Dispatch<SetStateAction<RmbgConfig>>;
enhanceConfig: EnhanceConfig; enhanceConfig: EnhanceConfig;

View File

@ -18449,6 +18449,7 @@ export function AdminSettingsClient() {
layerSplitConfig={layerSplitConfig} layerSplitConfig={layerSplitConfig}
modelsData={modelsData} modelsData={modelsData}
pointsSystemConfig={pointsSystemConfig} pointsSystemConfig={pointsSystemConfig}
providersData={providersData}
renderEnhanceProPresetEditor={renderEnhanceProPresetEditor} renderEnhanceProPresetEditor={renderEnhanceProPresetEditor}
rmbgConfig={rmbgConfig} rmbgConfig={rmbgConfig}
savedEnhanceProKeyRows={savedEnhanceProKeyRows} savedEnhanceProKeyRows={savedEnhanceProKeyRows}

View File

@ -49,6 +49,7 @@ test.describe("canvas scale adjust product lock", () => {
expect(settingsRoute).toContain("modelId: localEditModel?.id || \"\""); expect(settingsRoute).toContain("modelId: localEditModel?.id || \"\"");
expect(settingsPanel).toContain("resolveCanvasLocalEditSelectValue("); expect(settingsPanel).toContain("resolveCanvasLocalEditSelectValue(");
expect(settingsPanel).toContain("canvasLocalEditConfig.modelId"); expect(settingsPanel).toContain("canvasLocalEditConfig.modelId");
expect(settingsPanel).toContain("providerNamesById.get(model.providerId)");
expect(settingsPanel).toContain( expect(settingsPanel).toContain(
'<SelectItem key={model.id} value={model.id}>' '<SelectItem key={model.id} value={model.id}>'
); );