Update app.py
Browse files2 unmodified lines34567810 unmodified lines192021222324254 unmodified lines3031323334353637383940414243444546474849501 unmodified line5253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141154 unmodified lines12012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721864 unmodified lines28328428528628728828929022 unmodified lines31331431531631731831927 unmodified lines34734834935035135235335435535635735825 unmodified lines38438538638738838939039139216 unmodified lines40941041141241341441537 unmodified lines4534544554564574584599 unmodified lines4694704714724734744753 unmodified lines47948048148248348448529 unmodified lines51551651751851952052167 unmodified lines5895905915925935945955965975985996006016026036046053 unmodified lines6096106116126136146156166176186196206212 unmodified linesimport reimport urllib.parseimport urllib.requestimport cv2import numpy as npfrom flask import Flask, render_template_string, request, jsonify10 unmodified linesclient_groq = Groq(api_key=GROQ_API_KEY) if GROQ_API_KEY else None# ==========================================# FRONTEND - TAM MONOXROM (DARK) DİZAYN# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>4 unmodified lines<title>Exypos AI | IAHAI</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>:root {--bg-dark: #050505;--color-white: #ffffff;--color-gray-light: #b0b0b0;--color-gray-dark: #1a1a1a;--text-main: #f4f4f5;--text-muted: #888888;--bubble-bot-grad: linear-gradient(135deg, #111111, #222222);--highlight-color-hue: 280deg;}* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }body { background-color: var(--bg-dark); color: var(--text-main); height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }/* --- ARXA PLAN OBYEKTLƏRİ --- */.ambient-bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #050505; }.orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.3; will-change: transform; }.orb-1 { width: 500px; height: 500px; background: rgba(255, 255, 255, 0.15); top: 0%; left: 0%; animation: float1 25s infinite alternate ease-in-out; }1 unmodified line@keyframes float1 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(25vw, 35vh) scale(1.1); } }@keyframes float2 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-35vw, -25vh) scale(1.2); } }/* --- SPLASH VƏ SİDEBAR --- */#splash { position: fixed; inset: 0; background: rgba(5, 5, 5, 0.95); backdrop-filter: blur(25px); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 2s ease-in-out, visibility 2s; }.splash-text { font-size: 50px; font-weight: 300; letter-spacing: 20px; color: var(--color-white); opacity: 0; filter: blur(40px); transform: scale(1.3); animation: cinematicReveal 3s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.3s; text-shadow: 0 0 30px rgba(255,255,255,0.2); }.splash-sub { font-size: 13px; color: var(--text-muted); letter-spacing: 10px; opacity: 0; transform: translateY(20px); animation: subReveal 2s ease-out forwards 1.8s; text-transform: uppercase; margin-top: 25px; }@keyframes cinematicReveal { 100% { opacity: 1; filter: blur(0); transform: scale(1); } }@keyframes subReveal { 100% { opacity: 0.6; filter: blur(0); transform: translateY(0); } }.top-bar { position: fixed; top: 0; left: 0; width: 100%; height: 80px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 1000; pointer-events: none; }.top-right-actions { display: flex; align-items: center; gap: 20px; pointer-events: auto; }.menu-btn, .login-btn { pointer-events: auto; background: rgba(255,255,255,0.03); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.08); color: var(--color-white); cursor: pointer; transition: 0.4s; z-index: 2500; }.menu-btn { width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }.login-btn { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 30px; font-weight: 500; box-shadow: 0 4px 15px rgba(0,0,0,0.5); height: 45px; }.menu-btn:hover, .login-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }.login-btn img { width: 20px; height: 20px; filter: grayscale(100%) brightness(150%); }/* --- YENİ INSTAGRAM DÜYMƏSİ (DARK VƏ İDEAL) --- */.tooltip-container { position: relative; cursor: pointer; transition: all 0.2s; border-radius: 10px; z-index: 3000; display: flex; align-items: center; }.tooltip {position: absolute; top: 60px; right: 0;padding: 10px; opacity: 0; pointer-events: none; transition: all 0.3s; border-radius: 15px;box-shadow: 0 10px 30px rgba(0,0,0,0.8);}.profile { background: #111111; border-radius: 12px; padding: 12px; border: 1px solid rgba(255,255,255,0.1); min-width: 180px; }.tooltip-container:hover .tooltip { top: 55px; opacity: 1; visibility: visible; pointer-events: auto; }.icon { text-decoration: none; color: #fff; display: block; position: relative; width: 45px; height: 45px; }.layer { width: 45px; height: 45px; transition: transform 0.3s; }.icon:hover .layer { transform: rotate(-35deg) skew(20deg); }.layer span { position: absolute; top: 0; left: 0; height: 100%; width: 100%; border: 1px solid rgba(255,255,255,0.2); border-radius: 12px; transition: all 0.3s; background: #0a0a0a; }.icon:hover .layer span { box-shadow: -1px 1px 3px rgba(255,255,255,0.3); }.icon .text {position: absolute; left: 50%; bottom: -10px; opacity: 0;font-weight: 600; font-size: 11px; letter-spacing: 1px; transform: translateX(-50%);transition: bottom 0.3s ease, opacity 0.3s ease;color: #fff; background: #1a1a1a; padding: 4px 12px;border-radius: 20px; border: 1px solid rgba(255,255,255,0.15);white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.5);}.icon:hover .text { bottom: -28px; opacity: 1; }.icon:hover .layer span:nth-child(1) { opacity: 0.2; }.icon:hover .layer span:nth-child(2) { opacity: 0.4; transform: translate(5px, -5px); }.icon:hover .layer span:nth-child(3) { opacity: 0.6; transform: translate(10px, -10px); }.icon:hover .layer span:nth-child(4) { opacity: 0.8; transform: translate(15px, -15px); }.icon:hover .layer span:nth-child(5) { opacity: 1; transform: translate(20px, -20px); }.instagramSVG { font-size: 22px; display: flex; align-items: center; justify-content: center; background: #111; border-radius: 12px; }.user { display: flex; gap: 12px; align-items: center; }.img { width: 40px; height: 40px; font-size: 15px; font-weight: 700; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #1a1a1a; color: #fff; }.name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 2px;}.username { font-size: 12px; color: #888; }.details { display: flex; flex-direction: column; justify-content: center; }.about { color: rgba(255,255,255,0.4); padding-top: 8px; font-size: 11px; border-top: 1px solid rgba(255,255,255,0.05); margin-top: 8px; }/* --- SİDEBAR --- */.sidebar { position: fixed; top: 0; left: -320px; width: 300px; height: 100%; background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(35px); border-right: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; padding: 90px 20px 20px 20px; z-index: 2000; transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 20px 0 50px rgba(0,0,0,0.8); }.sidebar.open { left: 0; }.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 1900; opacity: 0; visibility: hidden; transition: 0.4s; }.sidebar-overlay.open { opacity: 1; visibility: visible; }4 unmodified lines.history-item:hover { background: rgba(255,255,255,0.08); color: var(--color-white); }.history-item.active { background: rgba(255, 255, 255, 0.1); border-left: 3px solid var(--color-white); color: var(--color-white); }/* --- CHAT ZONASI --- */.chat-area { flex: 1; display: flex; flex-direction: column; padding-top: 80px; position: relative; z-index: 10; align-items: center; }.glass-container { width: 98%; max-width: 1400px; height: calc(100vh - 180px); background: radial-gradient(circle at top left, rgba(255,255,255,0.04), rgba(0,0,0,0.4)); backdrop-filter: blur(40px); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 35px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,0.8); }.messages-wrapper { flex: 1; overflow-y: auto; padding: 40px; scroll-behavior: smooth; scrollbar-width: none; }.message { margin-bottom: 30px; display: flex; flex-direction: column; max-width: 80%; animation: slideUpSoft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(20px); }.msg-user { align-self: flex-start; margin-right: auto; }.msg-bot { align-self: flex-end; margin-left: auto; padding-right: 60px; position: relative; }.bubble { padding: 16px 24px; line-height: 1.6; font-size: 15px; border-radius: 24px; letter-spacing: 0.4px; box-shadow: 0 8px 20px rgba(0,0,0,0.3); }.msg-user .bubble { background: rgba(30, 30, 30, 0.6); border: 1px solid rgba(255,255,255,0.05); border-left: 3px solid rgba(255,255,255,0.3); border-radius: 24px 24px 24px 6px; }.msg-bot .bubble { background: var(--bubble-bot-grad); border: 1px solid rgba(255,255,255,0.1); border-right: 3px solid var(--color-white); border-radius: 24px 24px 6px 24px; color: #fff; }.msg-bot img { max-width: 100%; border-radius: 18px; margin-top: 12px; border: 1px solid rgba(255,255,255,0.15); filter: grayscale(20%); transition: 0.3s; }.msg-bot img:hover { filter: grayscale(0%); }.msg-bot::after { content: '\\f544'; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 0; top: 0; width: 45px; height: 45px; background: var(--color-white); color: black; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 18px; }.typing-cursor::after { content: '▌'; animation: blink 1s step-end infinite; color: var(--color-white); margin-left: 6px; opacity: 0.8; }@keyframes blink { 50% { opacity: 0; } }@keyframes slideUpSoft { to { opacity: 1; transform: translateY(0); } }/* --- İNPUT ZONASI & MODE MENU --- */.input-zone { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 15px; z-index: 100; width: 90%; max-width: 1000px; }.mode-menu { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(10px); background: rgba(15, 15, 15, 0.95); backdrop-filter: blur(25px); border: 1px solid rgba(255,255,255,0.1); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 15px 40px rgba(0,0,0,0.8); opacity: 0; visibility: hidden; transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 105; }.mode-menu.active { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }.mode-btn { background: transparent; color: var(--text-muted); border: none; padding: 12px 20px; border-radius: 12px; cursor: pointer; text-align: left; font-size: 14px; transition: 0.2s; display: flex; align-items: center; gap: 12px; font-weight: 500; }.mode-btn:hover { background: rgba(255,255,255,0.05); color: var(--color-white); }.mode-btn.active { background: rgba(255,255,255,0.1); color: var(--color-white); border-left: 3px solid var(--color-white); }/* --- GENERATE DÜYMƏSİ --- */.btn-wrapper { position: relative; display: inline-block; flex-shrink: 0; }.btn {--border-radius: 24px; --padding: 4px; --transition: 0.4s; --button-color: #101010;user-select: none; display: flex; justify-content: center; padding: 0.8em 1.2em;font-family: "Poppins", "Inter", sans-serif; font-size: 1em; font-weight: bold; letter-spacing: 2px;background-color: var(--button-color); border: solid 1px #fff2; border-radius: var(--border-radius);cursor: pointer; transition: box-shadow var(--transition), border var(--transition), background-color var(--transition);box-shadow: inset 0px 1px 1px rgba(255,255,255,0.2), inset 0px 4px 4px rgba(255,255,255,0.1), 0px -4px 4px rgba(0,0,0,0.05);}.btn::before {content: ""; position: absolute; top: calc(0px - var(--padding)); left: calc(0px - var(--padding));width: calc(100% + var(--padding) * 2); height: calc(100% + var(--padding) * 2);border-radius: calc(var(--border-radius) + var(--padding)); pointer-events: none;background-image: linear-gradient(0deg, #0004, #000a); z-index: -1;box-shadow: 0 -8px 8px -6px #0000 inset, 1px 1px 1px #fff2, -1px -1px 1px #0002;}.btn::after {content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none;background-image: linear-gradient(0deg, #fff, hsl(var(--highlight-color-hue), 100%, 70%), transparent); opacity: 0; transition: opacity var(--transition);}.btn-letter { position: relative; display: inline-block; color: #fff5; animation: letter-anim 2s ease-in-out infinite; }@keyframes letter-anim { 50% { text-shadow: 0 0 3px #fff8; color: #fff; } }.btn:hover { border: solid 1px hsla(var(--highlight-color-hue), 100%, 80%, 40%); }.btn:hover::after { opacity: 1; mask-image: linear-gradient(0deg, #fff, transparent); }.btn:focus .btn-letter { animation: focused-letter-anim 1s ease-in-out forwards, letter-anim 1.2s ease-in-out infinite; }@keyframes focused-letter-anim { 50% { transform: scale(1.5); filter: blur(5px) brightness(150%) drop-shadow(-10px 5px 5px hsl(var(--highlight-color-hue), 100%, 70%)); } }.btn-letter:nth-child(1) { animation-delay: 0s; } .btn-letter:nth-child(2) { animation-delay: 0.2s; } .btn-letter:nth-child(3) { animation-delay: 0.4s; }/* --- GENİŞLƏNƏN MESAJ QUTUSU --- */.input-box-container {position: relative; display: flex; align-items: center;background: #111111; border: 1px solid rgba(255, 255, 255, 0.08);border-radius: 50px; padding: 5px 10px; width: 250px;transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);box-shadow: 0px 12px 24px -1px rgba(0, 0, 0, 0.5);}.input-box-container:focus-within { width: 100%; max-width: 800px; background: #151515; border-color: rgba(255, 255, 255, 0.2); }.plus-btn { background: transparent; border: none; color: #666; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 10px; transition: 0.3s; }.plus-btn:hover { color: var(--color-white); transform: rotate(90deg); }.expanding-input { flex: 1; background: transparent; border: none; color: var(--color-white); font-size: 16px; font-weight: 400; padding: 12px 10px; outline: none; }.expanding-input::placeholder { color: rgba(255,255,255,0.3); }.send-btn { background: var(--color-white); color: black; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: 0.3s; box-shadow: 0 5px 15px rgba(255,255,255,0.1); }.send-btn:hover { transform: scale(1.1) rotate(15deg); background: #e0e0e0; }/* --- KOSMİK LOADER --- */#image-loader-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); z-index: 9999; display: none; align-items: center; justify-content: center; flex-direction: column; }.loader-center { position: relative; display: flex; align-items: center; justify-content: center; width: 180px; height: 180px; font-family: "Inter", sans-serif; font-size: 1.2em; font-weight: bold; color: white; border-radius: 50%; background-color: transparent; user-select: none; }.loader { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1/1; border-radius: 50%; background-color: transparent; animation: loader-rotate 2s linear infinite; z-index: 0; }@keyframes loader-rotate {0% { transform: rotate(90deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; }50% { transform: rotate(270deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 10px 0 #d60a47 inset, 0 40px 60px 0 #311e80 inset; }100% { transform: rotate(450deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; }}.loader-text { position: absolute; z-index: 1; display: flex; gap: 3px; letter-spacing: 2px; }.loader-letter { display: inline-block; opacity: 0.4; transform: translateY(0); animation: loader-letter-anim 2s infinite; border-radius: 50ch; }.loader-letter:nth-child(1) { animation-delay: 0s; } .loader-letter:nth-child(2) { animation-delay: 0.1s; } .loader-letter:nth-child(3) { animation-delay: 0.2s; }.loader-letter:nth-child(4) { animation-delay: 0.3s; } .loader-letter:nth-child(5) { animation-delay: 0.4s; } .loader-letter:nth-child(6) { animation-delay: 0.5s; }.loader-letter:nth-child(7) { animation-delay: 0.6s; } .loader-letter:nth-child(8) { animation-delay: 0.7s; } .loader-letter:nth-child(9) { animation-delay: 0.8s; } .loader-letter:nth-child(10) { animation-delay: 0.9s; }@keyframes loader-letter-anim { 0%, 100% { opacity: 0.4; transform: translateY(0); } 20% { opacity: 1; transform: scale(1.15); } 40% { opacity: 0.7; transform: translateY(0); } }/* Limit Modalı */#limit-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(20px); z-index: 3000; display: none; align-items: center; justify-content: center; opacity: 0; transition: 0.6s; }.modal-content { background: rgba(20,20,20,0.95); border: 1px solid rgba(255,255,255,0.1); padding: 50px 40px; border-radius: 25px; text-align: center; max-width: 420px; box-shadow: 0 30px 70px rgba(0,0,0,0.8); }@media (max-width: 768px) {.glass-container { width: 100%; height: calc(100vh - 160px); border-radius: 20px; border-left: none; border-right: none; }.messages-wrapper { padding: 25px 20px; }.input-zone { width: 96%; bottom: 20px; gap: 10px; }.input-box-container { width: 180px; }64 unmodified lines<div class="input-zone" id="input-zone"><div class="mode-menu" id="mode-menu"><button class="mode-btn active" onclick="setAiMode('ExyposAi')"><i class="fa-solid fa-robot" style="color: #fff;"></i> ExyposAi (Standart)</button><button class="mode-btn" onclick="setAiMode('ExyposGReco')"><i class="fa-solid fa-fingerprint" style="color: #b0b0b0;"></i> ExyposGReco (EGR)</button></div><div class="btn-wrapper" onclick="triggerSekilCommand()">22 unmodified lines<div class="modal-content"><h2 style="color: white; margin-bottom: 20px; font-weight: 300; letter-spacing: 1px;"><i class="fa-solid fa-shield-halved" style="color: #fff; margin-right: 10px;"></i> Limit Doldu</h2><p style="color: rgba(255,255,255,0.5); margin-bottom: 30px; line-height: 1.7; font-size: 14px;">Sistemin rahat və sürətli işləməsi üçün 10 mesajdan sonra Google ilə giriş tələb olunur.</p><button class="new-chat-btn" style="width: 100%; margin: 0; padding: 14px;" onclick="simulateGoogleLogin()"><img src="https://cdn-icons-png.flaticon.com/512/300/300221.png" style="width:20px; filter: grayscale(100%);"> Google ilə Davam Et</button></div>27 unmodified lines}function toggleModeMenu() { document.getElementById('mode-menu').classList.toggle('active'); }function setAiMode(mode) {currentAiMode = mode;document.querySelectorAll('.mode-btn').forEach(b => b.classList.remove('active'));event.currentTarget.classList.add('active');toggleModeMenu();inputField.placeholder = mode === 'ExyposGReco' ? "EGR: Link və ya mətn at..." : "Exypos-a yaz...";}document.addEventListener('click', function(event) {25 unmodified linesif (chats[id].messages.length === 0) {chatBox.innerHTML = `<div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0.3;"><i class="fa-brands fa-connectdevelop" style="font-size: 60px; color: #fff; margin-bottom: 25px; filter: drop-shadow(0 0 20px rgba(255,255,255,0.3));"></i><h2 style="margin-bottom: 12px; font-weight: 300; letter-spacing: 4px;">EXYPOS AI</h2><p style="color: rgba(255,255,255,0.5); font-weight: 300; letter-spacing: 1px;">GEN düyməsinə bas və xəyallarını canlandır</p></div>`;} else {16 unmodified linesfunction checkLoginState() {if (isLoggedIn) {document.getElementById('btn-login').innerHTML = `<i class="fa-solid fa-user-check" style="color:#fff;"></i> Tunar (Aktiv)`;document.getElementById('limit-modal').style.display = 'none';}}37 unmodified linesconst loadDiv = document.createElement('div');loadDiv.className = 'message msg-bot';loadDiv.id = loadingId;loadDiv.innerHTML = `<div class="bubble" style="color: rgba(255,255,255,0.5); font-style: italic;"><i class="fa-solid fa-circle-notch fa-spin" style="color: #fff; margin-right: 8px;"></i> Analiz edilir...</div>`;chatBox.appendChild(loadDiv);chatBox.scrollTop = chatBox.scrollHeight;}9 unmodified linesif (isImageReq) {if(data.type === 'image_url') {const tempImg = new Image();tempImg.src = data.content;tempImg.onload = () => {document.getElementById('image-loader-overlay').style.display = 'none';3 unmodified linestempImg.onerror = () => {document.getElementById('image-loader-overlay').style.display = 'none';appendMessageUI('bot', '<span style="color:#ff4444; font-size:14px;">❌ Şəkil serveri çox yüklüdür. Xahiş edirəm bir az sonra yenidən cəhd et.</span>', true, true);};} else {document.getElementById('image-loader-overlay').style.display = 'none';29 unmodified linesbubble.className = 'bubble typing-cursor';div.appendChild(bubble); chatBox.appendChild(div);let i = 0; const speed = 12;function type() {if (i < fullText.length) {bubble.innerHTML += fullText.charAt(i); i++;67 unmodified lineshistory = data.get("history", [])mode = data.get("mode", "ExyposAi")# 1. YENİ ŞƏKİL YARATMAQ (Xətasız URL Metodu)if user_msg.lower().startswith(("/sekil", "/şəkil", "/image")):prompt = re.sub(r"^/(sekil|şəkil|image)\s*", "", user_msg, flags=re.IGNORECASE).strip()enhanced_prompt = f"Masterpiece, ultra detailed, highly realistic: {prompt}"safe_prompt = urllib.parse.quote(enhanced_prompt)seed = random.randint(1, 1000000)img_url = f"https://image.pollinations.ai/prompt/{safe_prompt}?width=1024&height=1024&nologo=true&seed={seed}"return jsonify({"type": "image_url", "content": img_url})# 2. EGR MƏNTİQİif mode == "ExyposGReco":if "http" in user_msg:urls = re.findall(r'(https?://[^\s]+)', user_msg)3 unmodified linesreturn jsonify({"type": "image", "content": analysis_result})sys_prompt = "Sən ExyposGReco-san (EGR). Sənin əsas vəzifən sənə göndərilən linklərin doğruluğunu (Fake/Real) analiz etməkdir. İstifadəçiyə bir skaner kimi ciddi və analitik dildə cavab ver. Qısa və konkret ol."# 3. STANDART EXYPOS AIelse:sys_prompt = """Sən ExyposAI-san. QAYDALAR:1. Əgər "adın nədir" və ya "kim yaradıb" soruşsalar, DƏQİQ BELƏ DE: 'Mən ExyposAi, IAHAI tərəfindən inkişaf etdirilən süni intellektəm.'2. İstifadəçi hansı dildə yazırsa, O DİLDƏ cavab ver.3. Sən çox ağıllısan, sürətlisən. Şəkil çəkmək üçün istifadəçiyə '/sekil [mətn]' yazmağı xatırlat."""msgs = [{"role": "system", "content": sys_prompt}]for m in history[-10:]:role = "user" if m['sender'] == 'user' else "assistant"2 unmodified lines3456789101110 unmodified lines222324252627284 unmodified lines333435363738394041424344454647481 unmodified line50515253545556575859606162636465666768697071727374757677787980818283848586878889904 unmodified lines959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419564 unmodified lines26026126226326426526626726822 unmodified lines29129229329429529629727 unmodified lines32532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635725 unmodified lines38338438538638738838939039116 unmodified lines40840941041141241341437 unmodified lines4524534544554564574589 unmodified lines4684694704714724734743 unmodified lines47847948048148248348429 unmodified lines51451551651751851952052152267 unmodified lines5905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206213 unmodified lines6256266276286296306316326336346356366376386396406416426436446456462 unmodified linesimport reimport urllib.parseimport urllib.requestimport base64import iofrom PIL import Imageimport cv2import numpy as npfrom flask import Flask, render_template_string, request, jsonify10 unmodified linesclient_groq = Groq(api_key=GROQ_API_KEY) if GROQ_API_KEY else None# ==========================================# FRONTEND - MULTI-THEME (DARK VƏ OG WHITE)# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>4 unmodified lines<title>Exypos AI | IAHAI</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>/* --- STANDART (DARK) EXYPOS AI DİZAYNI --- */:root {--bg-dark: #050505; --color-white: #ffffff; --color-gray-light: #b0b0b0; --color-gray-dark: #1a1a1a;--text-main: #f4f4f5; --text-muted: #888888; --bubble-bot-grad: linear-gradient(135deg, #111111, #222222);--highlight-color-hue: 280deg;}* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }body { background-color: var(--bg-dark); color: var(--text-main); height: 100dvh; overflow: hidden; display: flex; flex-direction: column; transition: background 0.5s, color 0.5s; }.ambient-bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #050505; }.orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.3; will-change: transform; }.orb-1 { width: 500px; height: 500px; background: rgba(255, 255, 255, 0.15); top: 0%; left: 0%; animation: float1 25s infinite alternate ease-in-out; }1 unmodified line@keyframes float1 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(25vw, 35vh) scale(1.1); } }@keyframes float2 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-35vw, -25vh) scale(1.2); } }#splash { position: fixed; inset: 0; background: rgba(5, 5, 5, 0.95); backdrop-filter: blur(25px); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 2s ease-in-out, visibility 2s; }.splash-text { font-size: 50px; font-weight: 300; letter-spacing: 20px; color: var(--color-white); opacity: 0; filter: blur(40px); transform: scale(1.3); animation: cinematicReveal 3s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.3s; text-shadow: 0 0 30px rgba(255,255,255,0.2); }.splash-sub { font-size: 13px; color: var(--text-muted); letter-spacing: 10px; opacity: 0; transform: translateY(20px); animation: subReveal 2s ease-out forwards 1.8s; text-transform: uppercase; margin-top: 25px; }@keyframes cinematicReveal { 100% { opacity: 1; filter: blur(0); transform: scale(1); } }@keyframes subReveal { 100% { opacity: 0.6; filter: blur(0); transform: translateY(0); } }.top-bar { position: fixed; top: 0; left: 0; width: 100%; height: 80px; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 1000; pointer-events: none; transition: 0.5s; }.top-right-actions { display: flex; align-items: center; gap: 20px; pointer-events: auto; }.menu-btn, .login-btn { pointer-events: auto; background: rgba(255,255,255,0.03); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.08); color: var(--color-white); cursor: pointer; transition: 0.4s; z-index: 2500; }.menu-btn { width: 45px; height: 45px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }.login-btn { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-radius: 30px; font-weight: 500; box-shadow: 0 4px 15px rgba(0,0,0,0.5); height: 45px; }.menu-btn:hover, .login-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }.login-btn img { width: 20px; height: 20px; filter: grayscale(100%) brightness(150%); }/* Instagram düyməsi */.tooltip-container { position: relative; cursor: pointer; transition: all 0.2s; border-radius: 10px; z-index: 3000; display: flex; align-items: center; }.tooltip { position: absolute; top: 60px; right: 0; padding: 10px; opacity: 0; pointer-events: none; transition: all 0.3s; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }.profile { background: #111111; border-radius: 12px; padding: 12px; border: 1px solid rgba(255,255,255,0.1); min-width: 180px; }.tooltip-container:hover .tooltip { top: 55px; opacity: 1; visibility: visible; pointer-events: auto; }.icon { text-decoration: none; color: #fff; display: block; position: relative; width: 45px; height: 45px; }.layer { width: 45px; height: 45px; transition: transform 0.3s; }.icon:hover .layer { transform: rotate(-35deg) skew(20deg); }.layer span { position: absolute; top: 0; left: 0; height: 100%; width: 100%; border: 1px solid rgba(255,255,255,0.2); border-radius: 12px; transition: all 0.3s; background: #0a0a0a; }.icon:hover .layer span { box-shadow: -1px 1px 3px rgba(255,255,255,0.3); }.icon .text { position: absolute; left: 50%; bottom: -10px; opacity: 0; font-weight: 600; font-size: 11px; letter-spacing: 1px; transform: translateX(-50%); transition: bottom 0.3s ease, opacity 0.3s ease; color: #fff; background: #1a1a1a; padding: 4px 12px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.15); white-space: nowrap; box-shadow: 0 4px 10px rgba(0,0,0,0.5); }.icon:hover .text { bottom: -28px; opacity: 1; }.icon:hover .layer span:nth-child(1) { opacity: 0.2; } .icon:hover .layer span:nth-child(2) { opacity: 0.4; transform: translate(5px, -5px); } .icon:hover .layer span:nth-child(3) { opacity: 0.6; transform: translate(10px, -10px); } .icon:hover .layer span:nth-child(4) { opacity: 0.8; transform: translate(15px, -15px); } .icon:hover .layer span:nth-child(5) { opacity: 1; transform: translate(20px, -20px); }.instagramSVG { font-size: 22px; display: flex; align-items: center; justify-content: center; background: #111; border-radius: 12px; }.user { display: flex; gap: 12px; align-items: center; }.img { width: 40px; height: 40px; font-size: 15px; font-weight: 700; border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; display: flex; align-items: center; justify-content: center; background: #1a1a1a; color: #fff; }.name { font-size: 15px; font-weight: 700; color: #fff; margin-bottom: 2px;} .username { font-size: 12px; color: #888; }.details { display: flex; flex-direction: column; justify-content: center; }.about { color: rgba(255,255,255,0.4); padding-top: 8px; font-size: 11px; border-top: 1px solid rgba(255,255,255,0.05); margin-top: 8px; }.sidebar { position: fixed; top: 0; left: -320px; width: 300px; height: 100%; background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(35px); border-right: 1px solid rgba(255,255,255,0.05); display: flex; flex-direction: column; padding: 90px 20px 20px 20px; z-index: 2000; transition: left 0.5s cubic-bezier(0.16, 1, 0.3, 1), background 0.5s; box-shadow: 20px 0 50px rgba(0,0,0,0.8); }.sidebar.open { left: 0; }.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 1900; opacity: 0; visibility: hidden; transition: 0.4s; }.sidebar-overlay.open { opacity: 1; visibility: visible; }4 unmodified lines.history-item:hover { background: rgba(255,255,255,0.08); color: var(--color-white); }.history-item.active { background: rgba(255, 255, 255, 0.1); border-left: 3px solid var(--color-white); color: var(--color-white); }.chat-area { flex: 1; display: flex; flex-direction: column; padding-top: 80px; position: relative; z-index: 10; align-items: center; }.glass-container { width: 98%; max-width: 1400px; height: calc(100vh - 180px); background: radial-gradient(circle at top left, rgba(255,255,255,0.04), rgba(0,0,0,0.4)); backdrop-filter: blur(40px); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 35px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 30px 60px rgba(0,0,0,0.8); transition: 0.5s; }.messages-wrapper { flex: 1; overflow-y: auto; padding: 40px; scroll-behavior: smooth; scrollbar-width: none; }.message { margin-bottom: 30px; display: flex; flex-direction: column; max-width: 80%; animation: slideUpSoft 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(20px); }.msg-user { align-self: flex-start; margin-right: auto; }.msg-bot { align-self: flex-end; margin-left: auto; padding-right: 60px; position: relative; }.bubble { padding: 16px 24px; line-height: 1.6; font-size: 15px; border-radius: 24px; letter-spacing: 0.4px; box-shadow: 0 8px 20px rgba(0,0,0,0.3); transition: 0.5s; }.msg-user .bubble { background: rgba(30, 30, 30, 0.6); border: 1px solid rgba(255,255,255,0.05); border-left: 3px solid rgba(255,255,255,0.3); border-radius: 24px 24px 24px 6px; }.msg-bot .bubble { background: var(--bubble-bot-grad); border: 1px solid rgba(255,255,255,0.1); border-right: 3px solid var(--color-white); border-radius: 24px 24px 6px 24px; color: #fff; }.msg-bot img { max-width: 100%; border-radius: 18px; margin-top: 12px; border: 1px solid rgba(255,255,255,0.15); filter: grayscale(20%); transition: 0.3s; }.msg-bot img:hover { filter: grayscale(0%); }.msg-bot::after { content: '\\f544'; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 0; top: 0; width: 45px; height: 45px; background: var(--color-white); color: black; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: 0.5s; }.typing-cursor::after { content: '▌'; animation: blink 1s step-end infinite; color: var(--color-white); margin-left: 6px; opacity: 0.8; }@keyframes blink { 50% { opacity: 0; } }@keyframes slideUpSoft { to { opacity: 1; transform: translateY(0); } }.input-zone { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 15px; z-index: 100; width: 90%; max-width: 1000px; transition: 0.5s; }.mode-menu { position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(10px); background: rgba(15, 15, 15, 0.95); backdrop-filter: blur(25px); border: 1px solid rgba(255,255,255,0.1); border-radius: 18px; padding: 8px; display: flex; flex-direction: column; gap: 5px; box-shadow: 0 15px 40px rgba(0,0,0,0.8); opacity: 0; visibility: hidden; transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1); z-index: 105; }.mode-menu.active { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }.mode-btn { background: transparent; color: var(--text-muted); border: none; padding: 12px 20px; border-radius: 12px; cursor: pointer; text-align: left; font-size: 14px; transition: 0.2s; display: flex; align-items: center; gap: 12px; font-weight: 500; }.mode-btn:hover { background: rgba(255,255,255,0.05); color: var(--color-white); }.mode-btn.active { background: rgba(255,255,255,0.1); color: var(--color-white); border-left: 3px solid var(--color-white); }.btn-wrapper { position: relative; display: inline-block; flex-shrink: 0; }.btn { --border-radius: 24px; --padding: 4px; --transition: 0.4s; --button-color: #101010; user-select: none; display: flex; justify-content: center; padding: 0.8em 1.2em; font-family: "Poppins", "Inter", sans-serif; font-size: 1em; font-weight: bold; letter-spacing: 2px; background-color: var(--button-color); border: solid 1px #fff2; border-radius: var(--border-radius); cursor: pointer; transition: box-shadow var(--transition), border var(--transition), background-color var(--transition); box-shadow: inset 0px 1px 1px rgba(255,255,255,0.2), inset 0px 4px 4px rgba(255,255,255,0.1), 0px -4px 4px rgba(0,0,0,0.05); }.btn::before { content: ""; position: absolute; top: calc(0px - var(--padding)); left: calc(0px - var(--padding)); width: calc(100% + var(--padding) * 2); height: calc(100% + var(--padding) * 2); border-radius: calc(var(--border-radius) + var(--padding)); pointer-events: none; background-image: linear-gradient(0deg, #0004, #000a); z-index: -1; box-shadow: 0 -8px 8px -6px #0000 inset, 1px 1px 1px #fff2, -1px -1px 1px #0002; }.btn::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: inherit; pointer-events: none; background-image: linear-gradient(0deg, #fff, hsl(var(--highlight-color-hue), 100%, 70%), transparent); opacity: 0; transition: opacity var(--transition); }.btn-letter { position: relative; display: inline-block; color: #fff5; animation: letter-anim 2s ease-in-out infinite; }@keyframes letter-anim { 50% { text-shadow: 0 0 3px #fff8; color: #fff; } }.btn:hover { border: solid 1px hsla(var(--highlight-color-hue), 100%, 80%, 40%); }.btn:hover::after { opacity: 1; mask-image: linear-gradient(0deg, #fff, transparent); }.input-box-container { position: relative; display: flex; align-items: center; background: #111111; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 50px; padding: 5px 10px; width: 250px; transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1); box-shadow: 0px 12px 24px -1px rgba(0, 0, 0, 0.5); }.input-box-container:focus-within { width: 100%; max-width: 800px; background: #151515; border-color: rgba(255, 255, 255, 0.2); }.plus-btn { background: transparent; border: none; color: #666; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0 10px; transition: 0.3s; }.plus-btn:hover { color: var(--color-white); transform: rotate(90deg); }.expanding-input { flex: 1; background: transparent; border: none; color: var(--color-white); font-size: 16px; font-weight: 400; padding: 12px 10px; outline: none; transition: 0.5s; }.expanding-input::placeholder { color: rgba(255,255,255,0.3); transition: 0.5s; }.send-btn { background: var(--color-white); color: black; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; transition: 0.3s; box-shadow: 0 5px 15px rgba(255,255,255,0.1); }.send-btn:hover { transform: scale(1.1) rotate(15deg); background: #e0e0e0; }#image-loader-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); z-index: 9999; display: none; align-items: center; justify-content: center; flex-direction: column; }.loader-center { position: relative; display: flex; align-items: center; justify-content: center; width: 180px; height: 180px; font-family: "Inter", sans-serif; font-size: 1.2em; font-weight: bold; color: white; border-radius: 50%; background-color: transparent; user-select: none; }.loader { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1/1; border-radius: 50%; background-color: transparent; animation: loader-rotate 2s linear infinite; z-index: 0; }@keyframes loader-rotate { 0% { transform: rotate(90deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; } 50% { transform: rotate(270deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 10px 0 #d60a47 inset, 0 40px 60px 0 #311e80 inset; } 100% { transform: rotate(450deg); box-shadow: 0 10px 20px 0 #fff inset, 0 20px 30px 0 #ad5fff inset, 0 60px 60px 0 #471eec inset; } }.loader-text { position: absolute; z-index: 1; display: flex; gap: 3px; letter-spacing: 2px; }.loader-letter { display: inline-block; opacity: 0.4; transform: translateY(0); animation: loader-letter-anim 2s infinite; border-radius: 50ch; }.loader-letter:nth-child(1) { animation-delay: 0s; } .loader-letter:nth-child(2) { animation-delay: 0.1s; } .loader-letter:nth-child(3) { animation-delay: 0.2s; } .loader-letter:nth-child(4) { animation-delay: 0.3s; } .loader-letter:nth-child(5) { animation-delay: 0.4s; } .loader-letter:nth-child(6) { animation-delay: 0.5s; } .loader-letter:nth-child(7) { animation-delay: 0.6s; } .loader-letter:nth-child(8) { animation-delay: 0.7s; } .loader-letter:nth-child(9) { animation-delay: 0.8s; } .loader-letter:nth-child(10) { animation-delay: 0.9s; }@keyframes loader-letter-anim { 0%, 100% { opacity: 0.4; transform: translateY(0); } 20% { opacity: 1; transform: scale(1.15); } 40% { opacity: 0.7; transform: translateY(0); } }/* ========================================================EXYPOS OG THEME (KÖHNƏ VEB DİZAYN) - ZAMAN MAŞINI======================================================== */body.og-theme { background-color: #f5f6f7; color: #1c1e21; }.og-theme .ambient-bg { display: none !important; }.og-theme .glass-container { background: #ffffff; border: 1px solid #dcdcdc; border-radius: 8px; box-shadow: 0 1px 5px rgba(0,0,0,0.1); height: calc(100vh - 140px); margin-top: 10px; }.og-theme .top-bar { background: #ffffff; border-bottom: 1px solid #dcdcdc; height: 60px; position: relative; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }.og-theme .menu-btn, .og-theme .login-btn { background: #e4e6eb; color: #050505; border: 1px solid #ccd0d5; border-radius: 6px; box-shadow: none; font-weight: normal; }.og-theme .login-btn img { filter: grayscale(0%) brightness(100%); }.og-theme .tooltip-container { filter: invert(1); } /* Instagram düyməsini qara edir */.og-theme .sidebar { background: #ffffff; border-right: 1px solid #dcdcdc; box-shadow: 5px 0 15px rgba(0,0,0,0.05); }.og-theme .history-item { color: #333; border: 1px solid #ddd; background: #f9f9f9; margin-bottom: 5px; border-radius: 4px; }.og-theme .history-item:hover { background: #eee; }.og-theme .history-item.active { background: #e6f2ff; border-left: 4px solid #0084ff; font-weight: bold; }.og-theme .new-chat-btn { background: #0084ff; color: white; border-radius: 6px; box-shadow: none; }.og-theme .input-zone { bottom: 15px; width: 95%; }.og-theme .input-box-container { background: #ffffff; border: 1px solid #ccd0d5; border-radius: 20px; box-shadow: inset 0 1px 2px rgba(0,0,0,0.05); }.og-theme .expanding-input { color: #1c1e21; }.og-theme .expanding-input::placeholder { color: #8d949e; }.og-theme .send-btn { background: #0084ff; color: white; border-radius: 50%; box-shadow: none; width: 35px; height: 35px; }.og-theme .plus-btn { color: #8d949e; }.og-theme .btn { background: #f0f2f5; color: #1c1e21; border: 1px solid #ccd0d5; box-shadow: none; border-radius: 20px; padding: 0.6em 1em; }.og-theme .btn::before, .og-theme .btn::after { display: none; }.og-theme .btn-letter { color: #1c1e21; animation: none; text-shadow: none; font-weight: normal; font-size: 0.9em;}.og-theme .btn:hover { background: #e4e6eb; border-color: #ccd0d5; }.og-theme .msg-user .bubble { background: #dcf8c6; border: 1px solid #c1e2a4; border-radius: 10px; color: #000; box-shadow: 1px 1px 2px rgba(0,0,0,0.05); }.og-theme .msg-bot .bubble { background: #ffffff; border: 1px solid #ccd0d5; border-radius: 10px; color: #1c1e21; box-shadow: 1px 1px 2px rgba(0,0,0,0.05); }.og-theme .msg-bot::after { display: none; } /* Bot ikonunu gizlət */.og-theme .message { animation: none; opacity: 1; transform: none; }.og-theme .mode-menu { background: #fff; border: 1px solid #ccc; color: #000; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }.og-theme .mode-btn { color: #333; }.og-theme .mode-btn:hover { background: #eee; color: #000; }.og-theme .mode-btn.active { background: #e6f2ff; color: #0084ff; border-left: 3px solid #0084ff; }.og-theme .typing-cursor::after { color: #0084ff; }#limit-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.9); backdrop-filter: blur(20px); z-index: 3000; display: none; align-items: center; justify-content: center; opacity: 0; transition: 0.6s; }.modal-content { background: rgba(20,20,20,0.95); border: 1px solid rgba(255,255,255,0.1); padding: 50px 40px; border-radius: 25px; text-align: center; max-width: 420px; box-shadow: 0 30px 70px rgba(0,0,0,0.8); }@media (max-width: 768px) {.glass-container { width: 100%; height: calc(100vh - 160px); border-radius: 20px; border-left: none; border-right: none; }.og-theme .glass-container { border-radius: 0; border: none; border-top: 1px solid #ddd; }.messages-wrapper { padding: 25px 20px; }.input-zone { width: 96%; bottom: 20px; gap: 10px; }.input-box-container { width: 180px; }64 unmodified lines<div class="input-zone" id="input-zone"><div class="mode-menu" id="mode-menu"><button class="mode-btn active" onclick="setAiMode('ExyposAi')"><i class="fa-solid fa-robot" style="color: #fff;" id="icon-ai"></i> ExyposAi (Standart)</button><button class="mode-btn" onclick="setAiMode('ExyposGReco')"><i class="fa-solid fa-fingerprint" style="color: #b0b0b0;" id="icon-egr"></i> ExyposGReco (EGR)</button><button class="mode-btn" onclick="setAiMode('ExyposOg')"><i class="fa-solid fa-clock-rotate-left" style="color: #b0b0b0;" id="icon-og"></i> ExyposOg (Classic)</button></div><div class="btn-wrapper" onclick="triggerSekilCommand()">22 unmodified lines<div class="modal-content"><h2 style="color: white; margin-bottom: 20px; font-weight: 300; letter-spacing: 1px;"><i class="fa-solid fa-shield-halved" style="color: #fff; margin-right: 10px;"></i> Limit Doldu</h2><p style="color: rgba(255,255,255,0.5); margin-bottom: 30px; line-height: 1.7; font-size: 14px;">Sistemin rahat və sürətli işləməsi üçün 10 mesajdan sonra Google ilə giriş tələb olunur.</p><button class="new-chat-btn" style="width: 100%; margin: 0; padding: 14px; background: #fff; color: #000;" onclick="simulateGoogleLogin()"><img src="https://cdn-icons-png.flaticon.com/512/300/300221.png" style="width:20px; filter: grayscale(100%);"> Google ilə Davam Et</button></div>27 unmodified lines}function toggleModeMenu() { document.getElementById('mode-menu').classList.toggle('active'); }function setAiMode(mode) {currentAiMode = mode;document.querySelectorAll('.mode-btn').forEach(b => b.classList.remove('active'));event.currentTarget.classList.add('active');// İkon rənglərini tənzimləməkdocument.getElementById('icon-ai').style.color = '#b0b0b0';document.getElementById('icon-egr').style.color = '#b0b0b0';document.getElementById('icon-og').style.color = '#b0b0b0';if(mode === 'ExyposAi') document.getElementById('icon-ai').style.color = '#fff';if(mode === 'ExyposGReco') document.getElementById('icon-egr').style.color = '#fff';if(mode === 'ExyposOg') document.getElementById('icon-og').style.color = '#0084ff';toggleModeMenu();if(mode === 'ExyposGReco') inputField.placeholder = "EGR: Link və ya mətn at...";else if(mode === 'ExyposOg') inputField.placeholder = "Köhnə versiyaya yaz...";else inputField.placeholder = "Exypos-a yaz...";// OG Theme (Ağ/Köhnə Dizayn) keçidiif (mode === 'ExyposOg') {document.body.classList.add('og-theme');} else {document.body.classList.remove('og-theme');}}document.addEventListener('click', function(event) {25 unmodified linesif (chats[id].messages.length === 0) {chatBox.innerHTML = `<div style="height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0.3;"><i class="fa-brands fa-connectdevelop" style="font-size: 60px; margin-bottom: 25px;"></i><h2 style="margin-bottom: 12px; font-weight: 300; letter-spacing: 4px;">EXYPOS AI</h2><p style="font-weight: 300; letter-spacing: 1px;">Sənin Kosmik Stansiyan.</p></div>`;} else {16 unmodified linesfunction checkLoginState() {if (isLoggedIn) {document.getElementById('btn-login').innerHTML = `<i class="fa-solid fa-user-check"></i> Tunar (Aktiv)`;document.getElementById('limit-modal').style.display = 'none';}}37 unmodified linesconst loadDiv = document.createElement('div');loadDiv.className = 'message msg-bot';loadDiv.id = loadingId;loadDiv.innerHTML = `<div class="bubble" style="color: gray; font-style: italic;"><i class="fa-solid fa-circle-notch fa-spin" style="margin-right: 8px;"></i> Analiz edilir...</div>`;chatBox.appendChild(loadDiv);chatBox.scrollTop = chatBox.scrollHeight;}9 unmodified linesif (isImageReq) {if(data.type === 'image_url') {const tempImg = new Image();tempImg.src = data.content; // İndi bu birbaşa base64 kodudur, anında yüklənəcək!tempImg.onload = () => {document.getElementById('image-loader-overlay').style.display = 'none';3 unmodified linestempImg.onerror = () => {document.getElementById('image-loader-overlay').style.display = 'none';appendMessageUI('bot', '<span style="color:#ff4444; font-size:14px;">❌ Şəkil serverində xəta oldu. Yenidən cəhd et.</span>', true, true);};} else {document.getElementById('image-loader-overlay').style.display = 'none';29 unmodified linesbubble.className = 'bubble typing-cursor';div.appendChild(bubble); chatBox.appendChild(div);// Əgər OG rejimindəyiksə (Köhnə), daha sürətli, hətta ani yazsın!const speed = currentAiMode === 'ExyposOg' ? 2 : 12;let i = 0;function type() {if (i < fullText.length) {bubble.innerHTML += fullText.charAt(i); i++;67 unmodified lineshistory = data.get("history", [])mode = data.get("mode", "ExyposAi")# ===============================================# 1. YENİ ŞƏKİL YARATMAQ (HUGGING FACE MODELİ İLƏ)# ===============================================if user_msg.lower().startswith(("/sekil", "/şəkil", "/image")):prompt = re.sub(r"^/(sekil|şəkil|image)\s*", "", user_msg, flags=re.IGNORECASE).strip()enhanced_prompt = f"Masterpiece, ultra detailed, highly realistic: {prompt}"if client_hf:try:# Modelə müraciət edir və şəkli birbaşa serverin yaddaşına çəkirikimage = client_hf.text_to_image(enhanced_prompt, model="runwayml/stable-diffusion-v1-5")buffered = io.BytesIO()image.save(buffered, format="PNG")img_str = base64.b64encode(buffered.getvalue()).decode()# Şifrələnmiş şəkli Frontend-ə göndəririk (Bloklanma qeyri-mümkündür!)b64_src = f"data:image/png;base64,{img_str}"return jsonify({"type": "image_url", "content": b64_src})except Exception as e:return jsonify({"type": "text", "content": f"❌ Şəkil yaradılarkən HF model xətası baş verdi. (Server yüklənmiş ola bilər)"})else:return jsonify({"type": "text", "content": "❌ Diqqət! HF_TOKEN tapılmadı, şəkil mühərriki işə düşmədi."})# ===============================================# 2. EGR MƏNTİQİ (Skaner)# ===============================================if mode == "ExyposGReco":if "http" in user_msg:urls = re.findall(r'(https?://[^\s]+)', user_msg)3 unmodified linesreturn jsonify({"type": "image", "content": analysis_result})sys_prompt = "Sən ExyposGReco-san (EGR). Sənin əsas vəzifən sənə göndərilən linklərin doğruluğunu (Fake/Real) analiz etməkdir. İstifadəçiyə bir skaner kimi ciddi və analitik dildə cavab ver. Qısa və konkret ol."# ===============================================# 3. KÖHNƏ VERSİYA (OG) MƏNTİQİ# ===============================================elif mode == "ExyposOg":sys_prompt = "Sən Exypos-un ilk, klassik və ən köhnə versiyasısan. Çox sadə, rəsmi, qısa və robot kimi danışırsan. Çox emosiya və ya emoji istifadə etmirsən. Şəkil çəkmək üçün '/sekil' yazmağı xatırlada bilərsən."# ===============================================# 4. STANDART EXYPOS AI# ===============================================else:sys_prompt = """Sən ExyposAI-san. QAYDALAR:1. Əgər "adın nədir" və ya "kim yaradıb" soruşsalar, DƏQİQ BELƏ DE: 'Mən ExyposAi, IAHAI tərəfindən inkişaf etdirilən süni intellektəm.'2. İstifadəçi hansı dildə yazırsa, O DİLDƏ cavab ver.3. Sən çox ağıllısan, sürətlisən. Şəkil çəkmək üçün istifadəçiyə '/sekil [mətn]' yazmağı xatırlat."""# Groq (Llama) Mühərrikinə Göndərməmsgs = [{"role": "system", "content": sys_prompt}]for m in history[-10:]:role = "user" if m['sender'] == 'user' else "assistant"
app.py+135-110