UrielCh / midjourney-client

midjourney-client in deno

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with describeUrl

rodion-sarakuz opened this issue · comments

Describe request receives an error:

2023-05-26 00:11:58 Info: saving downloaded file to D2PEVjqHW4eG0A.jpg
error: Uncaught (in promise) Error: describe return 400 Bad Request {"code": 50035, "errors": {"data": {"options": {"_errors": [{"code": "INTERACTION_APPLICATION_COMMAND_OPTION_MISSING", "message": "Missing interaction application command option"}]}}}, "message": "Invalid Form Body"}
throw new Error(
^
at Midjourney.describe (https://deno.land/x/midjourney_discord_api@1.0.2/src/Midjourney.ts:435:11)
at eventLoopTick (ext:core/01_core.js:181:11)
at async Midjourney.describeImage (https://deno.land/x/midjourney_discord_api@1.0.2/src/Midjourney.ts:997:5)

please provide a code sample to reproduce the issue.

import Midjourney from "https://deno.land/x/midjourney_discord_api@1.0.2/mod.ts";

const client = new Midjourney("interaction.txt");
client.setDiscordChannelUrl("https://discord.com/channels/662267976984297473/995431274267279440")
await client.connectWs(); // Used Websocket to boost detection. (experiental)

const prompts = await client.describeUrl(
"http://dl4.joxi.net/drive/2023/05/27/0018/2064/1206288/88/917483c57d.jpg",
/* add optional progress function (percent) => void*/
);
console.log("reversed prompt: ", prompts);


FYI imagine() works well

a Deno user, Greate.

Just tested your image, it works.

setDiscordChannelUrl should fail at build time if your URL is not correct.

import { Midjourney } from "../mod.ts";
import { progressLogger } from "./progressLogger.ts";
import { sampleUrls } from "./sampleUrls.ts";

/**
 * Upscale the first none upscaled images in chat, searching from the newest to the oldest images
 */
const client = new Midjourney("interaction.txt");
await client.connectWs();
const sourceImg = "http://dl4.joxi.net/drive/2023/05/27/0018/2064/1206288/88/917483c57d.jpg";
const prompts = await client.describeUrl(sourceImg, progressLogger("describeUrl"));
const prompt = prompts[(Math.random() * 4) | 0];
console.log("Using prompt:", prompt);
const msg = await client.imagine(prompt, progressLogger("imagine"));
if (await msg.download(0, "regen.png")) {
  console.log("result downloaded as regen.png");
} else {
  console.log("result downloaded Failed");
}

notable difference:
my image get saved as drive_2023_05_27_0018_2064_1206288_88_917483c57d.jpg not as D2PEVjqHW4eG0A.jpg

you did not provide me with the same URL.

Thx, for respond.
Sorry, but I corrected the image url before I sending the code example. Anyway I get same error with this image as well(

image

so exactly the same code failed in your environment?
can you try to run some samples from that samples directory?