UrielCh / midjourney-client

midjourney-client in deno

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for turbo mode

d400800 opened this issue · comments

I faced an issue with the imagine method when using the turbo mode. I managed to fix it by overriding some of the methods in the Midjourney and DiscordMessage classes. Here are the changes I made to make it work:

Midjourney.filterMessages:
matches = matches.filter((item) => item.prompt) -> matches = matches.filter((item) => item.prompt || item.content);
const itemPrompt = item.prompt.prompt; -> const itemPrompt = (item.prompt && item.prompt.prompt) || getPromptFromContent(item.content);

Where getPromptFromContent is:
function getPromptFromContent(content) { return content.match(regEx) ? content.match(regEx)[1] : ''; }

Midjourney.followCheckMsg:
const prompt = msg.prompt; -> const prompt = msg.prompt || msg.content;

the extractPrompt function inside the DiscordMessage file (not a class member) I added:
if (extra.endsWith(' (turbo)')) { result.mode = 'fast'; extra = extra.substring(0, extra.length - 8); }

Not sure about result.mode = 'fast'; here, but it works.

turbo mode ... what that ?

Screenshot 2023-07-18 at 10 50 53

okey... lewt's tryed out

It is a newly added image generation mode that Midjourney issued recently. It generates images very fast.
https://docs.midjourney.com/docs/fast-relax

copy and past here the error message displayed in your terminal:

the errors are generated by this 2 log lines:

    logger.warn(`Failed to extract prompt data from: ${pc.yellow(content)}`);
    logger.warn(`Extra data:"${pc.yellow(extra)}"`);

2023-07-18 10:59:04 Warn: Failed to extract prompt data from: hot trends low prices every single day, in the style of candid, saturated hues , ecommerce website selling fashion products, pink, blue colors --turbo --ar 16:9
--q .75 --no text fonts letters watermark words typography slogans signature
- <@1115263101697265724> (turbo)
2023-07-18 10:59:04 Warn: Extra data:"hot trends low prices every single day, in the style of candid, saturated hues , ecommerce website selling fashion products, pink, blue colors --turbo --ar 16:9 --q .75 --no text fonts
letters watermark words typography slogans signature
- <@1115263101697265724> (turbo)

Turbo support added.

Thanks!

just commited, but not available published to npmjs yet.

can you try the current git version ?

Sure, I'll try it now.

Stay on E-mail for now.

v 1.0.6 is out