erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.64k stars 269 forks source link

Vary Strong + Remix #247

Closed tglanz closed 7 months ago

tglanz commented 7 months ago

the code that reproduces this issue or a replay of the bug

const { Midjourney } = require("midjourney");

async function main() {
    const client = new Midjourney({
        ServerId: '<server>',
        ChannelId: '<channel>',
        SalaiToken: '<token>',
        Ws: true,
    });

    const prompt1 = "A red boat --version 5.2 --turbo";
    const prompt2 = "A red boat with a big sail --version 5.2 --turbo";

    try {
        await client.init();

        const imagineResult = await client.Imagine(prompt1);
        const upscaleResult = await client.Upscale({
            index: 1,
            msgId: imagineResult.id,
            hash: imagineResult.hash,
            flags: imagineResult.flags,
        })

        const varyStrong = upscaleResult.options.find(option => option.label === "Vary (Strong)");

        await client.Custom({
            msgId: imagineResult.id,
            content: prompt2,
            flags: imagineResult.flags,
            customId: varyStrong.custom,
        });
    } catch (err) {
        console.error(err);
    } finally {
        client.Close();
    }
}

main()
    .then(() => console.log("done"))
    .catch(err => console.error(err));

Describe the bug

Describe the bug

I try to invoke a custom action, using the Custom API, in Remix mode, on an Upscaled image.

The specific actions I tried to do this on are Vary (Strong) and Vary (Subtle).

I specifically need to invoke this on the Upscaled image and have control on the Strong/Subtle options.

Model version is 5.2.

Getting the error:

Error: CustomApi failed with status 400
    at Midjourney.Custom (remix-example/node_modules/midjourney/libs/midjourney.js:216:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async main (remix-example.js:36:9)

Expected behavior

Apply the Vary (Strong) action on the Upscaled image indexed 1, including the provided prompt.

Additional Info

If I use the V1 action on the Imagined image (rather than the Upscaled) it works.

My midjourney is

    "midjourney": "^4.3.13"

error log

api.error.config {
  payload: '{"type":3,"nonce":"<REDACTED>","guild_id":"<REDACTED>","channel_id":"<REDACTED>","message_flags":0,"message_id":"1179458619717201971","application_id":"<REDACTED>","session_id":"<REDACTED>","data":{"component_type":2,"custom_id":"MJ::JOB::high_variation::1::5798b9cb-2a9a-40d0-b1e2-fb0b12cd955e::SOLO"}}',
  config: {
    BotId: '<REDACTED>',
    ChannelId: '<REDACTED>',
    SalaiToken: '<REDACTED>',
    ApiInterval: 350,
    SessionId: '<REDACTED>',
    Debug: false,
    Limit: 50,
    Ws: true,
    MaxWait: 200,
    ImageProxy: '',
    DiscordBaseUrl: 'https://discord.com',
    WsBaseUrl: 'wss://gateway.discord.gg/?encoding=json&v=9',
    fetch: [Function: fetch],
    WebSocket: <ref *1> [class WebSocket extends EventEmitter] {
      CONNECTING: 0,
      OPEN: 1,
      CLOSING: 2,
      CLOSED: 3,
      createWebSocketStream: [Function: createWebSocketStream],
      Server: [class WebSocketServer extends EventEmitter],
      Receiver: [class Receiver extends Writable],
      Sender: [class Sender],
      WebSocket: [Circular *1],
      WebSocketServer: [class WebSocketServer extends EventEmitter]
    },
    ServerId: '<REDACTED>',
    Remix: true
  }
}
tglanz commented 7 months ago

This isn't the issue exactly. Opened more accurate Issue: #248