Spaces:
Running
Running
Vedika commited on
Update index.html
Browse files- index.html +48 -191
index.html
CHANGED
|
@@ -53,7 +53,7 @@
|
|
| 53 |
--bg-primary: #000000;
|
| 54 |
--bg-secondary: #1c1c1e;
|
| 55 |
--bg-tertiary: #2c2c2e;
|
| 56 |
-
--bg-glass: rgba(28, 28, 30, 0.65);
|
| 57 |
|
| 58 |
/* Text & Typography Colors */
|
| 59 |
--text-primary: #ffffff;
|
|
@@ -334,7 +334,9 @@
|
|
| 334 |
|
| 335 |
.chat-bubble { padding: 18px 24px; font-size: 16px; line-height: 1.6; position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
|
| 336 |
.user-msg .chat-bubble { background: var(--bg-tertiary); color: var(--text-primary); border-radius: 24px 24px 6px 24px; box-shadow: var(--shadow-md); border: 1px solid var(--border-light); }
|
| 337 |
-
.bot-msg .chat-bubble { background: rgba(28, 28, 30, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--text-primary); border: 1px solid var(--border-medium); border-radius: 6px 24px 24px 24px; box-shadow: var(--shadow-md); width: 100%; }
|
|
|
|
|
|
|
| 338 |
|
| 339 |
/* Bot Action Buttons */
|
| 340 |
.bot-actions-row { display: flex; gap: 10px; margin-top: 8px; padding-left: 14px; opacity: 0; transition: opacity var(--ease-smooth); flex-wrap: wrap; }
|
|
@@ -410,15 +412,6 @@
|
|
| 410 |
.dropdown-item:hover svg { color: var(--brand-saffron); }
|
| 411 |
.stealth-input { display: none; }
|
| 412 |
|
| 413 |
-
/* Smart Language Toggle & Mic */
|
| 414 |
-
.language-toggle-chip { font-size: 13px; font-weight: 800; color: var(--text-secondary); border: 1px solid var(--border-light); background: rgba(0,0,0,0.3); border-radius: 10px; padding: 6px 12px; cursor: pointer; transition: var(--ease-smooth); display: flex; align-items: center; gap: 6px; user-select: none; }
|
| 415 |
-
.language-toggle-chip:hover { background: rgba(255, 255, 255, 0.1); color: var(--text-primary); border-color: rgba(255,255,255,0.3); }
|
| 416 |
-
.language-toggle-chip.hindi-active { background: rgba(19, 136, 8, 0.2); color: #32d74b; border-color: rgba(50, 215, 75, 0.5); }
|
| 417 |
-
.language-toggle-chip svg { width: 16px; height: 16px; }
|
| 418 |
-
|
| 419 |
-
.btn-mic-tool.active-listening { color: #ffffff; background: var(--text-error); animation: recordPulse 1.5s infinite; border-radius: var(--radius-full); }
|
| 420 |
-
@keyframes recordPulse { 0% { box-shadow: 0 0 0 0 rgba(255,69,58,0.5); } 70% { box-shadow: 0 0 0 12px rgba(255,69,58,0); } 100% { box-shadow: 0 0 0 0 rgba(255,69,58,0); } }
|
| 421 |
-
|
| 422 |
/* Master Send Button */
|
| 423 |
.btn-master-send { width: 48px; height: 48px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.2); background: linear-gradient(135deg, var(--brand-saffron) 0%, var(--brand-saffron-dark) 100%); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--ease-spring); box-shadow: 0 4px 15px rgba(255, 153, 51, 0.3); }
|
| 424 |
.btn-master-send svg { width: 20px; height: 20px; fill: white; transition: transform 0.2s; }
|
|
@@ -604,7 +597,7 @@
|
|
| 604 |
<div class="developer-credit-box">
|
| 605 |
<img src="https://i.ibb.co/MxKsrXDj/TIRANGA-20260525-172109-0000.png" alt="CODE VED Core Image">
|
| 606 |
<h3 class="dev-box-title">CODE VED Core</h3>
|
| 607 |
-
<p class="dev-box-subtitle">ENGINEERED BY
|
| 608 |
</div>
|
| 609 |
|
| 610 |
<!-- Wipe Memory Button -->
|
|
@@ -702,14 +695,6 @@
|
|
| 702 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
|
| 703 |
High-Res Image
|
| 704 |
</div>
|
| 705 |
-
<div class="dropdown-item" id="opt-video">
|
| 706 |
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg>
|
| 707 |
-
Video Media
|
| 708 |
-
</div>
|
| 709 |
-
<div class="dropdown-item" id="opt-audio">
|
| 710 |
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg>
|
| 711 |
-
Audio Track
|
| 712 |
-
</div>
|
| 713 |
<div class="dropdown-item" id="opt-document">
|
| 714 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
|
| 715 |
Document / Code
|
|
@@ -718,22 +703,9 @@
|
|
| 718 |
|
| 719 |
<!-- Hidden File Inputs -->
|
| 720 |
<input type="file" id="sys-inp-image" class="stealth-input" accept="image/*">
|
| 721 |
-
<input type="file" id="sys-inp-video" class="stealth-input" accept="video/*">
|
| 722 |
-
<input type="file" id="sys-inp-audio" class="stealth-input" accept="audio/*">
|
| 723 |
<input type="file" id="sys-inp-document" class="stealth-input" accept=".pdf,.doc,.docx,.txt,.md,.csv,.json,.py,.js,.html,.css,.cpp,.c,.java">
|
| 724 |
</div>
|
| 725 |
|
| 726 |
-
<!-- Smart Language Toggle Button -->
|
| 727 |
-
<button class="language-toggle-chip" id="smartLangToggle" title="Toggle Voice Engine Language">
|
| 728 |
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>
|
| 729 |
-
<span id="langDisplayBadge">EN</span>
|
| 730 |
-
</button>
|
| 731 |
-
|
| 732 |
-
<!-- Voice Dictation Button -->
|
| 733 |
-
<button class="btn-tool-icon btn-mic-tool" id="masterVoiceBtn" title="Voice Dictation">
|
| 734 |
-
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" x2="12" y1="19" y2="22"></line></svg>
|
| 735 |
-
</button>
|
| 736 |
-
|
| 737 |
<!-- Expanding Text Area -->
|
| 738 |
<textarea class="main-textarea" id="mainChatInput" placeholder="Message CODE VED..." rows="1"></textarea>
|
| 739 |
|
|
@@ -743,7 +715,7 @@
|
|
| 743 |
</button>
|
| 744 |
</div>
|
| 745 |
</div>
|
| 746 |
-
<div class="bottom-branding-text">Secured by CODE VED Architecture • Developed by
|
| 747 |
</div>
|
| 748 |
</main>
|
| 749 |
|
|
@@ -852,8 +824,7 @@
|
|
| 852 |
isUserScrolling: false,
|
| 853 |
generatedCodeBlocks: [],
|
| 854 |
currentWorkspaceId: null,
|
| 855 |
-
isStreamingActive: false
|
| 856 |
-
isMicRecording: false
|
| 857 |
};
|
| 858 |
|
| 859 |
// =======================================================================================
|
|
@@ -979,9 +950,9 @@
|
|
| 979 |
triggerBtn.innerText = 'Establishing Connection...';
|
| 980 |
|
| 981 |
try {
|
| 982 |
-
// Using default fetch behavior to allow GAS redirects
|
| 983 |
const response = await fetch(Config.GAS_URL, {
|
| 984 |
method: 'POST',
|
|
|
|
| 985 |
headers: { 'Content-Type': 'text/plain;charset=utf-8' },
|
| 986 |
body: JSON.stringify(payload)
|
| 987 |
});
|
|
@@ -1057,111 +1028,7 @@
|
|
| 1057 |
};
|
| 1058 |
|
| 1059 |
// =======================================================================================
|
| 1060 |
-
// 5.
|
| 1061 |
-
// =======================================================================================
|
| 1062 |
-
const VoiceEngine = {
|
| 1063 |
-
recognition: null,
|
| 1064 |
-
currentLanguage: 'en-US',
|
| 1065 |
-
sessionTranscript: '',
|
| 1066 |
-
|
| 1067 |
-
init: () => {
|
| 1068 |
-
const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
|
| 1069 |
-
if (!SR) return;
|
| 1070 |
-
|
| 1071 |
-
VoiceEngine.recognition = new SR();
|
| 1072 |
-
VoiceEngine.recognition.continuous = false;
|
| 1073 |
-
VoiceEngine.recognition.interimResults = true;
|
| 1074 |
-
VoiceEngine.recognition.lang = VoiceEngine.currentLanguage;
|
| 1075 |
-
|
| 1076 |
-
VoiceEngine.recognition.onstart = () => {
|
| 1077 |
-
AppState.isMicRecording = true;
|
| 1078 |
-
VoiceEngine.sessionTranscript = document.getElementById('mainChatInput').value;
|
| 1079 |
-
if(VoiceEngine.sessionTranscript && !VoiceEngine.sessionTranscript.endsWith(' ')) {
|
| 1080 |
-
VoiceEngine.sessionTranscript += ' ';
|
| 1081 |
-
}
|
| 1082 |
-
document.getElementById('masterVoiceBtn').classList.add('active-listening');
|
| 1083 |
-
};
|
| 1084 |
-
|
| 1085 |
-
VoiceEngine.recognition.onresult = (event) => {
|
| 1086 |
-
let interimTranscript = '';
|
| 1087 |
-
let finalTranscript = '';
|
| 1088 |
-
|
| 1089 |
-
for (let i = event.resultIndex; i < event.results.length; ++i) {
|
| 1090 |
-
if (event.results[i].isFinal) {
|
| 1091 |
-
finalTranscript += event.results[i][0].transcript;
|
| 1092 |
-
} else {
|
| 1093 |
-
interimTranscript += event.results[i][0].transcript;
|
| 1094 |
-
}
|
| 1095 |
-
}
|
| 1096 |
-
|
| 1097 |
-
let currentDictation = finalTranscript + interimTranscript;
|
| 1098 |
-
if (currentDictation) {
|
| 1099 |
-
currentDictation = currentDictation.charAt(0).toUpperCase() + currentDictation.slice(1);
|
| 1100 |
-
}
|
| 1101 |
-
|
| 1102 |
-
const inputField = document.getElementById('mainChatInput');
|
| 1103 |
-
inputField.value = VoiceEngine.sessionTranscript + currentDictation;
|
| 1104 |
-
UIManager.autoGrowTextArea(inputField);
|
| 1105 |
-
|
| 1106 |
-
if(finalTranscript.trim().length > 0) {
|
| 1107 |
-
VoiceEngine.sessionTranscript = inputField.value;
|
| 1108 |
-
if(!VoiceEngine.sessionTranscript.endsWith(' ')) VoiceEngine.sessionTranscript += ' ';
|
| 1109 |
-
}
|
| 1110 |
-
};
|
| 1111 |
-
|
| 1112 |
-
VoiceEngine.recognition.onend = () => {
|
| 1113 |
-
AppState.isMicRecording = false;
|
| 1114 |
-
document.getElementById('masterVoiceBtn').classList.remove('active-listening');
|
| 1115 |
-
};
|
| 1116 |
-
|
| 1117 |
-
VoiceEngine.recognition.onerror = (event) => {
|
| 1118 |
-
AppState.isMicRecording = false;
|
| 1119 |
-
if(event.error !== 'no-speech') {
|
| 1120 |
-
Utils.showToast("Voice module error: " + event.error);
|
| 1121 |
-
}
|
| 1122 |
-
document.getElementById('masterVoiceBtn').classList.remove('active-listening');
|
| 1123 |
-
};
|
| 1124 |
-
},
|
| 1125 |
-
|
| 1126 |
-
switchLanguage: () => {
|
| 1127 |
-
const btn = document.getElementById('smartLangToggle');
|
| 1128 |
-
const badge = document.getElementById('langDisplayBadge');
|
| 1129 |
-
|
| 1130 |
-
if (VoiceEngine.currentLanguage === 'en-US') {
|
| 1131 |
-
VoiceEngine.currentLanguage = 'hi-IN';
|
| 1132 |
-
badge.innerText = 'हि';
|
| 1133 |
-
btn.classList.add('hindi-active');
|
| 1134 |
-
Utils.showToast("Listening Protocol: Hindi (देवनागरी)");
|
| 1135 |
-
} else {
|
| 1136 |
-
VoiceEngine.currentLanguage = 'en-US';
|
| 1137 |
-
badge.innerText = 'EN';
|
| 1138 |
-
btn.classList.remove('hindi-active');
|
| 1139 |
-
Utils.showToast("Listening Protocol: English");
|
| 1140 |
-
}
|
| 1141 |
-
|
| 1142 |
-
if (VoiceEngine.recognition) {
|
| 1143 |
-
VoiceEngine.recognition.lang = VoiceEngine.currentLanguage;
|
| 1144 |
-
if(AppState.isMicRecording) {
|
| 1145 |
-
VoiceEngine.recognition.stop();
|
| 1146 |
-
setTimeout(() => { VoiceEngine.recognition.start(); }, 400);
|
| 1147 |
-
}
|
| 1148 |
-
}
|
| 1149 |
-
},
|
| 1150 |
-
|
| 1151 |
-
toggleDictation: () => {
|
| 1152 |
-
if (!VoiceEngine.recognition) return Utils.showToast("Hardware dictation unsupported.");
|
| 1153 |
-
try {
|
| 1154 |
-
if(AppState.isMicRecording) {
|
| 1155 |
-
VoiceEngine.recognition.stop();
|
| 1156 |
-
} else {
|
| 1157 |
-
VoiceEngine.recognition.start();
|
| 1158 |
-
}
|
| 1159 |
-
} catch (e) { console.error("Mic Start Error", e); }
|
| 1160 |
-
}
|
| 1161 |
-
};
|
| 1162 |
-
|
| 1163 |
-
// =======================================================================================
|
| 1164 |
-
// 6. FILE PROCESSOR
|
| 1165 |
// =======================================================================================
|
| 1166 |
const FileProcessor = {
|
| 1167 |
triggerFileSelector: (type) => {
|
|
@@ -1177,8 +1044,7 @@
|
|
| 1177 |
const mime = file.type;
|
| 1178 |
|
| 1179 |
if (typeContext === 'image' && !mime.startsWith('image/')) { Utils.showToast("Visual media required."); inputElement.value=''; return; }
|
| 1180 |
-
if (typeContext === '
|
| 1181 |
-
if (typeContext === 'audio' && !mime.startsWith('audio/')) { Utils.showToast("Audio media required."); inputElement.value=''; return; }
|
| 1182 |
|
| 1183 |
Utils.showToast(`Uploading your file...`);
|
| 1184 |
|
|
@@ -1200,14 +1066,6 @@
|
|
| 1200 |
};
|
| 1201 |
fileReader.readAsDataURL(file);
|
| 1202 |
}
|
| 1203 |
-
else if (typeContext === 'video' || typeContext === 'audio') {
|
| 1204 |
-
fileReader.onload = (e) => {
|
| 1205 |
-
AppState.pendingAttachment = { type: typeContext, data: e.target.result.split(',')[1], name: file.name };
|
| 1206 |
-
docIcon.innerText = typeContext === 'video' ? '🎥' : '🎵';
|
| 1207 |
-
docIcon.style.display = 'flex';
|
| 1208 |
-
};
|
| 1209 |
-
fileReader.readAsDataURL(file);
|
| 1210 |
-
}
|
| 1211 |
else if (typeContext === 'document') {
|
| 1212 |
docIcon.innerText = '📄';
|
| 1213 |
docIcon.style.display = 'flex';
|
|
@@ -1265,7 +1123,7 @@
|
|
| 1265 |
};
|
| 1266 |
|
| 1267 |
// =======================================================================================
|
| 1268 |
-
//
|
| 1269 |
// =======================================================================================
|
| 1270 |
const CompilerEngine = {
|
| 1271 |
currentMode: 'code',
|
|
@@ -1428,7 +1286,7 @@
|
|
| 1428 |
});
|
| 1429 |
|
| 1430 |
// =======================================================================================
|
| 1431 |
-
//
|
| 1432 |
// =======================================================================================
|
| 1433 |
const ChatEngine = {
|
| 1434 |
handleKeyboard: (e) => {
|
|
@@ -1457,7 +1315,6 @@
|
|
| 1457 |
location.reload();
|
| 1458 |
},
|
| 1459 |
|
| 1460 |
-
// BUG FIX: Wrapped entirely in try/catch to ensure UI doesn't break if API fails
|
| 1461 |
syncHistoryFromCloud: async () => {
|
| 1462 |
const messageZone = document.getElementById('msgs');
|
| 1463 |
document.getElementById('welcomeState').style.display = 'none';
|
|
@@ -1494,7 +1351,6 @@
|
|
| 1494 |
}
|
| 1495 |
},
|
| 1496 |
|
| 1497 |
-
// BUG FIX: Try/Catch for saving history silently
|
| 1498 |
saveHistoryToCloud: () => {
|
| 1499 |
if (AppState.currentUser) {
|
| 1500 |
try {
|
|
@@ -1511,13 +1367,10 @@
|
|
| 1511 |
if (!attachmentObj) return '';
|
| 1512 |
if (attachmentObj.type === 'image') {
|
| 1513 |
return `<img src="data:image/jpeg;base64,${attachmentObj.data}" class="chat-in-bubble-img" alt="Attached Image">`;
|
| 1514 |
-
} else if (attachmentObj.type === '
|
| 1515 |
-
return `<div class="chat-file-card"><div class="icon"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg></div><span class="name">${attachmentObj.name}</span></div>`;
|
| 1516 |
-
} else if (attachmentObj.type === 'audio') {
|
| 1517 |
-
return `<div class="chat-file-card"><div class="icon"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><path d="M9 18V5l12-2v13"></path><circle cx="6" cy="18" r="3"></circle><circle cx="18" cy="16" r="3"></circle></svg></div><span class="name">${attachmentObj.name}</span></div>`;
|
| 1518 |
-
} else {
|
| 1519 |
return `<div class="chat-file-card"><div class="icon"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg></div><span class="name">${attachmentObj.name}</span></div>`;
|
| 1520 |
}
|
|
|
|
| 1521 |
},
|
| 1522 |
|
| 1523 |
renderUserMessage: (textContent, badgeText, previewHTMLString = '') => {
|
|
@@ -1543,13 +1396,13 @@
|
|
| 1543 |
document.getElementById('msgs').appendChild(bubbleBox);
|
| 1544 |
},
|
| 1545 |
|
| 1546 |
-
renderBotMessage: (textContent, bypassStreamFormatting = false) => {
|
| 1547 |
const bubbleBox = document.createElement('div');
|
| 1548 |
bubbleBox.className = 'chat-message-row bot-msg';
|
| 1549 |
bubbleBox.innerHTML = `
|
| 1550 |
<div class="msg-avatar"><img src="${Config.LOGO_URL}" alt="AI"></div>
|
| 1551 |
<div class="msg-content-column">
|
| 1552 |
-
<div class="chat-bubble"></div>
|
| 1553 |
</div>`;
|
| 1554 |
document.getElementById('msgs').appendChild(bubbleBox);
|
| 1555 |
ChatEngine.updateBotBubble(bubbleBox, textContent, !bypassStreamFormatting);
|
|
@@ -1569,7 +1422,7 @@
|
|
| 1569 |
contentTarget.innerHTML = renderHTML;
|
| 1570 |
|
| 1571 |
let actionTray = bubbleDOM.querySelector('.bot-actions-row');
|
| 1572 |
-
if (!isCurrentlyStreaming && !actionTray && strippedMarkup.trim().length > 0) {
|
| 1573 |
const safeRawCopy = strippedMarkup.replace(/"/g, '"').replace(/'/g, "\\'").replace(/\n/g, '\\n').replace(/\r/g, '');
|
| 1574 |
|
| 1575 |
const actionsHTML = `
|
|
@@ -1584,7 +1437,6 @@
|
|
| 1584 |
}
|
| 1585 |
},
|
| 1586 |
|
| 1587 |
-
// BUG FIX: Complete Try/Catch/Finally to unlock state no matter what happens
|
| 1588 |
initiateDispatch: async () => {
|
| 1589 |
if (AppState.isProcessing) return;
|
| 1590 |
|
|
@@ -1648,16 +1500,14 @@
|
|
| 1648 |
|
| 1649 |
const cryptographicSeed = Math.floor(Math.random() * 999999999);
|
| 1650 |
|
| 1651 |
-
let cognitivePrompt = `You are CODE VED, a sophisticated premium enterprise AI system engineered by
|
| 1652 |
-
LANGUAGE REGULATION: Your default cognitive language is ENGLISH. If the user writes in English, reply in purely professional English. If the user writes in Hindi or Hinglish, reply gracefully in Hindi. Never force Hindi translation if the prompt is English.
|
| 1653 |
-
|
| 1654 |
-
IMAGE SYNTHESIS OVERRIDE:
|
| 1655 |
-
When commanded to render, generate, or create an image/photograph, you MUST reply with a precise markdown image node targeting Pollinations AI.
|
| 1656 |
-
Formula: 
|
| 1657 |
-
Available Models: flux, flux-realism, flux-anime, flux-3d.
|
| 1658 |
-
CRITICAL: The seed parameter is mandatory to bypass cache mechanics. Always render this markdown node.`;
|
| 1659 |
|
| 1660 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1661 |
|
| 1662 |
const transmissionPayload = {
|
| 1663 |
message: payloadStr,
|
|
@@ -1668,7 +1518,6 @@
|
|
| 1668 |
temperature: 0.75
|
| 1669 |
};
|
| 1670 |
|
| 1671 |
-
// The complete Try/Catch/Finally block ensures UI never gets stuck
|
| 1672 |
try {
|
| 1673 |
const fetchOp = await fetch(Config.API_ENDPOINT, {
|
| 1674 |
method: 'POST',
|
|
@@ -1676,7 +1525,9 @@
|
|
| 1676 |
body: JSON.stringify(transmissionPayload)
|
| 1677 |
});
|
| 1678 |
|
| 1679 |
-
if (!fetchOp.ok)
|
|
|
|
|
|
|
| 1680 |
|
| 1681 |
const networkReader = fetchOp.body.getReader();
|
| 1682 |
const textDecoder = new TextDecoder();
|
|
@@ -1695,22 +1546,34 @@
|
|
| 1695 |
streamChunkBuffer = fragmentedLines.pop();
|
| 1696 |
|
| 1697 |
for (let line of fragmentedLines) {
|
|
|
|
|
|
|
|
|
|
| 1698 |
if (line.startsWith('data: ')) {
|
| 1699 |
-
const parseableStr = line.substring(6);
|
| 1700 |
-
if (parseableStr
|
| 1701 |
|
| 1702 |
try {
|
| 1703 |
const jsonSegment = JSON.parse(parseableStr);
|
| 1704 |
-
if (jsonSegment.choices && jsonSegment.choices[0].delta.content) {
|
| 1705 |
responseBuffer += jsonSegment.choices[0].delta.content;
|
| 1706 |
ChatEngine.updateBotBubble(activeBotBubble, responseBuffer, true);
|
| 1707 |
UIManager.autoScroll();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1708 |
}
|
| 1709 |
} catch (e) { }
|
| 1710 |
}
|
| 1711 |
}
|
| 1712 |
}
|
| 1713 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1714 |
AppState.isStreamingActive = false;
|
| 1715 |
ChatEngine.updateBotBubble(activeBotBubble, responseBuffer, false);
|
| 1716 |
AppState.history.push({ role: 'bot', content: responseBuffer });
|
|
@@ -1719,9 +1582,11 @@
|
|
| 1719 |
} catch(error) {
|
| 1720 |
console.error("AI Dispatch Error:", error);
|
| 1721 |
AppState.isStreamingActive = false;
|
| 1722 |
-
|
|
|
|
|
|
|
|
|
|
| 1723 |
} finally {
|
| 1724 |
-
// BUG FIX: Always release the lock
|
| 1725 |
AppState.isProcessing = false;
|
| 1726 |
document.getElementById('masterSendBtn').disabled = false;
|
| 1727 |
UIManager.autoScroll();
|
|
@@ -1730,7 +1595,7 @@
|
|
| 1730 |
};
|
| 1731 |
|
| 1732 |
// =======================================================================================
|
| 1733 |
-
//
|
| 1734 |
// =======================================================================================
|
| 1735 |
|
| 1736 |
window.startCODEVEDApp = function() {
|
|
@@ -1769,14 +1634,10 @@
|
|
| 1769 |
if(!target) return;
|
| 1770 |
|
| 1771 |
if(target.id === 'opt-image') FileProcessor.triggerFileSelector('image');
|
| 1772 |
-
if(target.id === 'opt-video') FileProcessor.triggerFileSelector('video');
|
| 1773 |
-
if(target.id === 'opt-audio') FileProcessor.triggerFileSelector('audio');
|
| 1774 |
if(target.id === 'opt-document') FileProcessor.triggerFileSelector('document');
|
| 1775 |
});
|
| 1776 |
|
| 1777 |
document.getElementById('sys-inp-image')?.addEventListener('change', function() { FileProcessor.processFile(this, 'image'); });
|
| 1778 |
-
document.getElementById('sys-inp-video')?.addEventListener('change', function() { FileProcessor.processFile(this, 'video'); });
|
| 1779 |
-
document.getElementById('sys-inp-audio')?.addEventListener('change', function() { FileProcessor.processFile(this, 'audio'); });
|
| 1780 |
document.getElementById('sys-inp-document')?.addEventListener('change', function() { FileProcessor.processFile(this, 'document'); });
|
| 1781 |
document.getElementById('btnDiscardFile')?.addEventListener('click', FileProcessor.discardFile);
|
| 1782 |
|
|
@@ -1789,10 +1650,6 @@
|
|
| 1789 |
document.getElementById('suggCodeBtn')?.addEventListener('click', () => ChatEngine.sendExample('Write a secure python script for a modern Flask backend server.'));
|
| 1790 |
document.getElementById('suggImgBtn')?.addEventListener('click', () => ChatEngine.sendExample('Create a hyper-realistic 8k image of a futuristic Indian smart city.'));
|
| 1791 |
|
| 1792 |
-
// Voice & STT Options
|
| 1793 |
-
document.getElementById('smartLangToggle')?.addEventListener('click', VoiceEngine.switchLanguage);
|
| 1794 |
-
document.getElementById('masterVoiceBtn')?.addEventListener('click', VoiceEngine.toggleDictation);
|
| 1795 |
-
|
| 1796 |
// Workspace Logic Hooks
|
| 1797 |
document.getElementById('btnWsClose')?.addEventListener('click', CompilerEngine.closePanel);
|
| 1798 |
document.getElementById('btnWsCopy')?.addEventListener('click', function() { CompilerEngine.executeCopy(this); });
|
|
@@ -1811,7 +1668,6 @@
|
|
| 1811 |
}
|
| 1812 |
|
| 1813 |
// Fire Boot Processes
|
| 1814 |
-
VoiceEngine.init();
|
| 1815 |
AuthManager.initUI();
|
| 1816 |
if(AppState.currentUser) { ChatEngine.syncHistoryFromCloud(); }
|
| 1817 |
});
|
|
@@ -1819,3 +1675,4 @@
|
|
| 1819 |
</script>
|
| 1820 |
</body>
|
| 1821 |
</html>
|
|
|
|
|
|
| 53 |
--bg-primary: #000000;
|
| 54 |
--bg-secondary: #1c1c1e;
|
| 55 |
--bg-tertiary: #2c2c2e;
|
| 56 |
+
--bg-glass: rgba(28, 28, 30, 0.65);
|
| 57 |
|
| 58 |
/* Text & Typography Colors */
|
| 59 |
--text-primary: #ffffff;
|
|
|
|
| 334 |
|
| 335 |
.chat-bubble { padding: 18px 24px; font-size: 16px; line-height: 1.6; position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
|
| 336 |
.user-msg .chat-bubble { background: var(--bg-tertiary); color: var(--text-primary); border-radius: 24px 24px 6px 24px; box-shadow: var(--shadow-md); border: 1px solid var(--border-light); }
|
| 337 |
+
.bot-msg .chat-bubble { background: rgba(28, 28, 30, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--text-primary); border: 1px solid var(--border-medium); border-radius: 6px 24px 24px 24px; box-shadow: var(--shadow-md); width: 100%; min-width: 100px;}
|
| 338 |
+
|
| 339 |
+
.error-bubble { color: #ff453a !important; border-color: rgba(255, 69, 58, 0.5) !important; background: rgba(255, 69, 58, 0.1) !important; font-weight: 500; }
|
| 340 |
|
| 341 |
/* Bot Action Buttons */
|
| 342 |
.bot-actions-row { display: flex; gap: 10px; margin-top: 8px; padding-left: 14px; opacity: 0; transition: opacity var(--ease-smooth); flex-wrap: wrap; }
|
|
|
|
| 412 |
.dropdown-item:hover svg { color: var(--brand-saffron); }
|
| 413 |
.stealth-input { display: none; }
|
| 414 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
/* Master Send Button */
|
| 416 |
.btn-master-send { width: 48px; height: 48px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.2); background: linear-gradient(135deg, var(--brand-saffron) 0%, var(--brand-saffron-dark) 100%); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--ease-spring); box-shadow: 0 4px 15px rgba(255, 153, 51, 0.3); }
|
| 417 |
.btn-master-send svg { width: 20px; height: 20px; fill: white; transition: transform 0.2s; }
|
|
|
|
| 597 |
<div class="developer-credit-box">
|
| 598 |
<img src="https://i.ibb.co/MxKsrXDj/TIRANGA-20260525-172109-0000.png" alt="CODE VED Core Image">
|
| 599 |
<h3 class="dev-box-title">CODE VED Core</h3>
|
| 600 |
+
<p class="dev-box-subtitle">ENGINEERED BY DIVY PATEL</p>
|
| 601 |
</div>
|
| 602 |
|
| 603 |
<!-- Wipe Memory Button -->
|
|
|
|
| 695 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
|
| 696 |
High-Res Image
|
| 697 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
<div class="dropdown-item" id="opt-document">
|
| 699 |
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
|
| 700 |
Document / Code
|
|
|
|
| 703 |
|
| 704 |
<!-- Hidden File Inputs -->
|
| 705 |
<input type="file" id="sys-inp-image" class="stealth-input" accept="image/*">
|
|
|
|
|
|
|
| 706 |
<input type="file" id="sys-inp-document" class="stealth-input" accept=".pdf,.doc,.docx,.txt,.md,.csv,.json,.py,.js,.html,.css,.cpp,.c,.java">
|
| 707 |
</div>
|
| 708 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 709 |
<!-- Expanding Text Area -->
|
| 710 |
<textarea class="main-textarea" id="mainChatInput" placeholder="Message CODE VED..." rows="1"></textarea>
|
| 711 |
|
|
|
|
| 715 |
</button>
|
| 716 |
</div>
|
| 717 |
</div>
|
| 718 |
+
<div class="bottom-branding-text">Secured by CODE VED Architecture • Developed by DIVY PATEL</div>
|
| 719 |
</div>
|
| 720 |
</main>
|
| 721 |
|
|
|
|
| 824 |
isUserScrolling: false,
|
| 825 |
generatedCodeBlocks: [],
|
| 826 |
currentWorkspaceId: null,
|
| 827 |
+
isStreamingActive: false
|
|
|
|
| 828 |
};
|
| 829 |
|
| 830 |
// =======================================================================================
|
|
|
|
| 950 |
triggerBtn.innerText = 'Establishing Connection...';
|
| 951 |
|
| 952 |
try {
|
|
|
|
| 953 |
const response = await fetch(Config.GAS_URL, {
|
| 954 |
method: 'POST',
|
| 955 |
+
mode: 'cors',
|
| 956 |
headers: { 'Content-Type': 'text/plain;charset=utf-8' },
|
| 957 |
body: JSON.stringify(payload)
|
| 958 |
});
|
|
|
|
| 1028 |
};
|
| 1029 |
|
| 1030 |
// =======================================================================================
|
| 1031 |
+
// 5. FILE PROCESSOR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1032 |
// =======================================================================================
|
| 1033 |
const FileProcessor = {
|
| 1034 |
triggerFileSelector: (type) => {
|
|
|
|
| 1044 |
const mime = file.type;
|
| 1045 |
|
| 1046 |
if (typeContext === 'image' && !mime.startsWith('image/')) { Utils.showToast("Visual media required."); inputElement.value=''; return; }
|
| 1047 |
+
if (typeContext === 'document' && !fName.endsWith('.pdf') && !fName.endsWith('.doc') && !fName.endsWith('.docx') && !fName.endsWith('.txt') && !fName.endsWith('.py') && !fName.endsWith('.js') && !fName.endsWith('.html')) { Utils.showToast("Document/Code format required."); inputElement.value=''; return; }
|
|
|
|
| 1048 |
|
| 1049 |
Utils.showToast(`Uploading your file...`);
|
| 1050 |
|
|
|
|
| 1066 |
};
|
| 1067 |
fileReader.readAsDataURL(file);
|
| 1068 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1069 |
else if (typeContext === 'document') {
|
| 1070 |
docIcon.innerText = '📄';
|
| 1071 |
docIcon.style.display = 'flex';
|
|
|
|
| 1123 |
};
|
| 1124 |
|
| 1125 |
// =======================================================================================
|
| 1126 |
+
// 6. COMPILER & WORKSPACE ENGINE (NEW PREVIEW / CODE LOGIC)
|
| 1127 |
// =======================================================================================
|
| 1128 |
const CompilerEngine = {
|
| 1129 |
currentMode: 'code',
|
|
|
|
| 1286 |
});
|
| 1287 |
|
| 1288 |
// =======================================================================================
|
| 1289 |
+
// 7. CORE CHAT ENGINE & LLM (WITH ROCK SOLID BUG FIXES)
|
| 1290 |
// =======================================================================================
|
| 1291 |
const ChatEngine = {
|
| 1292 |
handleKeyboard: (e) => {
|
|
|
|
| 1315 |
location.reload();
|
| 1316 |
},
|
| 1317 |
|
|
|
|
| 1318 |
syncHistoryFromCloud: async () => {
|
| 1319 |
const messageZone = document.getElementById('msgs');
|
| 1320 |
document.getElementById('welcomeState').style.display = 'none';
|
|
|
|
| 1351 |
}
|
| 1352 |
},
|
| 1353 |
|
|
|
|
| 1354 |
saveHistoryToCloud: () => {
|
| 1355 |
if (AppState.currentUser) {
|
| 1356 |
try {
|
|
|
|
| 1367 |
if (!attachmentObj) return '';
|
| 1368 |
if (attachmentObj.type === 'image') {
|
| 1369 |
return `<img src="data:image/jpeg;base64,${attachmentObj.data}" class="chat-in-bubble-img" alt="Attached Image">`;
|
| 1370 |
+
} else if (attachmentObj.type === 'document') {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1371 |
return `<div class="chat-file-card"><div class="icon"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg></div><span class="name">${attachmentObj.name}</span></div>`;
|
| 1372 |
}
|
| 1373 |
+
return '';
|
| 1374 |
},
|
| 1375 |
|
| 1376 |
renderUserMessage: (textContent, badgeText, previewHTMLString = '') => {
|
|
|
|
| 1396 |
document.getElementById('msgs').appendChild(bubbleBox);
|
| 1397 |
},
|
| 1398 |
|
| 1399 |
+
renderBotMessage: (textContent, bypassStreamFormatting = false, isError = false) => {
|
| 1400 |
const bubbleBox = document.createElement('div');
|
| 1401 |
bubbleBox.className = 'chat-message-row bot-msg';
|
| 1402 |
bubbleBox.innerHTML = `
|
| 1403 |
<div class="msg-avatar"><img src="${Config.LOGO_URL}" alt="AI"></div>
|
| 1404 |
<div class="msg-content-column">
|
| 1405 |
+
<div class="chat-bubble ${isError ? 'error-bubble' : ''}"></div>
|
| 1406 |
</div>`;
|
| 1407 |
document.getElementById('msgs').appendChild(bubbleBox);
|
| 1408 |
ChatEngine.updateBotBubble(bubbleBox, textContent, !bypassStreamFormatting);
|
|
|
|
| 1422 |
contentTarget.innerHTML = renderHTML;
|
| 1423 |
|
| 1424 |
let actionTray = bubbleDOM.querySelector('.bot-actions-row');
|
| 1425 |
+
if (!isCurrentlyStreaming && !actionTray && strippedMarkup.trim().length > 0 && !contentTarget.classList.contains('error-bubble')) {
|
| 1426 |
const safeRawCopy = strippedMarkup.replace(/"/g, '"').replace(/'/g, "\\'").replace(/\n/g, '\\n').replace(/\r/g, '');
|
| 1427 |
|
| 1428 |
const actionsHTML = `
|
|
|
|
| 1437 |
}
|
| 1438 |
},
|
| 1439 |
|
|
|
|
| 1440 |
initiateDispatch: async () => {
|
| 1441 |
if (AppState.isProcessing) return;
|
| 1442 |
|
|
|
|
| 1500 |
|
| 1501 |
const cryptographicSeed = Math.floor(Math.random() * 999999999);
|
| 1502 |
|
| 1503 |
+
let cognitivePrompt = `You are CODE VED, a sophisticated premium enterprise AI system engineered by DIVY PATEL.
|
| 1504 |
+
LANGUAGE REGULATION: Your default cognitive language is ENGLISH. If the user writes in English, reply in purely professional English. If the user writes in Hindi or Hinglish, reply gracefully in Hindi. Never force Hindi translation if the prompt is English.`;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1505 |
|
| 1506 |
+
// BUG FIX: Strictly mapping history roles to 'assistant' to prevent backend crashes
|
| 1507 |
+
const secureHistory = AppState.history.slice(0, -1).map(h => ({
|
| 1508 |
+
role: h.role === 'bot' ? 'assistant' : h.role,
|
| 1509 |
+
content: h.content
|
| 1510 |
+
}));
|
| 1511 |
|
| 1512 |
const transmissionPayload = {
|
| 1513 |
message: payloadStr,
|
|
|
|
| 1518 |
temperature: 0.75
|
| 1519 |
};
|
| 1520 |
|
|
|
|
| 1521 |
try {
|
| 1522 |
const fetchOp = await fetch(Config.API_ENDPOINT, {
|
| 1523 |
method: 'POST',
|
|
|
|
| 1525 |
body: JSON.stringify(transmissionPayload)
|
| 1526 |
});
|
| 1527 |
|
| 1528 |
+
if (!fetchOp.ok) {
|
| 1529 |
+
throw new Error(`API Disconnected (Status: ${fetchOp.status})`);
|
| 1530 |
+
}
|
| 1531 |
|
| 1532 |
const networkReader = fetchOp.body.getReader();
|
| 1533 |
const textDecoder = new TextDecoder();
|
|
|
|
| 1546 |
streamChunkBuffer = fragmentedLines.pop();
|
| 1547 |
|
| 1548 |
for (let line of fragmentedLines) {
|
| 1549 |
+
line = line.trim();
|
| 1550 |
+
if(!line) continue;
|
| 1551 |
+
|
| 1552 |
if (line.startsWith('data: ')) {
|
| 1553 |
+
const parseableStr = line.substring(6).trim();
|
| 1554 |
+
if (parseableStr === '[DONE]') continue;
|
| 1555 |
|
| 1556 |
try {
|
| 1557 |
const jsonSegment = JSON.parse(parseableStr);
|
| 1558 |
+
if (jsonSegment.choices && jsonSegment.choices[0].delta && jsonSegment.choices[0].delta.content) {
|
| 1559 |
responseBuffer += jsonSegment.choices[0].delta.content;
|
| 1560 |
ChatEngine.updateBotBubble(activeBotBubble, responseBuffer, true);
|
| 1561 |
UIManager.autoScroll();
|
| 1562 |
+
} else if (jsonSegment.response) { // Ollama API fallback compatibility
|
| 1563 |
+
responseBuffer += jsonSegment.response;
|
| 1564 |
+
ChatEngine.updateBotBubble(activeBotBubble, responseBuffer, true);
|
| 1565 |
+
UIManager.autoScroll();
|
| 1566 |
}
|
| 1567 |
} catch (e) { }
|
| 1568 |
}
|
| 1569 |
}
|
| 1570 |
}
|
| 1571 |
|
| 1572 |
+
// BUG FIX: Handle completely empty responses gracefully
|
| 1573 |
+
if (!responseBuffer.trim()) {
|
| 1574 |
+
throw new Error("Received an empty neural transmission.");
|
| 1575 |
+
}
|
| 1576 |
+
|
| 1577 |
AppState.isStreamingActive = false;
|
| 1578 |
ChatEngine.updateBotBubble(activeBotBubble, responseBuffer, false);
|
| 1579 |
AppState.history.push({ role: 'bot', content: responseBuffer });
|
|
|
|
| 1582 |
} catch(error) {
|
| 1583 |
console.error("AI Dispatch Error:", error);
|
| 1584 |
AppState.isStreamingActive = false;
|
| 1585 |
+
|
| 1586 |
+
// Show actual error in the bubble instead of leaving it empty
|
| 1587 |
+
activeBotBubble.querySelector('.chat-bubble').classList.add('error-bubble');
|
| 1588 |
+
ChatEngine.updateBotBubble(activeBotBubble, `**System Error:** Communication array offline. Verification needed. (${error.message})`, false);
|
| 1589 |
} finally {
|
|
|
|
| 1590 |
AppState.isProcessing = false;
|
| 1591 |
document.getElementById('masterSendBtn').disabled = false;
|
| 1592 |
UIManager.autoScroll();
|
|
|
|
| 1595 |
};
|
| 1596 |
|
| 1597 |
// =======================================================================================
|
| 1598 |
+
// 8. EVENT DELEGATION & BOOTSTRAP INVOCATION
|
| 1599 |
// =======================================================================================
|
| 1600 |
|
| 1601 |
window.startCODEVEDApp = function() {
|
|
|
|
| 1634 |
if(!target) return;
|
| 1635 |
|
| 1636 |
if(target.id === 'opt-image') FileProcessor.triggerFileSelector('image');
|
|
|
|
|
|
|
| 1637 |
if(target.id === 'opt-document') FileProcessor.triggerFileSelector('document');
|
| 1638 |
});
|
| 1639 |
|
| 1640 |
document.getElementById('sys-inp-image')?.addEventListener('change', function() { FileProcessor.processFile(this, 'image'); });
|
|
|
|
|
|
|
| 1641 |
document.getElementById('sys-inp-document')?.addEventListener('change', function() { FileProcessor.processFile(this, 'document'); });
|
| 1642 |
document.getElementById('btnDiscardFile')?.addEventListener('click', FileProcessor.discardFile);
|
| 1643 |
|
|
|
|
| 1650 |
document.getElementById('suggCodeBtn')?.addEventListener('click', () => ChatEngine.sendExample('Write a secure python script for a modern Flask backend server.'));
|
| 1651 |
document.getElementById('suggImgBtn')?.addEventListener('click', () => ChatEngine.sendExample('Create a hyper-realistic 8k image of a futuristic Indian smart city.'));
|
| 1652 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1653 |
// Workspace Logic Hooks
|
| 1654 |
document.getElementById('btnWsClose')?.addEventListener('click', CompilerEngine.closePanel);
|
| 1655 |
document.getElementById('btnWsCopy')?.addEventListener('click', function() { CompilerEngine.executeCopy(this); });
|
|
|
|
| 1668 |
}
|
| 1669 |
|
| 1670 |
// Fire Boot Processes
|
|
|
|
| 1671 |
AuthManager.initUI();
|
| 1672 |
if(AppState.currentUser) { ChatEngine.syncHistoryFromCloud(); }
|
| 1673 |
});
|
|
|
|
| 1675 |
</script>
|
| 1676 |
</body>
|
| 1677 |
</html>
|
| 1678 |
+
|