]> git.cworth.org Git - zombocom-ai/blobdiff - index.js
Hide image-generation form while generation is happening
[zombocom-ai] / index.js
index 8dadeabec11666785f14926cc567caf15c58033f..ba01d67ffbe60b85403b5026e514b51f34d9a389 100644 (file)
--- a/index.js
+++ b/index.js
@@ -48,10 +48,13 @@ app.get('/index.html', (req, res) => {
 
 io.on('connection', (socket) => {
 
-    // Replay old comments to a newly-joining client
+    // Replay old comments and images to a newly-joining client
     state.comments.forEach((comment) => {
         socket.emit('comment', comment)
     });
+    state.images.forEach((image) => {
+        socket.emit('image', image)
+    });
 
     // When any client comments, send that to all clients (including sender)
     socket.on('comment', (comment) => {
@@ -82,6 +85,7 @@ io.on('connection', (socket) => {
                 console.log("Error occurred during generate-image: " + data);
             });
             const { stdout, stderr } = await promise;
+            socket.emit('generation-done');
         }
         generate_image(request['code'], request['prompt']);
     });