@@ -48,12 +48,15 @@ import {
4848 previousPage ,
4949 sendToUserInbox ,
5050 wrapper ,
51+ non_picture_section
5152} from "./js_utilities/query_selector.js" ;
5253
5354let currentCameraIndex = 0 ;
5455const switchCameraButton = document . getElementById ( "switchCamera" ) ;
5556let emailObject ;
5657
58+ console . log ( non_picture_section )
59+
5760wantToTakeAPicture . addEventListener ( "click" , ( ) => {
5861 removeElements ( [ pictureSectionHeadline , wantToTakeAPicture ] ) ;
5962 displayElementsFlex ( [ videoBtnCanvas ] ) ;
@@ -155,7 +158,10 @@ recipeButtons.forEach((button) => {
155158 console . log ( userText . value ) ;
156159 button . addEventListener ( "click" , async ( ) => {
157160 displayElements ( [ loadingContainer ] ) ;
158- removeElements ( [ mainElement ] ) ;
161+ // removeElements([headline, allergies, ...recipeButtons]);
162+ // removeElements([non_picture_section]);
163+ removeElements ( [ mainElement ] )
164+
159165 const userRecipe = createUserRecipe ( button , dietaryRequirements , userText ) ;
160166 console . log ( userRecipe ) ;
161167
@@ -166,10 +172,12 @@ recipeButtons.forEach((button) => {
166172 eventSource . onmessage = async function ( event ) {
167173 let eventData = JSON . parse ( event . data ) ;
168174 if ( eventData . message ) {
175+
169176 if ( eventData . message === "stop" ) {
170177 eventSource . close ( ) ;
171178 return ;
172179 }
180+ // removeElements([headline, allergies, ...recipeButtons]);
173181 displayElements ( [ gptResponseElement ] ) ;
174182 gptResponseElement . textContent += eventData . message ;
175183 return ;
@@ -193,6 +201,7 @@ recipeButtons.forEach((button) => {
193201 console . log ( "data.image" , eventData . image ) ;
194202
195203 if ( data . audio && data . image ) {
204+
196205 createImage ( data ) ;
197206
198207 const { speedBtn, speechBtns } = createTextToSpeech ( data ) ;
@@ -231,6 +240,9 @@ recipeButtons.forEach((button) => {
231240function createImage ( param ) {
232241 removeElements ( [ loadingContainer ] ) ;
233242 const imageUrl = param . image . data [ 0 ] . url ;
243+ backgroundImg . style . backgroundSize = "cover" ;
244+
245+
234246 backgroundImg . src = imageUrl ;
235247 return backgroundImg ;
236248}
0 commit comments