yokonsan / midjourney-api

midjourney in discord api.
767 stars 174 forks source link

implemented solo_variatation, zoomout, expand features #78

Closed tangramor closed 10 months ago

tangramor commented 11 months ago

实现了以下功能:

yokonsan commented 11 months ago

Thank you, pr. I've been a little busy at work lately, so I'll merge later.

CJReinforce commented 11 months ago

实现了以下功能:

  • [x] /v1/api/trigger/solo_variation:Make Variations
  • [x] /v1/api/trigger/zoomout:Zoom Out 2x/1.5x
  • [x] /v1/api/trigger/expand:⬅️ ➡️ ⬆️ ⬇️

Thanks for your work! There may be two minor problems:

  1. /solo_variation seems does not work. After curl, I have got the response {"trigger_id":"xxxxxxx","trigger_type":"solo_variation"}, and the log of server is shown as following, but then nothing happened anymore.
    2023-08-02 18:07:44 | DEBUG | 807531-281472936744784 | "/root/program/forked-midjourney-api/util/_queue.py:61":_exec - Task[xxxxxxxx] start execution: solo_variation((), {'index': 1, 'msg_id': 'xxxxxxxx', 'msg_hash': 'xxxxxxxx', 'trigger_id': 'xxxxxxxx'})
    INFO:     206.190.237.43:52344 - "POST /v1/api/trigger/solo_variation HTTP/1.1" 200 OK
    2023-08-02 18:07:44 | DEBUG | 807531-281472936744784 | "/root/program/forked-midjourney-api/util/fetch.py:47":fetch - Fetch: https://discord.com/api/v9/interactions, {'data': '{"type": 3, "application_id": "xxxxxxxx", "guild_id": "xxxxxxxx", "channel_id": "xxxxxxxx", "session_id": "xxxxxxxx", "data": {"component_type": 2, "custom_id": "MJ::JOB::variation::1::xxxxxxxx::SOLO"}, "message_flags": 0, "message_id": "xxxxxxxx"}'}
  2. Suggest to change the code @router.post("/solo_variation") to @router.post("/solo_variation", response_model=TriggerResponse) (the same to /expand and /zoomout). The latter can add some meta info like {"message": True} in the response.