File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
packages/stablestudio-plugin-webui/src Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -293,14 +293,22 @@ export const createPlugin = StableStudio.createPlugin<{
293293
294294 const responseData = await existingImagesResponse . json ( ) ;
295295
296- const images = [ ] ;
296+ const promptedImages : any = { } ;
297297
298298 for ( let i = 0 ; i < responseData . length ; i ++ ) {
299299 const imageInfo = await getImageInfo (
300300 webuiHostUrl ,
301301 responseData [ i ] . content
302302 ) ;
303303
304+ let images = promptedImages [ imageInfo [ "prompt" ] ] ;
305+
306+ if ( ! images ) {
307+ images = [ ] ;
308+
309+ promptedImages [ imageInfo [ "prompt" ] ] = images ;
310+ }
311+
304312 const blob = await base64ToBlob ( responseData [ i ] . content , "image/jpeg" ) ;
305313
306314 const timestampInSeconds = responseData [ i ] . create_date ;
@@ -329,13 +337,17 @@ export const createPlugin = StableStudio.createPlugin<{
329337
330338 images . push ( stableDiffusionImage ) ;
331339 }
340+
341+ const ret = [ ] ;
332342
333- return [
334- {
343+ for ( const key in promptedImages ) {
344+ ret . push ( {
335345 id : `${ Math . random ( ) * 10000000 } ` ,
336- images : images ,
337- } ,
338- ] ;
346+ images : promptedImages [ key ] ,
347+ } ) ;
348+ }
349+
350+ return ret ;
339351 } ,
340352
341353 settings : {
You can’t perform that action at this time.
0 commit comments