nociza / Bimg

A reverse-engineered Bing Image Creator API as an NPM package
The Unlicense
79 stars 11 forks source link

long prompts with commas #8

Open daleyhuddle opened 11 months ago

daleyhuddle commented 11 months ago

This works well for simple prompts. But if i give it a long prompt it dies bad (Windows 10). If i give it a prompt with commas it seems to choke pretty bad on the save file also. I tried moving the path to the c:\tmp and even chopping down the length but its not having it.

I actually have a good 30+ prompts already made that are quite long with many commas, was hoping to feed it. It would be nice to get the accurate folder name but not imperative, just cant get the save to work. Any suggestions thanks?

console log - very long prompt no commas C:\Users\Chris\Documents\apps\Bimg-0.1.5>node scriptdebug.js Prompt Data: [ 'Black and white pencil sketch of annoyed English bus driver with moustache sitting in the bus driver seat. one hand on his forehead. camera view from left passenger side door entrance. reminiscent of a pencil sketch with a touch of cartoonish charm.The theme is dark and eerie. with strong shadows and crosshatching. ' ] Sending request... https://www.bing.com/images/create?

Redirected to https://www.bing.com/images/create? Waiting for results... . { end: '', flush: true } . { end: '', flush: true } . { end: '', flush: true } . { end: '', flush: true }

Downloading images... An error occurred: Error: ENOENT: no such file or directory, mkdir '/tmp/Black and white pencil sketch of annoyed English bus driver with moustache sitting in the bus driver seat. one hand on his forehead. camera view from left passenger side door entrance. reminiscent of a pencil sketch with a touch of cartoonish charm.The theme is dark and eerie. with strong shadows and crosshatching. ' at Object.mkdirSync (node:fs:1398:3) at saveImages (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/node_modules/bimg/dist/imgen.js:104:12) at generateImageFiles (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/node_modules/bimg/dist/imgen.js:153:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async createImages (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/scriptdebug.js:28:32) { errno: -4058, syscall: 'mkdir', code: 'ENOENT', path: '/tmp/. '

Console log - with COMMAS

Prompt Data: [ 'Black and white pencil , \r' ] Sending request... https://www.bing.com/images/create? Redirected to https://www.bing.com/images/create? Waiting for results... . { end: '', flush: true } . { end: '', flush: true } . { end: '', flush: true } . { end: '', flush: true }

Downloading images... An error occurred: Error: ENOENT: no such file or directory, mkdir '/tmp/Black and white pencil sketch of annoyed English bus driver wi'h moustache sitting in the bus driver seat, one hand on his forehead. camera view from left passenger side door entrance, at Object.mkdirSync (node:fs:1398:3) at saveImages (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/node_modules/bimg/dist/imgen.js:104:12) at generateImageFiles (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/node_modules/bimg/dist/imgen.js:153:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async createImages (file:///C:/Users/Chris/Documents/apps/Bimg-0.1.5/scriptdebug.js:28:32) { errno: -4058, syscall: 'mkdir', code: 'ENOENT', path: '/tmp/Black and white pencil \r' }

c1t1zen1 commented 11 months ago

Windows probably doesn't want to create folders that end in periods or commas. I run my prompts through a sanitizer script to remove any punctuation and make sure it ends on a letter not a space. I limit the length to 225 characters but even that can be too long for some cloud servers like Gdrive I've found.

daleyhuddle commented 11 months ago

If there's a way to get a second parameter that is just for the output path , the prompt can still be anything, but the file path would be a variation (e.g first 220 characters and sanitized). I couldn't get that second parameter working though.

I did get the script to sanitize and parse new lines with multiple prompts from the text input file but many prompts are very long and can go up to maybe 500 chars on some of them. If that output path parameter gets added in would gladly donate.