fix: keep fal as scale adjust fallback
This commit is contained in:
parent
0c919e851a
commit
8fd93bfd29
@ -307,6 +307,21 @@ function getScaleAdjustProviderPriority(providerType: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function getScaleAdjustModelHealthPenalty(
|
||||
healthStatus: string | null | undefined
|
||||
) {
|
||||
if (healthStatus === "degraded") return 25;
|
||||
if (healthStatus === "auto_disabled") return 200;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getScaleAdjustCandidatePriority(entry: AiModelWithProviderForSelection) {
|
||||
return (
|
||||
getScaleAdjustProviderPriority(entry.provider.type) +
|
||||
getScaleAdjustModelHealthPenalty(entry.model.healthStatus)
|
||||
);
|
||||
}
|
||||
|
||||
function isScaleAdjustUsableImageEditModel(
|
||||
entry: AiModelWithProviderForSelection | null | undefined
|
||||
) {
|
||||
@ -321,8 +336,8 @@ function compareScaleAdjustProviderCandidates(
|
||||
right: AiModelWithProviderForSelection,
|
||||
preferredModelRef: string
|
||||
) {
|
||||
const leftPriority = getScaleAdjustProviderPriority(left.provider.type);
|
||||
const rightPriority = getScaleAdjustProviderPriority(right.provider.type);
|
||||
const leftPriority = getScaleAdjustCandidatePriority(left);
|
||||
const rightPriority = getScaleAdjustCandidatePriority(right);
|
||||
if (leftPriority !== rightPriority) return leftPriority - rightPriority;
|
||||
|
||||
const leftDedicated = isScaleAdjustDedicatedDetailModel(left);
|
||||
|
||||
@ -1613,6 +1613,21 @@ function getCanvasScaleAdjustProviderFailoverPriority(providerType: string) {
|
||||
}
|
||||
}
|
||||
|
||||
function getCanvasScaleAdjustHealthPenalty(
|
||||
healthStatus: string | null | undefined
|
||||
) {
|
||||
if (healthStatus === "degraded") return 25;
|
||||
if (healthStatus === "auto_disabled") return 200;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getCanvasScaleAdjustFailoverPriority(item: CanvasModelWithProvider) {
|
||||
return (
|
||||
getCanvasScaleAdjustProviderFailoverPriority(item.provider.type) +
|
||||
getCanvasScaleAdjustHealthPenalty(item.model.healthStatus)
|
||||
);
|
||||
}
|
||||
|
||||
interface CanvasImageGenConfig {
|
||||
maxImages?: number;
|
||||
supports1K?: boolean;
|
||||
@ -1788,7 +1803,15 @@ function findCanvasFailoverModel(params: {
|
||||
.filter(Boolean);
|
||||
|
||||
const isUsableFallback = (item: CanvasModelWithProvider) => {
|
||||
if (!item.model.isEnabled || item.model.isSubModel || item.model.excludeFromFailover) {
|
||||
const isSameNameScaleAdjustFallback =
|
||||
params.preferLowCostSameNameProviders &&
|
||||
scoreModelNameSimilarity(params.selectedModel, item) >=
|
||||
CANVAS_FAILOVER_SAME_NAME_THRESHOLD;
|
||||
if (
|
||||
!item.model.isEnabled ||
|
||||
item.model.isSubModel ||
|
||||
(item.model.excludeFromFailover && !isSameNameScaleAdjustFallback)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (!item.model.supportsImageGen) return false;
|
||||
@ -1832,12 +1855,8 @@ function findCanvasFailoverModel(params: {
|
||||
leftSameName &&
|
||||
rightSameName
|
||||
) {
|
||||
const leftPriority = getCanvasScaleAdjustProviderFailoverPriority(
|
||||
left.item.provider.type
|
||||
);
|
||||
const rightPriority = getCanvasScaleAdjustProviderFailoverPriority(
|
||||
right.item.provider.type
|
||||
);
|
||||
const leftPriority = getCanvasScaleAdjustFailoverPriority(left.item);
|
||||
const rightPriority = getCanvasScaleAdjustFailoverPriority(right.item);
|
||||
if (leftPriority !== rightPriority) return leftPriority - rightPriority;
|
||||
if (right.nameSimilarity !== left.nameSimilarity) {
|
||||
return right.nameSimilarity - left.nameSimilarity;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user