Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Midjourney blend #34

Open
secolaha opened this issue Mar 20, 2023 · 18 comments
Open

Midjourney blend #34

secolaha opened this issue Mar 20, 2023 · 18 comments

Comments

@secolaha
Copy link

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

@Wildric-Auric
Copy link
Owner

Wildric-Auric commented Mar 20, 2023

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

@secolaha
Copy link
Author

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

@Wildric-Auric
Copy link
Owner

I meant implemented in my repository.

@Xs1937
Copy link

Xs1937 commented Mar 22, 2023

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

@secolaha
Copy link
Author

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

@zhaoleigithub
Copy link

How to get SALAI_TOKEN?

@SergioLopezMaldonado
Copy link

I keep having the same 400 error

@Wildric-Auric
Copy link
Owner

@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...

@yuexdang
Copy link

yuexdang commented Apr 4, 2023

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.

@yslion
Copy link

yslion commented Apr 10, 2023

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

@Wildric-Auric
Copy link
Owner

Wildric-Auric commented Apr 10, 2023

@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.

Repository owner deleted a comment from yuexdang Apr 10, 2023
@yuexdang
Copy link

@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
Copy link

@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

@Wildric-Auric
Copy link
Owner

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

@ebullienc3
Copy link

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

Appreciate it, waiting on this.

@yuexdang
Copy link

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)?

@mluciani
Copy link

mluciani commented May 23, 2023

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)

@yuexdang
Copy link

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:
yuexdang/DandJourney#3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants