erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.69k stars 283 forks source link

previews generated but no final image when prompt causes midjourney to "ephemeral" mode ('Only you can see this') #172

Closed ofer-tal closed 1 year ago

ofer-tal commented 1 year ago

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

await midjourneyClient.Imagine('A dark, bloodied poker table with vampire fangs and playing cards, by Roger Ballen', async (uri, progress) => { ... })

Describe the bug

Describe the bug on some imagine prompts, midjourney switches the generation to "ephemeral mode" (indicated by the words "Only you can see this" during image generation, and by the message "Original message was deleted" after the image is generated). When that happens, while progress & preview URLs are generated, the final image never arrives in the midjourney client - it just continues to wait for the message with the final image url forever.

* Meanwhile on discord -- the message on the discord server channel disappears for users other than the user originating the request and appears with the message "Original message was deleted" for the user posting the imagine request.

According to information posted on Midjourney forums (captures from mj forum pasted below after the screenshot) this can be avoided by sending the request to midjourney as a direct message rather than a channel message.

OR alternatively perhaps adding a "/show job-id" command after the last preview arrives if X seconds passed and the final url is not available (as suggested in one of the posts)?

Expected behavior midjourney client should succeed to "imagine" images in as many cases as possible. If enabling DM generation solves this problem, supporting that (at least as an option) can fix this problem.

Screenshots only you can see this original deleted forum 1 forum 2

error log

not applicable

zcpua commented 1 year ago

https://github.com/erictik/midjourney-api/blob/main/example/imagine-ws.ts#L17-L19

ofer-tal commented 1 year ago

My code was already using Ws: true and hooking up to the progress callback.

here is my initialization code - it is ~identical to yours unless I'm missing something:

  const midjourneyClient = new Midjourney({
    ServerId: process.env.MIDJOURNEY_DISCORD_SERVER_ID,
    ChannelId: process.env.MIDJOURNEY_DISCORD_CHANNEL_ID,
    SalaiToken: process.env.MIDJOURNEY_DISCORD_TOKEN,
    HuggingFaceToken: process.env.HUGGINGFACE_TOKEN,
    Debug: true,
    Ws: true
  });
  let lastPreviewProgress = null;
  const msg = await midjourneyClient.Imagine('...', async (uri, progress) => {
  // ...
ofer-tal commented 1 year ago

to be clear... with this code, and with the most recent version as of yesterday (4.0.98) as well as the previous 3.x versions this has been occuring.

ofer-tal commented 1 year ago

It also seems like MJ is very "trigger happy" with flagging items for this ephemeral processing. We're not talking hard core X/R-rated prompts... mention of "blood" seems to be sufficient to trigger this.

zcpua commented 1 year ago

20230707-085839

ofer-tal commented 1 year ago

Wow, great catch, I did not notice that before. Thank you. this seems to work nicely.