Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is there a way to reset midjourney settings in API #22

Open
JJYRJJ opened this issue May 20, 2023 · 2 comments
Open

is there a way to reset midjourney settings in API #22

JJYRJJ opened this issue May 20, 2023 · 2 comments

Comments

@JJYRJJ
Copy link

JJYRJJ commented May 20, 2023

hi, thanks for the great work!
I want to reset the midjourney every time before I send a prompt for drawing. This is because I use a shared account and if anyone changed the settings (e.g., set a suffix to --niji 5), then I cannot use the "--v 5.1" model in this API due to conflict suffix.
image

Or if you have a better solution for this?

Thanks

@George-iam
Copy link
Owner

Hi,
if you do reseting and new generation in one command, you can add reset options to --flag option, but if it's a separate command, so you need to add to Sender.py additional request with reset command before each generate request

@JJYRJJ
Copy link
Author

JJYRJJ commented May 20, 2023

Thanks for the response. I tried adding another request in sender, and it looks like this:

header = {'authorization': self.authorization}

# add reset suffix
payload = json.loads('{"type":2,"application_id":"936929561302675456","guild_id":"1109141376119087104","channel_id":"1109141376119087107","session_id":"02f8f85170fd62ff83939491159fdd77","data":{"version":"1029519354955579472","id":"984273800587776053","name":"prefer","type":1,"options":[{"type":1,"name":"suffix","options":[]}],"application_command":{"id":"984273800587776053","application_id":"936929561302675456","version":"1029519354955579472","default_member_permissions":null,"type":1,"nsfw":false,"name":"prefer","description":"…","dm_permission":true,"contexts":null,"options":[{"type":2,"name":"option","description":"…","options":[{"type":1,"name":"set","description":"Set a custom option.","options":[{"type":3,"name":"option","description":"…","required":true,"autocomplete":true},{"type":3,"name":"value","description":"…"}]},{"type":1,"name":"list","description":"View your current custom options."}]},{"type":1,"name":"auto_dm","description":"Whether or not to automatically send job results to your DMs."},{"type":1,"name":"suffix","description":"Suffix to automatically add to the end of every prompt. Leave empty to remove.","options":[{"type":3,"name":"new_value","description":"…"}]},{"type":1,"name":"remix","description":"Toggle remix mode."}]},"attachments":[]},"nonce":"1109496199238385664"}')
r = requests.post('https://discord.com/api/v9/interactions', json = payload , headers = header)
while r.status_code != 204:
    r = requests.post('https://discord.com/api/v9/interactions', json = payload , headers = header)
print("reset suffix")

# original code
prompt = prompt.replace('_', ' ')

where the payload is a copied "payload json" from network interactions when I reset the suffix by "/prefer suffix " (this can reset suffix when I run it in discord)
image

However, when I run sender.py, the code runs successfully and I see "reset suffix" log. But in discord there's nothing changed and the preset suffix still exists.

Not sure where is the problem and is there a way to fix? Thanks

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

No branches or pull requests

2 participants