Spaces:
Paused
Paused
fix(ai): Fix banner aspect ratio to match android perfectly and remove generic banner tags from gemini prompt
Browse files33 unmodified lines343536373839404142434445464748495051525354551 unmodified line57585960616263741 unmodified lines80580680780880981081181233 unmodified lines});}// AI yordamida (Gemini) promptni professional darajada kengaytirishasync function enhancePromptWithGemini(userText, templateBase = '') {if (!process.env.GEMINI_API_KEY) {return (templateBase ? templateBase + ', ' : '') + userText + ', professional advertising banner, highly detailed';}try {const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" });const prompt = `You are an expert AI image prompt engineer for an e-commerce platform.The user wants to generate an advertising banner but they are writing in Uzbek and might have typos.CRITICAL RULE: Always interpret the words in the context of FASHION, CLOTHING, TECH, or E-COMMERCE. For example, if they write "manti", "mantiani", or "mantiya", they mean "graduation gown", "mantle", "coat", or "cloak" (clothing), ABSOLUTELY NOT the food (dumplings).Step 1: Understand their intent and correct any typos to fit fashion/electronic/event themes.Step 2: Convert the idea into a highly detailed, professional, comma-separated English prompt for a text-to-image AI (like Flux or Midjourney).Step 3: Ensure it describes the visual elements beautifully. Include stylistic tags like: wide landscape banner, professional advertising photography, cinematic lighting, photorealistic, 8k resolution, highly detailed, beautiful faces, modern, no text on image.Template Context (if any): ${templateBase || 'None'}User's Idea: "${userText}"Respond ONLY with the final English prompt string, and nothing else.`;1 unmodified linereturn result.response.text().trim();} catch (e) {console.error("Gemini error:", e);return (templateBase ? templateBase + ', ' : '') + userText + ', professional advertising banner, cinematic lighting, photorealistic';}}741 unmodified linesconst encoded = encodeURIComponent(finalPrompt);// Hozirgi eng maxsus fotorealistik model: FLUX va Flux-Realism (turli qiyofa va xato oldini olish uchun)const url1 = `https://image.pollinations.ai/prompt/${encoded}?width=1024&height=512&seed=${ts1}&nologo=true&model=flux`;const url2 = `https://image.pollinations.ai/prompt/${encoded}?width=1024&height=512&seed=${ts2}&nologo=true&model=flux-realism`;await ctx.reply('⏳ Gemini promptni kengaytirib, Flux 2 ta variant yaratmoqda... (Kuting, 20-40 soniya)');33 unmodified lines34353637383940414243444546474849505152535455561 unmodified line58596061626364741 unmodified lines80680780880981081181281333 unmodified lines});}// AI yordamida (Gemini) promptni professional kengaytirishasync function enhancePromptWithGemini(userText, templateBase = '') {if (!process.env.GEMINI_API_KEY) {return (templateBase ? templateBase + ', ' : '') + userText + ', photorealistic, detailed';}try {const model = genAI.getGenerativeModel({ model: "gemini-2.5-flash" });const prompt = `You are an expert AI image prompt engineer for an e-commerce platform.The user wants to generate a banner image, but they write in Uzbek and might have typos.CRITICAL RULE: Interpret words in FASHION, CLOTHING, TECH, or E-COMMERCE contexts. E.g., if they write "manti", "mantiani", or "mantiya", they mean "graduation gown", "coat", or "mantle" (clothing), NEVER the food (dumplings).Step 1: Understand their intent and correct typos.Step 2: Convert the idea into a clean, highly descriptive English prompt for Midjourney/Flux.Step 3: Keep it heavily focused on the SUBJECT. DO NOT add generic tags like "banner" or "advertising" that ruin the immersion. Just describe the scene, the models, the clothes, and the environment. Add: ", photorealistic, cinematic, highly detailed, no text".Example Output: "A handsome male student and a beautiful female student wearing elegant graduation gowns, evening graduation party, cinematic lighting, photorealistic, no text"Template Context: ${templateBase || 'None'}User's Idea: "${userText}"Respond ONLY with the final English prompt string, and nothing else.`;1 unmodified linereturn result.response.text().trim();} catch (e) {console.error("Gemini error:", e);return userText + ', photorealistic, no text';}}741 unmodified linesconst encoded = encodeURIComponent(finalPrompt);// Hozirgi eng maxsus fotorealistik model: FLUX va Flux-Realism (turli qiyofa va xato oldini olish uchun)const url1 = `https://image.pollinations.ai/prompt/${encoded}?width=1024&height=430&seed=${ts1}&nologo=true&model=flux`;const url2 = `https://image.pollinations.ai/prompt/${encoded}?width=1024&height=430&seed=${ts2}&nologo=true&model=flux-realism`;await ctx.reply('⏳ Gemini promptni kengaytirib, Flux 2 ta variant yaratmoqda... (Kuting, 20-40 soniya)');
bot/bot.js+12-11