@@ -252,21 +252,35 @@ document.addEventListener("DOMContentLoaded", () => {
252252 const enhance = settings . enhance ;
253253 const priv = settings . priv ;
254254
255- // Build the image URL via polliLib MCP helper (no direct endpoint usage)
256- const url = ( function ( ) {
255+ // Build the image URL via polliLib MCP helper; fallback to direct Pollinations endpoint
256+ const url = await ( async ( ) => {
257257 try {
258258 if ( window . polliLib && window . polliClient ) {
259- return window . polliLib . mcp . generateImageUrl ( window . polliClient , {
259+ return await window . polliLib . mcp . generateImageUrl ( window . polliClient , {
260260 prompt,
261- width, height, seed, model,
261+ width,
262+ height,
263+ seed,
264+ model,
262265 nologo : true ,
263266 private : priv ,
264267 enhance : ! ! enhance
265268 } ) ;
266269 }
267- } catch ( e ) { console . warn ( 'polliLib generateImageUrl failed' , e ) ; }
268- // Fallback to placeholder if polliLib not available
269- return "https://via.placeholder.com/512?text=Image+Unavailable" ;
270+ } catch ( e ) {
271+ console . warn ( 'polliLib generateImageUrl failed' , e ) ;
272+ }
273+ const base = `https://image.pollinations.ai/prompt/${ encodeURIComponent ( prompt ) } ` ;
274+ const params = new URLSearchParams ( {
275+ width,
276+ height,
277+ seed,
278+ model : model || 'flux' ,
279+ nologo : 'true' ,
280+ private : String ( priv ) ,
281+ enhance : String ( ! ! enhance )
282+ } ) ;
283+ return `${ base } ?${ params . toString ( ) } ` ;
270284 } ) ( ) ;
271285 console . log ( "Generated new image URL via polliLib:" , url ) ;
272286
0 commit comments