Skip to content

Commit

Permalink
Refactor AI model selection logic in AdvancedImagine function
Browse files Browse the repository at this point in the history
  • Loading branch information
exatombe committed Jan 3, 2024
1 parent 390bcb1 commit 85c3067
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bot/commands/ai/advanced/imagine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ export default async function AdvancedImagine(command: CommandsBase, interaction
if (loras) {
try {
let lorasDatas = await ai.getLorasModels(loras);
let firstImageMeta = lorasDatas.items[0].modelVersions[lorasDatas.items[0].modelVersions.length - 1].images[0].meta;
prompt.params.steps = firstImageMeta.steps;
prompt.params.cfg_scale = firstImageMeta.cfgScale;
prompt.prompt = firstImageMeta.prompt + image.substring(0, 1024) + "### " + firstImageMeta.negativePrompt
let firstItem = lorasDatas.items[0];
let randomModelVersion = firstItem.modelVersions[Math.floor(Math.random() * firstItem.modelVersions.length)];
let randomMetaImage = randomModelVersion.images[Math.floor(Math.random() * randomModelVersion.images.length)].meta;
prompt.params.steps = randomMetaImage.steps;
prompt.params.cfg_scale = randomMetaImage.cfgScale;
prompt.prompt = randomMetaImage.prompt + image.substring(0, 1024) + "### " + randomMetaImage.negativePrompt
} catch (e) {
console.log("Loras was not found")
}
Expand Down

0 comments on commit 85c3067

Please sign in to comment.