Spaces:
Running
Running
Update books.html
Browse files- books.html +9 -6
books.html
CHANGED
|
@@ -617,17 +617,20 @@ textarea { flex: 1; background: transparent; border: none; color: var(--text-mai
|
|
| 617 |
document.body.appendChild(t); setTimeout(() => { t.style.opacity = '0'; t.style.transition = '0.3s'; setTimeout(() => t.remove(), 300); }, 2500);
|
| 618 |
}
|
| 619 |
|
| 620 |
-
|
| 621 |
window.addEventListener('load', async function() {
|
|
|
|
| 622 |
window.stopAudio();
|
| 623 |
window.resetSendButton();
|
| 624 |
|
| 625 |
-
//
|
|
|
|
| 626 |
document.getElementById('chatPage').style.display = 'flex';
|
| 627 |
-
document.getElementById('settingsBtn').style.display = '
|
| 628 |
document.getElementById('clearBtn').style.display = 'block';
|
| 629 |
document.getElementById('shareBtn').style.display = 'block';
|
| 630 |
|
|
|
|
| 631 |
selectedData = { publisher: "General", subject: "General Studies", class: "Any", chapter: "General" };
|
| 632 |
|
| 633 |
let ptiParam = new URLSearchParams(window.location.search).get('pti');
|
|
@@ -642,8 +645,7 @@ textarea { flex: 1; background: transparent; border: none; color: var(--text-mai
|
|
| 642 |
if(urlRestoreId) {
|
| 643 |
let session = savedSessions.find(s => s.id == urlRestoreId);
|
| 644 |
if(session) {
|
| 645 |
-
selectedData = session.data
|
| 646 |
-
currentSessionId = session.id;
|
| 647 |
document.getElementById('sessionTitleDisplay').innerText = session.title || "π Book Deep Study";
|
| 648 |
document.getElementById('chatHistory').innerHTML = session.html;
|
| 649 |
localSessionHTMLSize = session.html.length;
|
|
@@ -653,12 +655,13 @@ textarea { flex: 1; background: transparent; border: none; color: var(--text-mai
|
|
| 653 |
let activeSession = localStorage.getItem('bookChatHistory_VUltimateAI');
|
| 654 |
let activeSettings = localStorage.getItem('bookSettings_VUltimateAI');
|
| 655 |
if(activeSession && activeSettings) {
|
| 656 |
-
selectedData = JSON.parse(activeSettings)
|
| 657 |
document.getElementById('sessionTitleDisplay').innerText = `${selectedData.subject} - ${selectedData.chapter}`;
|
| 658 |
document.getElementById('chatHistory').innerHTML = activeSession;
|
| 659 |
localSessionHTMLSize = activeSession.length;
|
| 660 |
setTimeout(() => { const c = document.getElementById('chatHistory'); c.scrollTo({top: c.scrollHeight, behavior: 'instant'}); }, 100);
|
| 661 |
} else {
|
|
|
|
| 662 |
document.getElementById('sessionTitleDisplay').innerText = "π Book Deep Study";
|
| 663 |
window.startConversation(true);
|
| 664 |
}
|
|
|
|
| 617 |
document.body.appendChild(t); setTimeout(() => { t.style.opacity = '0'; t.style.transition = '0.3s'; setTimeout(() => t.remove(), 300); }, 2500);
|
| 618 |
}
|
| 619 |
|
| 620 |
+
// π AUTO RESTORE & BYPASS WIZARD ENTIRELY π
|
| 621 |
window.addEventListener('load', async function() {
|
| 622 |
+
document.getElementById('closeSettingsWizardBtn').style.display = 'none';
|
| 623 |
window.stopAudio();
|
| 624 |
window.resetSendButton();
|
| 625 |
|
| 626 |
+
// 1. NUKE THE WIZARD UI IMMEDIATELY
|
| 627 |
+
document.getElementById('wizardPage').style.display = 'none';
|
| 628 |
document.getElementById('chatPage').style.display = 'flex';
|
| 629 |
+
document.getElementById('settingsBtn').style.display = 'block';
|
| 630 |
document.getElementById('clearBtn').style.display = 'block';
|
| 631 |
document.getElementById('shareBtn').style.display = 'block';
|
| 632 |
|
| 633 |
+
// 2. SET DEFAULT DATA SO THE AI DOESN'T CRASH
|
| 634 |
selectedData = { publisher: "General", subject: "General Studies", class: "Any", chapter: "General" };
|
| 635 |
|
| 636 |
let ptiParam = new URLSearchParams(window.location.search).get('pti');
|
|
|
|
| 645 |
if(urlRestoreId) {
|
| 646 |
let session = savedSessions.find(s => s.id == urlRestoreId);
|
| 647 |
if(session) {
|
| 648 |
+
selectedData = session.data; currentSessionId = session.id;
|
|
|
|
| 649 |
document.getElementById('sessionTitleDisplay').innerText = session.title || "π Book Deep Study";
|
| 650 |
document.getElementById('chatHistory').innerHTML = session.html;
|
| 651 |
localSessionHTMLSize = session.html.length;
|
|
|
|
| 655 |
let activeSession = localStorage.getItem('bookChatHistory_VUltimateAI');
|
| 656 |
let activeSettings = localStorage.getItem('bookSettings_VUltimateAI');
|
| 657 |
if(activeSession && activeSettings) {
|
| 658 |
+
selectedData = JSON.parse(activeSettings);
|
| 659 |
document.getElementById('sessionTitleDisplay').innerText = `${selectedData.subject} - ${selectedData.chapter}`;
|
| 660 |
document.getElementById('chatHistory').innerHTML = activeSession;
|
| 661 |
localSessionHTMLSize = activeSession.length;
|
| 662 |
setTimeout(() => { const c = document.getElementById('chatHistory'); c.scrollTo({top: c.scrollHeight, behavior: 'instant'}); }, 100);
|
| 663 |
} else {
|
| 664 |
+
// 3. IF NO HISTORY, INSTANTLY START A NEW CHAT
|
| 665 |
document.getElementById('sessionTitleDisplay').innerText = "π Book Deep Study";
|
| 666 |
window.startConversation(true);
|
| 667 |
}
|