Skip to content

Commit

Permalink
fixbug: prompt to add uri does not return
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric committed May 13, 2023
1 parent 385223a commit 34715d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions example/imagine-uri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion src/midjourney.message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 34715d6

Please sign in to comment.