MidJourney-Wrapper icon indicating copy to clipboard operation
MidJourney-Wrapper copied to clipboard

Midjourney blend

Open secolaha opened this issue 1 year ago • 18 comments

Hi, This is an excelent pierce of code! Would it be possible to add the midjourney Blend command to the API? https://docs.midjourney.com/docs/blend

secolaha avatar Mar 20 '23 09:03 secolaha

That's a nice feature. When it will be implemented I will come back to this issue.

Wildric-Auric avatar Mar 20 '23 17:03 Wildric-Auric

Hi, Thanks for the quick reply. I not sure i understand. Where will it need to be implemented? It is currently working in Midjourney.

secolaha avatar Mar 21 '23 08:03 secolaha

I meant implemented in my repository.

Wildric-Auric avatar Mar 21 '23 12:03 Wildric-Auric

你好,globals文件的配置信息在哪里可以获取到呢

Xs1937 avatar Mar 22 '23 07:03 Xs1937

makes sense :) got as bit confused there. thanks for the update.

secolaha avatar Mar 23 '23 22:03 secolaha

How to get SALAI_TOKEN?

zhaoleigithub avatar Mar 24 '23 08:03 zhaoleigithub

I keep having the same 400 error

SergioLopezMaldonado avatar Mar 26 '23 08:03 SergioLopezMaldonado

@zhaoleigithub @SergioLopezMaldonado @Xs1937 Please manage to not ask questions unrelated to the issue where they are posted. For instance, the current issue is still opened for a futur feature implementation. However, for setting up globals.py, look at #37 and #18. Also read the first part of the Readme. @SergioLopezMaldonado For the 400 error, if you read other issues you will find how to debug. I'm almost sure you would find someone who has the same issue as you. Wrong token, wrong channel ID etc...

Wildric-Auric avatar Mar 27 '23 14:03 Wildric-Auric

About Blend, I was stuck on a key step, which was that when I sent a request, if I used consistent parameters, it would go into a network error state after a short time, so that I could not send the content.

Here is my interpretation of Blend. There are two parts of the parameters that need to be modified, one in payload.data.options and the other in payload.data.application The argument to command.attachments, nonce is useless and this is how I write my request:

payload = {
    "type":2,"application_id":Globals.MID_JOURNEY_ID,
    "guild_id":Globals.SERVER_ID,"channel_id":Globals.CHANNEL_ID,
    "session_id":What you get from other session you send,
    "data":{
        "version":JUST SECRET,"id":JUST SECRET,
        "name":"blend","type":1,"options":options you need to get,
            "application_command":{
                "id":JUST SECRET,"application_id":Globals.MID_JOURNEY_ID,
                "version":JUST SECRET,
                "default_permission":True,
                "default_member_permissions":None,"type":1,"nsfw":False,
                "name":"blend","description":"Blend images together seamlessly!",
                "dm_permission":True,"options":[
                    {"type":11,"name":"image1","description":"First image to add to the blend","required":True},
                    {"type":11,"name":"image2","description":"Second image to add to the blend","required":True},
                    {"type":3,"name":"dimensions","description":"The dimensions of the image. If not specified, the image will be square.","choices":[{"name":"Portrait","value":"--ar 2:3"},{"name":"Square","value":"--ar 1:1"},{"name":"Landscape","value":"--ar 3:2"}]},
                    {"type":11,"name":"image3","description":"Third image to add to the blend (optional)"},
                    {"type":11,"name":"image4","description":"Fourth image to add to the blend (optional)"},
                    {"type":11,"name":"image5","description":"Fifth image to add to the blend (optional)"}]},
                    "attachments":attachments,
            }
}

There are a few things I suspect are wrong here, the first is the session id and version parameters, obviously they should have a fixed value, but I find that sending requests after a while changes the value, I'm not sure why, because blend doesn't have any developer documentation The second one is attachments, which obviously contains a parameter to upload filename, which is supposed to be one of the things that discord returns. I tried the url of the image, and in an experiment it worked, I thought it would work

But now obviously I can't run it properly, if you do, I hope to have a chance to receive a reply.

If you need my library, I have fork out a branch, if you need I can talk to you privately.

yuexdang avatar Apr 04 '23 16:04 yuexdang

@yuexdang "id":JUST SECRET i think this is interaction.id of midjourney bot , but i have no idea of how to get it .

yslion avatar Apr 10 '23 15:04 yslion

@yuexdang its a very specific issue, if you want to put a link to something functional in a github repository about the issue or make a pull request, feel free to do it, but don't talk about more general stuff here please.

Wildric-Auric avatar Apr 10 '23 16:04 Wildric-Auric

@yuexdang its a very specific issue, if you want to put a link to something functional in a github repository about the issue or make a pull request, feel free to do it, but don't talk about more general stuff here please.

So sorry about that , I promise I will never do that.

yuexdang avatar Apr 11 '23 04:04 yuexdang

@yuexdang "id":JUST SECRET i think this is interaction.id of midjourney bot , but i have no idea of how to get it .

In my test , It just like a fixed value.I'm not sure about that but we can used it temporary. If your mean is that you can't get it, use developer tools in Browser, from the web request to find it

yuexdang avatar Apr 11 '23 04:04 yuexdang

I'm going to work next week on this project and perhaps add all new features of MidJourney

Wildric-Auric avatar Apr 16 '23 17:04 Wildric-Auric

I'm going to work next week on this project and perhaps add all new features of MidJourney

Appreciate it, waiting on this.

ebullienc3 avatar Apr 16 '23 21:04 ebullienc3

There was an important problem. After a discord conversion, we couldn't get the upload filename variable, so we couldn't send the request properly when forging it So, Is there a way to retrieve requests for interactions, or to find other parameters that attachments can enter, or maybe we faked a discord request to convert images (I don't think converting images is a good option)?

yuexdang avatar Apr 26 '23 02:04 yuexdang

I tried the url of the image, and in an experiment it worked, I thought it would work

hi @yuexdang, how did you do this? Did you mean you used another valid upload_filename value or you were able to put in a URL somehow? I am stuck here as well because as far as I can tell there is no way to get the upload_filename.

(note I am trying to implement /describe not /blend, but its the same problem)

mluciani avatar May 23 '23 03:05 mluciani

I tried the url of the image, and in an experiment it worked, I thought it would work

hi @yuexdang, how did you do this? Did you mean you used another valid upload_filename value or you were able to put in a URL somehow? I am stuck here as well because as far as I can tell there is no way to get the upload_filename.

This problem has been solved

First obtain the image link, then transfer the image link to google.api. When transferring, the image name sent is filename, and the content obtained after transferring includes upload_ filename

For detailed information, please refer to the issue below: https://github.com/yuexdang/DandJourney/issues/3

yuexdang avatar May 23 '23 03:05 yuexdang