fix(admin): identify local edit model providers
This commit is contained in:
parent
667bba8f53
commit
cd1639b4d7
@ -55,6 +55,7 @@ import {
|
||||
|
||||
export function LocalAiImagePipelineSections({
|
||||
modelsData,
|
||||
providersData,
|
||||
rmbgConfig,
|
||||
setRmbgConfig,
|
||||
enhanceConfig,
|
||||
@ -115,22 +116,17 @@ export function LocalAiImagePipelineSections({
|
||||
const availableImageModels = (modelsData?.models || []).filter(
|
||||
(model) => model.supportsImageGen && model.isEnabled
|
||||
);
|
||||
const duplicateRuntimeModelIds = new Set(
|
||||
availableImageModels
|
||||
.filter(
|
||||
(model, index, models) =>
|
||||
models.findIndex((candidate) => candidate.modelId === model.modelId) !==
|
||||
index
|
||||
)
|
||||
.map((model) => model.modelId)
|
||||
const providerNamesById = new Map(
|
||||
(providersData?.providers || []).map((provider) => [
|
||||
provider.id,
|
||||
provider.name,
|
||||
])
|
||||
);
|
||||
const formatAiWashModelOptionLabel = (
|
||||
model: (typeof availableImageModels)[number]
|
||||
) =>
|
||||
`${model.displayName || model.modelId}${
|
||||
duplicateRuntimeModelIds.has(model.modelId)
|
||||
? ` · 供应商 ${model.providerId.slice(0, 8)}`
|
||||
: ""
|
||||
`${model.displayName || model.modelId} · ${
|
||||
providerNamesById.get(model.providerId) || model.modelId
|
||||
}${model.isHidden ? " · 前台隐藏" : ""}`;
|
||||
const resolveCanvasLocalEditSelectValue = (modelRef: string) =>
|
||||
resolveCanvasLocalEditModelRef(availableImageModels, modelRef)?.id ||
|
||||
|
||||
@ -307,6 +307,7 @@ export type LayerSplitConfig = {
|
||||
|
||||
export type LocalAiImagePipelineSectionsProps = LocalAiSectionControlProps & {
|
||||
modelsData?: AdminModelsData;
|
||||
providersData?: AdminProvidersData;
|
||||
rmbgConfig: RmbgConfig;
|
||||
setRmbgConfig: Dispatch<SetStateAction<RmbgConfig>>;
|
||||
enhanceConfig: EnhanceConfig;
|
||||
|
||||
@ -18449,6 +18449,7 @@ export function AdminSettingsClient() {
|
||||
layerSplitConfig={layerSplitConfig}
|
||||
modelsData={modelsData}
|
||||
pointsSystemConfig={pointsSystemConfig}
|
||||
providersData={providersData}
|
||||
renderEnhanceProPresetEditor={renderEnhanceProPresetEditor}
|
||||
rmbgConfig={rmbgConfig}
|
||||
savedEnhanceProKeyRows={savedEnhanceProKeyRows}
|
||||
|
||||
@ -49,6 +49,7 @@ test.describe("canvas scale adjust product lock", () => {
|
||||
expect(settingsRoute).toContain("modelId: localEditModel?.id || \"\"");
|
||||
expect(settingsPanel).toContain("resolveCanvasLocalEditSelectValue(");
|
||||
expect(settingsPanel).toContain("canvasLocalEditConfig.modelId");
|
||||
expect(settingsPanel).toContain("providerNamesById.get(model.providerId)");
|
||||
expect(settingsPanel).toContain(
|
||||
'<SelectItem key={model.id} value={model.id}>'
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user