Update app.py
Browse files11 unmodified lines12131415151617181 unmodified line2021222323242526272827282930313031323332333435363738394041424344453738394049505152414243445455565745464748495051525354555657585960616162636464656667686968697071717273737475777876777880818283848586878889909192939495969798991001011027980818283848586878889909192939410495969798991001011021031071081091041051061071081091101111121131141151161151161171181171181191201211211221231231241251261241251261271281281291301311321331341351301311321331341351365 unmodified lines1421431441471481491501511521451461541551471481491501581591601611621631511521531541551561681691571581591601611621711721631641651661671681691701711721731741751761761771781791791801811821831841821851861871851861871881891901911921931941911921951961971941981992002013 unmodified lines2052062072042082092102072082092102112122132112122132142152162172172182192202212232242252262272282292302312322332222232242252262272282292302312322332342352362372382392402412422352432442452462472482492502512522532542422552562572582462592602612622632642522652662679 unmodified lines2772782792682802812822834 unmodified lines28828929027929129228129329429528429629729829930030129030230330429330530630730832 unmodified lines3413423433323443453463473 unmodified lines35135235334235435535635725 unmodified lines3833843853743863873883896 unmodified lines39639739838739940040140211 unmodified linesclient_groq = Groq(api_key=GROQ_API_KEY) if GROQ_API_KEY else None
# ==========================================# FRONTEND: Cinematic Glass + Smart AI Blocks# FRONTEND: Ultimate Resizable UI & Animations# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>1 unmodified line<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Twenty IDE | Ultimate Exypos Ecosystem</title> <title>Twenty IDE | Pro Environment</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <style> :root { --bg-dark: #030305; --color-white: #ffffff; --bg-dark: #050508; --bg-panel: #111116; --bg-terminal: #011627; --border-glass: rgba(255, 255, 255, 0.1); --text-main: #f4f4f5; --text-muted: #888888; --border-glass: rgba(255, 255, 255, 0.08); --bg-glass: rgba(15, 15, 18, 0.55); --bg-terminal: #011627; /* Tünd Göy/Qara PowerShell */ --text-muted: #888899; --accent: #00f2fe; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; } body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; perspective: 1000px; }
/* --- ARXA PLAN AMBİENT --- */ .ambient-bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; background: #030305; } .orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.25; will-change: transform; } .orb-1 { width: 600px; height: 600px; background: rgba(255, 255, 255, 0.15); top: -10%; left: -10%; animation: float1 25s infinite alternate ease-in-out; } .orb-2 { width: 500px; height: 500px; background: rgba(100, 150, 255, 0.1); bottom: -10%; right: -10%; animation: float2 30s infinite alternate-reverse ease-in-out; } @keyframes float1 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(20vw, 30vh) scale(1.1); } } @keyframes float2 { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-20vw, -20vh) scale(1.2); } } body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
/* --- SPLASH EKRANI --- */ #splash { position: fixed; inset: 0; background: rgba(3, 3, 5, 0.95); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 1.5s ease-in-out, visibility 1.5s; position: fixed; inset: 0; background: rgba(5, 5, 8, 0.98); backdrop-filter: blur(40px); z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center; transition: opacity 1s ease-in-out, visibility 1s; } .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 2.5s 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; filter: blur(10px); transform: translateY(20px); animation: subReveal 2s ease-out forwards 1.5s; 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); } } .splash-text { font-size: 55px; font-weight: 200; letter-spacing: 25px; color: var(--color-white); text-shadow: 0 0 40px rgba(255,255,255,0.3); } .splash-sub { font-size: 14px; color: var(--text-muted); letter-spacing: 12px; margin-top: 20px; text-transform: uppercase; }
/* --- ANİMASİYALAR --- */ .anim-top { animation: slideDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; transform: translateY(-100%); opacity: 0; } .anim-left { animation: slideRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.3s; transform: translateX(-100%); opacity: 0; } .anim-center { animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.5s; transform: translateY(50px); opacity: 0; } .anim-right { animation: slideLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.7s; transform: translateX(100%); opacity: 0; }
@keyframes slideDown { to { transform: translateY(0); opacity: 1; } } @keyframes slideRight { to { transform: translateX(0); opacity: 1; } } @keyframes fadeUp { to { transform: translateY(0); opacity: 1; } } @keyframes slideLeft { to { transform: translateX(0); opacity: 1; } }
/* --- ÜST PANEL --- */ .top-bar { height: 55px; background: rgba(10, 10, 12, 0.7); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-glass); height: 60px; background: var(--bg-panel); border-bottom: 1px solid var(--border-glass); display: flex; justify-content: space-between; align-items: center; padding: 0 20px; z-index: 100; } .brand { font-size: 18px; font-weight: 300; letter-spacing: 3px; display: flex; align-items: center; gap: 15px; } .brand { font-size: 18px; font-weight: 300; letter-spacing: 4px; display: flex; align-items: center; gap: 15px; } .controls { display: flex; align-items: center; gap: 15px; } .run-btn { background: rgba(255,255,255,0.1); color: var(--color-white); border: 1px solid rgba(255,255,255,0.2); padding: 8px 20px; border-radius: 6px; cursor: pointer; font-weight: 400; transition: 0.4s; display: flex; align-items: center; gap: 8px; background: var(--text-main); color: #000; border: none; padding: 8px 25px; border-radius: 4px; cursor: pointer; font-weight: 600; transition: 0.3s; display: flex; align-items: center; gap: 8px; } .run-btn:hover { background: var(--color-white); color: black; box-shadow: 0 0 15px rgba(255,255,255,0.3); transform: translateY(-2px); } .run-btn:hover { background: #fff; transform: scale(1.05); box-shadow: 0 0 15px rgba(255,255,255,0.2); } .lang-select { background: transparent; color: var(--text-muted); border: 1px solid var(--border-glass); padding: 5px; border-radius: 4px; cursor: pointer; outline: none; } .panel-toggle { background: transparent; color: var(--text-muted); border: none; cursor: pointer; font-size: 20px; transition: 0.3s; } .panel-toggle:hover { color: white; transform: scale(1.1); }
/* --- ƏSAS İŞ ZONASI VƏ GİRİŞ ANİMASİYALARI --- */ .main-layout { display: flex; flex: 1; overflow: hidden; padding: 10px; gap: 10px; } /* --- ƏSAS İŞ ZONASI --- */ .main-layout { display: flex; flex: 1; overflow: hidden; } .panel-glass { background: var(--bg-glass); backdrop-filter: blur(20px); border: 1px solid var(--border-glass); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; opacity: 0; box-shadow: 0 15px 35px rgba(0,0,0,0.5); }
.enter-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s; } .enter-center { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s; } .enter-right { animation: slideInRight 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.6s; }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-50px); } to { opacity: 1; transform: translateX(0); } } @keyframes fadeInUp { from { opacity: 0; transform: translateY(50px); } to { opacity: 1; transform: translateY(0); } } @keyframes slideInRight { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
/* Sol Panel */ .sidebar-left { width: 250px; transition: width 0.4s; } .sidebar-left.collapsed { width: 0; border: none; padding: 0; margin: 0; opacity: 0; } .panel-title { padding: 12px 15px; font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.2); } .file-list { padding: 10px; flex: 1; overflow-y: auto; } .file-item { padding: 10px; font-size: 13px; cursor: pointer; border-radius: 6px; display: flex; align-items: center; gap: 10px; color: var(--text-muted); transition: 0.3s; margin-bottom: 5px; } .file-item:hover { background: rgba(255,255,255,0.05); color: white; } .file-item.active { background: rgba(255,255,255,0.1); color: white; border-left: 2px solid white; }
/* Orta Panel */ .panel { background: var(--bg-panel); border-right: 1px solid var(--border-glass); display: flex; flex-direction: column; } .panel-title { padding: 12px 20px; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.3); }
/* Sol Panel (Zəngin Fayl Sistemi) */ .sidebar-left { width: 260px; transition: width 0.4s; } .sidebar-left.collapsed { width: 0; border: none; overflow: hidden; opacity: 0; } .file-list { padding: 15px; flex: 1; overflow-y: auto; font-size: 14px; } .folder { margin-bottom: 10px; } .folder-name { color: var(--text-main); display: flex; align-items: center; gap: 8px; margin-bottom: 5px; cursor: pointer; font-weight: 500; } .folder-items { margin-left: 20px; display: flex; flex-direction: column; gap: 5px; border-left: 1px solid rgba(255,255,255,0.1); padding-left: 10px; } .file-item { display: flex; align-items: center; gap: 8px; color: var(--text-muted); cursor: pointer; padding: 5px; border-radius: 4px; transition: 0.2s; } .file-item:hover { color: white; background: rgba(255,255,255,0.05); } .file-item.active { color: white; background: rgba(255,255,255,0.1); }
/* Orta Panel (Editor + Resizer + Terminal) */ .center-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; } #editor-container { flex: 7; } #editor-container { flex: 1; min-height: 100px; background: #1e1e1e; } /* DRAG RESİZER (Sürüşdürücü Xətt) */ .resizer { height: 6px; background: #2a2a35; cursor: ns-resize; display: flex; justify-content: center; align-items: center; border-top: 1px solid #000; border-bottom: 1px solid #000; transition: 0.2s; } .resizer:hover, .resizer:active { background: #00f2fe; } .resizer::after { content: "•••"; color: #888; font-size: 10px; letter-spacing: 2px; }
/* Terminal */ .terminal-wrapper { flex: 3; background: var(--bg-terminal); border-top: 1px solid rgba(255,255,255,0.1); display: flex; flex-direction: column; } .terminal-header { background: rgba(0,0,0,0.4); padding: 8px 15px; font-size: 12px; color: #aaa; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); } #terminal-output { flex: 1; padding: 15px; font-family: 'Consolas', monospace; font-size: 14px; color: #cccccc; overflow-y: auto; white-space: pre-wrap; line-height: 1.5; } .terminal-wrapper { height: 250px; min-height: 100px; background: var(--bg-terminal); display: flex; flex-direction: column; } .terminal-header { background: rgba(0,0,0,0.5); padding: 8px 15px; font-size: 12px; color: #aaa; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); } #terminal-output { flex: 1; padding: 20px; font-family: 'Consolas', monospace; font-size: 16px; /* Şrift böyüdü */ color: #e0e0e0; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; text-align: left; /* Tam sola yaslandı */ display: block; } .ps-prompt { color: #82aaff; font-weight: bold; } .ps-success { color: #c3e88d; } .ps-error { color: #ff5370; }
/* Sağ Panel (AI) */ .sidebar-right { width: 320px; transition: width 0.4s; } .sidebar-right.collapsed { width: 0; border: none; padding: 0; margin: 0; opacity: 0; } .ai-chat-box { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; scroll-behavior: smooth; } .sidebar-right { width: 340px; border-left: 1px solid var(--border-glass); border-right: none; transition: width 0.4s; } .sidebar-right.collapsed { width: 0; border: none; overflow: hidden; opacity: 0; } .ai-chat-box { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; } .ai-msg { font-size: 14px; line-height: 1.6; color: #d6d6d6; } .ai-msg.user { align-self: flex-end; background: rgba(255,255,255,0.1); padding: 10px 15px; border-radius: 12px 12px 0 12px; border-right: 2px solid white; color: white; } .ai-msg.bot { align-self: flex-start; width: 100%; background: transparent; } .ai-msg.bot { align-self: flex-start; width: 100%; }
/* AĞILLI KOD QUTUSU */ .code-wrapper { margin: 10px 0; background: #0d0d12; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.3); } .code-header { background: rgba(255,255,255,0.05); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #aaa; border-bottom: 1px solid rgba(255,255,255,0.05); } .insert-btn { background: rgba(255,255,255,0.1); color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; transition: 0.3s; font-size: 11px; display: flex; gap: 5px; align-items: center; } .code-wrapper { margin: 10px 0; background: #0a0a0f; border: 1px solid rgba(255,255,255,0.15); border-radius: 8px; overflow: hidden; } .code-header { background: rgba(255,255,255,0.05); padding: 8px 12px; display: flex; justify-content: space-between; font-size: 12px; color: #aaa; } .insert-btn { background: rgba(255,255,255,0.1); color: white; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; transition: 0.3s; font-size: 11px; } .insert-btn:hover { background: white; color: black; } .code-wrapper pre { padding: 12px; margin: 0; overflow-x: auto; font-family: 'Consolas', monospace; font-size: 13px; color: #c3e88d; } .code-wrapper pre { padding: 12px; overflow-x: auto; font-family: 'Consolas', monospace; font-size: 13.5px; color: #c3e88d; text-align: left; margin: 0; }
/* AI Input */ .ai-input-area { padding: 15px; border-top: 1px solid var(--border-glass); display: flex; gap: 10px; background: rgba(0,0,0,0.2); } .ai-input-area input { flex: 1; background: rgba(0,0,0,0.4); border: 1px solid var(--border-glass); color: white; padding: 10px 15px; border-radius: 20px; outline: none; transition: 0.3s; font-size: 13px; } .ai-input-area input:focus { border-color: rgba(255,255,255,0.3); } .ai-input-area button { background: white; color: black; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; transition: 0.3s; display: flex; justify-content: center; align-items: center; font-size: 14px; } .ai-input-area button:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(255,255,255,0.2); } .ai-input-area { padding: 15px; background: rgba(0,0,0,0.3); display: flex; gap: 10px; } .ai-input-area input { flex: 1; background: rgba(0,0,0,0.5); border: 1px solid var(--border-glass); color: white; padding: 10px; border-radius: 8px; outline: none; } .ai-input-area button { background: white; color: black; border: none; width: 40px; border-radius: 8px; cursor: pointer; transition: 0.3s; } .ai-input-area button:hover { transform: scale(1.05); }
</style> <script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs/loader.min.js"></script>5 unmodified lines <div class="splash-sub">Dev Environment</div> </div>
<div class="ambient-bg"> <div class="orb orb-1"></div> <div class="orb orb-2"></div> </div>
<div class="top-bar"> <div class="top-bar anim-top" id="top-bar"> <div class="brand"> <button class="panel-toggle" onclick="togglePanel('left')" title="Fayllar"><i class="fa-solid fa-folder-tree"></i></button> <span>TWENTY <span style="color: var(--text-muted); font-size: 12px;">IDE</span></span> <button class="panel-toggle" onclick="togglePanel('left')"><i class="fa-solid fa-bars-staggered"></i></button> <span>TWENTY</span> </div> <div class="controls"> <button class="run-btn" onclick="runCode()" id="btn-run"><i class="fa-solid fa-play"></i> <span id="t-run">İcra Et</span></button> <select class="lang-select" id="lang-select" onchange="changeLanguage()"> <option value="az">AZ</option> <option value="en">EN</option> </select> <button class="panel-toggle" onclick="togglePanel('right')" title="Exypos AI"><i class="fa-solid fa-robot"></i></button> <button class="run-btn" onclick="runCode()" id="btn-run"><i class="fa-solid fa-play"></i> İcra Et</button> <button class="panel-toggle" onclick="togglePanel('right')"><i class="fa-solid fa-robot"></i></button> </div> </div>
<div class="main-layout"> <div class="panel-glass sidebar-left" id="sidebar-left"> <div class="panel-title" id="t-explorer">LAYİHƏ</div> <div class="panel sidebar-left anim-left" id="sidebar-left"> <div class="panel-title">LAYİHƏ STRUKTURU</div> <div class="file-list"> <div class="folder"> <div class="folder-name"><i class="fa-solid fa-folder-open" style="color:#eac54f;"></i> src</div> <div class="folder-items"> <div class="file-item active"><i class="fa-brands fa-python" style="color: #ffeb3b;"></i> main.py</div> <div class="file-item"><i class="fa-solid fa-database" style="color: #4caf50;"></i> database.db</div> <div class="file-item active"><i class="fa-brands fa-python" style="color: #ffeb3b;"></i> main.py</div> <div class="file-item"><i class="fa-brands fa-python" style="color: #ffeb3b;"></i> ai_model.py</div> </div> </div> <div class="folder"> <div class="folder-name"><i class="fa-solid fa-folder" style="color:#eac54f;"></i> database</div> <div class="folder-items"> <div class="file-item"><i class="fa-solid fa-database" style="color: #4caf50;"></i> users.db</div> </div> </div> <div class="file-item" style="margin-top:10px;"><i class="fa-solid fa-gear" style="color: #aaa;"></i> config.json</div> </div> </div>
<div class="panel-glass center-panel" id="center-panel"> <div class="center-panel anim-center" id="center-panel"> <div id="editor-container"></div> <div class="terminal-wrapper"> <div class="resizer" id="resizer"></div> <div class="terminal-wrapper" id="terminal-wrapper"> <div class="terminal-header"> <span><i class="fa-solid fa-terminal"></i> PowerShell Terminal</span> <i class="fa-solid fa-trash" style="cursor:pointer; color: #888;" onclick="clearTerminal()" title="Təmizlə"></i> <i class="fa-solid fa-broom" style="cursor:pointer;" onclick="clearTerminal()" title="Təmizlə"></i> </div> <div id="terminal-output"> <span style="color: #aaa;">Twenty PowerShell Engine Initialized...</span><br> <span class="ps-prompt">PS C:\\Twenty></span> Hazırdır. </div><span style="color: #aaa;">Twenty Engine (Bulud Rejimi) Başladıldı...</span><span style="color: #ffaa00;">DIQQƏT: Bulud serverlərində input() komandası işləmir. Dəyişənləri birbaşa koda yazın.</span>
<span class="ps-prompt">PS C:\\Twenty\\src></span> Gözləyir...</div> </div> </div>
<div class="panel-glass sidebar-right" id="sidebar-right"> <div class="panel-title">EXYPOS COPILOT</div> <div class="panel sidebar-right anim-right" id="sidebar-right"> <div class="panel-title">EXYPOS AI COPILOT</div> <div class="ai-chat-box" id="ai-chat-box"> <div class="ai-msg bot">Salam! Mən Exypos-am. Koda dair nə kömək edə bilərəm? "Mənə sadə oyun kodu yaz" deyərək başlaya bilərsən.</div> <div class="ai-msg bot">Salam! Sənin AI köməkçinim. <b>input()</b> istifadə etmədən hesablama kodu istəyirsənsə, soruş!</div> </div> <div class="ai-input-area"> <input type="text" id="ai-input" placeholder="Exypos-a yaz..." onkeypress="if(event.key === 'Enter') sendToAI()">3 unmodified lines </div>
<script> // --- GİRİŞ ANİMASİYALARI --- // Splash Ekranını Dəqiq Gizlətmə window.onload = () => { setTimeout(() => { document.getElementById('splash').style.opacity = '0'; setTimeout(() => { document.getElementById('splash').style.display = 'none'; document.getElementById('sidebar-left').classList.add('enter-left'); document.getElementById('center-panel').classList.add('enter-center'); document.getElementById('sidebar-right').classList.add('enter-right'); }, 1500); const splash = document.getElementById('splash'); splash.style.opacity = '0'; setTimeout(() => splash.remove(), 1000); // Ekrandan tamamilə silinir }, 2500); };
// --- PANELLƏRİ AÇIB-BAĞLAMAQ --- function togglePanel(side) { document.getElementById(`sidebar-${side}`).classList.toggle('collapsed'); if(editor) setTimeout(() => editor.layout(), 400); }
// --- DİL DƏYİŞDİRMƏ --- function changeLanguage() { const lang = document.getElementById('lang-select').value; if(lang === 'az') { document.getElementById('t-run').innerText = 'İcra Et'; document.getElementById('t-explorer').innerText = 'LAYİHƏ'; document.getElementById('ai-input').placeholder = 'Exypos-a yaz...'; } else { document.getElementById('t-run').innerText = 'Run Code'; document.getElementById('t-explorer').innerText = 'PROJECT'; document.getElementById('ai-input').placeholder = 'Ask Exypos...'; // --- SÜRÜŞDÜRÜCÜ (RESIZER) MƏNTİQİ --- const resizer = document.getElementById('resizer'); const terminalWrapper = document.getElementById('terminal-wrapper'); let isResizing = false;
resizer.addEventListener('mousedown', (e) => { isResizing = true; document.body.style.cursor = 'ns-resize'; });
document.addEventListener('mousemove', (e) => { if (!isResizing) return; // Ekranda mausun Y oxu üzrə mövqeyini hesablayırıq const containerHeight = document.getElementById('center-panel').clientHeight; const newTerminalHeight = containerHeight - e.clientY + 60; // 60 top bar offset if (newTerminalHeight > 100 && newTerminalHeight < containerHeight - 100) { terminalWrapper.style.height = `${newTerminalHeight}px`; terminalWrapper.style.flex = 'none'; // Flex-i qırırıq ki, absolute height işləsin if(editor) editor.layout(); } } });
document.addEventListener('mouseup', () => { isResizing = false; document.body.style.cursor = 'default'; });
// --- MONACO EDITOR --- let editor; require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs' }}); require(['vs/editor/editor.main'], function() { editor = monaco.editor.create(document.getElementById('editor-container'), { value: "# Twenty IDE x Exypos\\n# Kodu Exypos-dan birbaşa bura at!\\n\\nprint('Mühəndis Səbri hər şeyi həll edər!')", value: "# Twenty IDE\\n# input() evezine deyisenleri bele yaz:\\n\\neded1 = 150\\neded2 = 300\\n\\nprint(f'Neticeniz: {eded1 + eded2}')", language: 'python', theme: 'vs-dark', automaticLayout: true, fontSize: 15, fontSize: 16, minimap: { enabled: false }, padding: { top: 15 } }); });
// --- KODU EDİTORA ATMAQ FUNKSİYASI --- window.insertCode = function(encodedCode) { const code = decodeURIComponent(encodedCode); const position = editor.getPosition();9 unmodified lines const code = editor.getValue(); const terminal = document.getElementById('terminal-output'); terminal.innerHTML += `<br><br><span class="ps-prompt">PS C:\\Twenty></span> python main.py<br><span style="color: #888;">İcra olunur...</span>`; terminal.innerHTML += `\\n\\n<span class="ps-prompt">PS C:\\\\Twenty\\\\src></span> python main.py\\n<span style="color: #888;">İcra olunur...</span>`; terminal.scrollTop = terminal.scrollHeight; try {4 unmodified lines }); const data = await response.json(); if (data.status === 'success') { terminal.innerHTML += `<br><span class="ps-success">${data.output}</span>`; terminal.innerHTML += `\\n<span class="ps-success">${data.output}</span>`; } else { terminal.innerHTML += `<br><span class="ps-error">${data.output}</span>`; terminal.innerHTML += `\\n<span class="ps-error">${data.output}</span>`; } } catch (error) { terminal.innerHTML += `<br><span class="ps-error">Server xətası!</span>`; terminal.innerHTML += `\\n<span class="ps-error">Server xətası!</span>`; } terminal.scrollTop = terminal.scrollHeight; }
function clearTerminal() { document.getElementById('terminal-output').innerHTML = `<span class="ps-prompt">PS C:\\Twenty></span> Terminal təmizləndi...`; document.getElementById('terminal-output').innerHTML = `<span class="ps-prompt">PS C:\\\\Twenty\\\\src></span> Terminal təmizləndi...`; }
// --- EXYPOS AI SİSTEMİ (AĞILLI FORMATLAMA) --- // --- EXYPOS AI SİSTEMİ --- async function sendToAI() { const input = document.getElementById('ai-input'); const text = input.value.trim();32 unmodified lines <div class="code-wrapper"> <div class="code-header"> <span><i class="fa-brands fa-python" style="color:#ffeb3b;"></i> Python</span> <button class="insert-btn" onclick="insertCode('${encodedCode}')"><i class="fa-solid fa-code-pull-request"></i> Editora At</button> <button class="insert-btn" onclick="insertCode('${encodedCode}')"><i class="fa-solid fa-code-pull-request"></i> At</button> </div> <pre>${safeDisplayCode}</pre> </div>3 unmodified lines chatBox.innerHTML += `<div class="ai-msg bot">${formattedHtml}</div>`; } catch (err) { document.getElementById(loadId).innerHTML = "<span class='ps-error'>Bağlantı xətası. API Key-i yoxlayın.</span>"; document.getElementById(loadId).innerHTML = "<span class='ps-error'>Bağlantı xətası.</span>"; } chatBox.scrollTop = chatBox.scrollHeight; }25 unmodified lines else: return jsonify({"status": "error", "output": result.stderr if result.stderr else result.stdout}) except subprocess.TimeoutExpired: return jsonify({"status": "error", "output": "Vaxt bitdi (10 saniyə limit). Sonsuz dövr ola bilər."}) return jsonify({"status": "error", "output": "Vaxt bitdi (10 saniyə limit). Sonsuz dövr ola bilər və ya kod input() gözləyir."}) except Exception as e: return jsonify({"status": "error", "output": str(e)}) finally:6 unmodified lines return jsonify({"response": "XƏTA: Groq API Key yoxdur. Lütfən Hugging Face Secrets-də 'GROQ_API_KEY' əlavə edin."}) user_msg = request.json.get("message", "") sys_prompt = "Sən Twenty IDE-nin içindəki Exypos Copilot-san. Proqramçılara kömək edirsən. Kodları həmişə ```python və ``` arasına al. İzahı qısa ver." sys_prompt = "Sən Twenty IDE-nin içindəki Exypos Copilot-san. Qısa cavab ver. Kodları həmişə ```python və ``` arasına al. İstifadəçiyə heç vaxt input() istifadə edən kod vermə, çünki bulud serverində işləmir. Dəyişənləri birbaşa koda yaz." try: completion = client_groq.chat.completions.create(app.py+149-137