Skip to content

Commit 62d14b1

Browse files
committed
Fixed bug where load image history loras button would load incompadible loras if you had an incompadible base model selected.
1 parent 7781109 commit 62d14b1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/app/home/options/options.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,12 @@ export class OptionsComponent implements OnInit {
11981198
return { ...historyLora, strength };
11991199
});
12001200

1201-
return resolved.slice(0, this.maxLoras);
1201+
const targetBaseModel = this.models_types?.[this.generationRequest.model];
1202+
const filtered = targetBaseModel
1203+
? resolved.filter((lora) => lora?.base_model === targetBaseModel)
1204+
: resolved;
1205+
1206+
return filtered.slice(0, this.maxLoras);
12021207
}
12031208

12041209
// Send job to django api and retrieve job id.
@@ -1751,8 +1756,16 @@ export class OptionsComponent implements OnInit {
17511756
this.sharedService.setPrompt(image.prompt!);
17521757
}
17531758

1754-
const hasHistoryLoras = Array.isArray(image.loras) && image.loras.length > 0;
1759+
const historyLoras = Array.isArray(image.loras) ? image.loras : [];
1760+
const hasHistoryLoras = historyLoras.length > 0;
17551761
if (hasHistoryLoras) {
1762+
const targetBaseModel = this.models_types?.[this.generationRequest.model];
1763+
const hasCompatibleLoras = !targetBaseModel
1764+
? true
1765+
: historyLoras.some((lora) => lora?.base_model === targetBaseModel);
1766+
if (!hasCompatibleLoras) {
1767+
return;
1768+
}
17561769
this.pendingLoraLoadImage = image;
17571770
this.showLoraLoadPrompt = true;
17581771
}

0 commit comments

Comments
 (0)