diff --git a/example/imagine-uri.ts b/example/imagine-uri.ts index d578c60..5749500 100644 --- a/example/imagine-uri.ts +++ b/example/imagine-uri.ts @@ -21,6 +21,20 @@ async function main() { } ); console.log({ msg }); + if (!msg) { + console.log("no message"); + return; + } + const msg2 = await client.Upscale( + msg.content, + 2, + msg.id, + msg.hash, + (uri: string, progress: string) => { + console.log("loading", uri, "progress", progress); + } + ); + console.log({ msg2 }); } main().catch((err) => { console.error(err); diff --git a/src/midjourney.message.ts b/src/midjourney.message.ts index d77b529..a8389fe 100644 --- a/src/midjourney.message.ts +++ b/src/midjourney.message.ts @@ -23,7 +23,8 @@ export class MidjourneyMessage { index?: number ) { // remove urls - prompt = prompt.replace(/\bhttps?:\/\/\S+/gi, ""); + const regex = /(<)?(https?:\/\/[^\s]*)(>)?/gi; + prompt = prompt.replace(regex, ""); // remove multiple spaces prompt = prompt.trim();