SMILE AIv4.0.00/10
v4.0.0 Settings
🥚 Steal an egg 🧱 Bloxd.io ⭐ Brawl Stars 🏎️ Mario Kart 📚 Wikipedia
Online mode: will use live data + AI. Offline mode: uses downloaded AI file.
👋 SMILE AI v4.0.0 - New Logic!

🌐 Online: Live scraping + AI answer
📴 Offline: Download AI file while online, then import it offline - it becomes your local AI

Fixed: coding bugs, crab bug, removed images, no custom links.
HTML Preview - v4.0.0
`; return `

${prompt.slice(0,50)}

This page was generated by Smile AI v4.0.0 Coding Mode.

Prompt: ${prompt.slice(0,120)}

`; } async function liveAI(prompt, liveContext='', memory='', isCoding=false){ let system = isCoding? `You are Smile AI v4.0.0 coding expert. Create complete HTML. Wrap final code in \`\`\`html CODE \`\`\`. Use only html css js. Must be runnable.` : `You are Smile AI v4.0.0 Online. Memory:\n${memory.slice(0,1500)}\nLive Scraped Data:\n${liveContext.slice(0,4000)}\nAnswer using live data when available. Be concise, friendly. Never output {} or [].`; const full = system + "\nUser: " + prompt; try{ const r=await fetch(`https://text.pollinations.ai/${encodeURIComponent(full)}?t=${Date.now()}`,{cache:'no-store'}); let t=await r.text(); t=t.trim(); if(!t || t==='{}' || t==='[]' || t.length<4) throw 'empty'; if(t.startsWith('{')){ try{ const j=JSON.parse(t); if(j.response) t=j.response; }catch{} } if(t==='{}'||t==='[]') throw 'empty'; t=t.replace(/GPT-4|GPT-3|ChatGPT|OpenAI/gi,'Smile AI'); return t; }catch{ if(isCoding) return localCodeGen(prompt); if(liveContext) return liveContext.slice(0,1200); return null; } } function extractCode(text){ let m = text.match(/```html([\s\S]*?)```/i) || text.match(/```([\s\S]*?)```/); if(m) return m[1].trim(); let start = text.indexOf(''); if(start===-1) start=text.indexOf('menu.classList.add('open'); document.getElementById('closeMenu').onclick=()=>menu.classList.remove('open'); document.getElementById('setBtn').onclick=()=>document.getElementById('settings').classList.toggle('open'); document.getElementById('closeSet').onclick=()=>document.getElementById('settings').classList.remove('open'); document.getElementById('modeSel').onchange=(e)=>{ mode=e.target.value; document.getElementById('modeLabel').innerText='v4.0.0 '+mode; if(mode==='offline' && !offlineAI){ alert('No Offline AI loaded. Go online, click 📦 AI to export, then import it.'); } }; document.getElementById('saveBtn').onclick=()=>{ if(!currentChat.length) return alert('No chat'); const blob=new Blob([JSON.stringify({title:currentChat[0]?.text?.slice(0,30), time:Date.now(), msgs:currentChat})],{type:'application/json'}); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url; a.download=`smile-chat-${Date.now()}.json`; a.click(); chats.unshift({title:currentChat[0]?.text?.slice(0,30), time:Date.now(), msgs:currentChat}); localStorage.setItem('smile_v4',JSON.stringify(chats.slice(0,30))); renderRecent(); }; document.getElementById('exportOfflineBtn').onclick=()=>{ if(!Object.keys(offlineCache).length) return alert('No live data yet. Ask something online first to scrape, then export.'); const bundle={version:'v4.0.0', timestamp:new Date().toLocaleString('en-HK',{timeZone:'Asia/Hong_Kong'}), knowledge:offlineCache, chatMemory:currentChat.slice(-20)}; const blob=new Blob([JSON.stringify(bundle)],{type:'application/json'}); const url=URL.createObjectURL(blob); const a=document.createElement('a'); a.href=url; a.download=`smile-offline-ai-${Date.now()}.json`; a.click(); localStorage.setItem('smile_offline_ai', JSON.stringify(bundle)); offlineAI=bundle; updateMem(); alert('Offline AI exported! File contains '+Object.keys(offlineCache).length+' pages. You can now go offline and import it.'); }; document.getElementById('importChatBtn').onclick=()=>document.getElementById('importChatFile').click(); document.getElemen