Skip to content

Commit 881a9d2

Browse files
Update Verso.py
1 parent 7a25d20 commit 881a9d2

1 file changed

Lines changed: 48 additions & 48 deletions

File tree

Verso.py

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@
77
import difflib
88
import streamlit.components.v1 as components
99

10+
# --- 🛰️ GOOGLE ANALYTICS INTEGRATION ---
11+
def inject_ga():
12+
ga_id = "G-030XWBG97P"
13+
ga_code = f"""
14+
<script async src="https://www.googletagmanager.com/gtag/js?id={ga_id}"></script>
15+
<script>
16+
window.dataLayer = window.dataLayer || [];
17+
function gtag(){{dataLayer.push(arguments);}}
18+
gtag('js', new Date());
19+
gtag('config', '{ga_id}', {{ 'debug_mode': true }});
20+
</script>
21+
"""
22+
components.html(ga_code, height=0)
23+
1024
# --- 🛠️ ACADEMIC ENGINE SETUP ---
1125
@st.cache_resource
1226
def setup_system():
@@ -25,11 +39,6 @@ def setup_system():
2539
if 'sound_unlocked' not in st.session_state: st.session_state.sound_unlocked = False
2640
if 'selected_alarm_tone' not in st.session_state: st.session_state.selected_alarm_tone = "Double Beep"
2741

28-
# Settings Persistance
29-
if 'set_color' not in st.session_state: st.session_state.set_color = "#3b82f6"
30-
if 'set_bg' not in st.session_state: st.session_state.set_bg = "#1e293b"
31-
if 'set_font' not in st.session_state: st.session_state.set_font = 1.1
32-
3342
# NotebookLM Style States
3443
if 'quiz_step' not in st.session_state: st.session_state.quiz_step = 0
3544
if 'quiz_score' not in st.session_state: st.session_state.quiz_score = 0
@@ -68,9 +77,9 @@ def trigger_master_reset():
6877
st.session_state.remaining_at_pause = diff
6978

7079
# --- 🎨 STYLING ---
71-
accent = st.session_state.set_color
72-
bg_card = st.session_state.set_bg
73-
f_scale = st.session_state.set_font
80+
accent = st.session_state.get('set_color', "#3b82f6")
81+
bg_card = st.session_state.get('set_bg', "#1e293b")
82+
f_scale = st.session_state.get('set_font', 1.1)
7483
selected_tone_name = st.session_state.selected_alarm_tone
7584
selected_tone_url = ALARM_TONES.get(selected_tone_name)
7685

@@ -119,8 +128,8 @@ def trigger_master_reset():
119128

120129
# --- MODULE: GRAMMAR CHECKER ---
121130
if choice == "✍️ Grammar Checker":
122-
st.markdown('<h1>Smart Verso Auto-Correct <span class="pro-badge">V5.0</span></h1>', unsafe_allow_html=True)
123-
text_to_check = st.text_area("Paste text to improve:", height=250, placeholder="Please input the text you want to correct...")
131+
st.markdown('<h1>Smart Google Auto-Correct <span class="pro-badge">V5.0</span></h1>', unsafe_allow_html=True)
132+
text_to_check = st.text_area("Paste text to improve:", height=250, placeholder="Please input the text you wnt to correct...")
124133
if st.button("✨ Run Smart Correction", use_container_width=True):
125134
if text_to_check:
126135
with st.spinner("Processing..."):
@@ -148,7 +157,7 @@ def trigger_master_reset():
148157
elif choice == "🛡️ Plagiarism Checker":
149158
st.title("Integrity Scanner Pro")
150159
plag_text = st.text_area("Paste text to scan:", placeholder="Paste text here...", height=250)
151-
if st.button("🔍 Deep Verso Plagiarism Scan", use_container_width=True):
160+
if st.button("🔍 Deep Plagiarism Scan", use_container_width=True):
152161
if plag_text:
153162
with st.spinner("Comparing databases..."):
154163
time.sleep(2.5)
@@ -187,6 +196,7 @@ def trigger_master_reset():
187196

188197
with t1:
189198
cols = st.columns(2)
199+
# Fixed loop to use "words" variable instead of missing "data" key
190200
for i, phrase in enumerate(words[:20]):
191201
cols[i % 2].markdown(f'<div class="notebook-card"><b>{i+1}.</b> {phrase.title()}</div>', unsafe_allow_html=True)
192202

@@ -205,7 +215,7 @@ def trigger_master_reset():
205215
random.shuffle(opts)
206216
elif q_type == 1:
207217
fake_target = random.choice([x.title() for x in words if x.title() != target])
208-
st.markdown(f'<div class="notebook-card">Does the provided material state that <b>"{target}"</b> is functionally equivalent to <b>"{fake_target}"</b>?</div>', unsafe_allow_html=True)
218+
st.markdown(f'<div class="notebook-card">Does the provided material state that <b>"{target}"</b> is primarily functionally equivalent to <b>"{fake_target}"</b>?</div>', unsafe_allow_html=True)
209219
opts = ["No, they are distinct", "Yes, they are the same"]
210220
target = "No, they are distinct"
211221
else:
@@ -226,6 +236,7 @@ def trigger_master_reset():
226236
if st.button("Restart Quiz"): st.session_state.quiz_step = 0; st.session_state.quiz_score = 0; st.rerun()
227237

228238
with t3:
239+
# --- FIXED FLASHCARDS: REMOVED FRAGMENTATION & KEY ERRORS ---
229240
st.markdown("### NotebookLM Style Flashcards (25 Cards)")
230241
total_fc = 25
231242
if st.session_state.fc_step < total_fc:
@@ -235,25 +246,27 @@ def trigger_master_reset():
235246

236247
fc_type = curr_idx % 4
237248
if fc_type == 0:
238-
q_text = f"In reference to the core academic principles outlined in your study material, how would you best describe the significance or technical definition of <b>'{curr_word}'</b>?"
239-
a_text = f"<b>Source Analysis:</b> Your material utilizes '{curr_word}' as a core technical anchor."
249+
q_text = f"In reference to the core academic principles outlined in your study material, how would you best describe the significance or technical definition of **'{curr_word}'**?"
250+
a_text = f"<b>Source Analysis:</b> Your material utilizes '{curr_word}' as a core technical anchor. It serves to validate the primary claims by providing the necessary conceptual grounding described in the text."
240251
elif fc_type == 1:
241-
q_text = f"If you had to apply <b>'{curr_word}'</b> to a practical scenario following the logic of the source, what would be the intended outcome?"
242-
a_text = f"<b>Practical Application:</b> The source implies that successful implementation leads to a more robust result."
252+
q_text = f"If you had to apply **'{curr_word}'** to a practical scenario following the logic of the source, what would be the intended outcome?"
253+
a_text = f"<b>Practical Application:</b> The source implies that successful implementation of '{curr_word}' leads to a more robust result, specifically bridging the gap between theoretical input and real-world execution."
243254
elif fc_type == 2:
244255
other_word = words[(curr_idx + 1) % len(words)].title()
245-
q_text = f"Analyze the connection between <b>'{curr_word}'</b> and <b>'{other_word}'</b>. How do they interact within your content?"
246-
a_text = f"<b>Inter-Term Relationship:</b> Within your notes, '{curr_word}' acts as a prerequisite or supporting pillar for '{other_word}'."
256+
q_text = f"Analyze the connection between **'{curr_word}'** and **'{other_word}'**. How do they interact within your study content?"
257+
a_text = f"<b>Inter-Term Relationship:</b> Within your notes, '{curr_word}' acts as a prerequisite or supporting pillar for '{other_word}'. They are functionally linked, meaning the effectiveness of one directly impacts the reliability of the other."
247258
else:
248-
q_text = f"What specific evidence or context does the inputed source provide to highlight the importance of <b>'{curr_word}'</b>?"
249-
a_text = f"<b>Contextual Importance:</b> The input identifies '{curr_word}' as a high-value variable."
259+
q_text = f"What specific evidence or context does the inputed source provide to highlight the importance of **'{curr_word}'**?"
260+
a_text = f"<b>Contextual Importance:</b> The input identifies '{curr_word}' as a high-value variable. Its presence is highlighted to ensure the user understands the structural dependency of the entire topic on this specific point."
250261

262+
# Single, clear integrated question box
251263
st.markdown(f'<div class="notebook-card" style="min-height:220px; display:flex; align-items:center; justify-content:center; text-align:center; font-size:1.3rem; line-height:1.6;">{q_text}</div>', unsafe_allow_html=True)
252264

253265
if not st.session_state.reveal_fc:
254266
if st.button("Reveal Detailed Analysis", use_container_width=True):
255267
st.session_state.reveal_fc = True; st.rerun()
256-
else:
268+
269+
if st.session_state.reveal_fc:
257270
st.markdown(f'<div style="background-color:#0f172a; padding:25px; border-radius:10px; border:1px solid {accent}; margin-bottom:15px; color:#cbd5e1; line-height:1.7;">{a_text}</div>', unsafe_allow_html=True)
258271
c1, c2 = st.columns(2)
259272
if c1.button("✅ Mastered", use_container_width=True):
@@ -271,9 +284,13 @@ def trigger_master_reset():
271284
<div class="teacher-board">
272285
<h2>AI DEEP TEACHER: CONTENT MASTERCLASS</h2>
273286
<h3>I. Executive Core Concept</h3>
274-
<p>The central pillar is <b>{words[0].title()}</b>.</p>
287+
<p>The central pillar is <b>{words[0].title()}</b>. This dictates how <b>{words[1].title()}</b> is applied.</p>
275288
<h3>II. Technical Mechanics & Workflow</h3>
276-
<p>We observe interaction between <b>{words[2].title()}</b> and <b>{words[3].title()}</b>.</p>
289+
<p>We observe interaction between <b>{words[2].title()}</b> and <b>{words[3].title()}</b>. Without <b>{words[4].title()}</b>, the objective would fail.</p>
290+
<h3>III. Deep Contextual Impact</h3>
291+
<p>Analyzing <b>{words[5].title()}</b> reveals a deeper layer. It acts as a bridge to <b>{words[6].title()}</b>.</p>
292+
<h3>IV. Critical Synthesis</h3>
293+
<p><b>{words[8].title()}</b> is deeply connected to <b>{words[9].title()}</b> and <b>{words[10].title()}</b>.</p>
277294
</div>
278295
""", unsafe_allow_html=True)
279296

@@ -295,41 +312,24 @@ def trigger_master_reset():
295312
# --- MODULE: SETTINGS ---
296313
elif choice == "⚙️ Settings":
297314
st.title("Verso Control Center")
298-
if st.button("🚨 MASTER RESET", type="primary", use_container_width=True): trigger_master_reset()
299-
300-
st.divider()
301-
315+
if st.button("🚨 MASTER RESET", type="primary"): trigger_master_reset()
302316
v_id = st.session_state.reset_counter
303317
c1, c2, c3 = st.columns(3)
304-
305318
with c1:
306-
st.subheader("📚 Academic & Audio")
319+
st.write("### 📚 Academic & Audio")
307320
st.selectbox("Alarm Tone", list(ALARM_TONES.keys()), key="selected_alarm_tone")
308-
st.slider("Font Scale", 0.8, 2.0, st.session_state.set_font, key="set_font")
309-
st.toggle("AI Audio Feedback", value=True)
310-
st.toggle("Auto-Skip Mastered Cards", value=False)
311-
st.button("🔊 Test Current Alarm", use_container_width=True)
312-
313321
with c2:
314-
st.subheader("🎨 UI Appearance")
315-
st.color_picker("Accent Color", st.session_state.set_color, key="set_color")
316-
st.color_picker("Card Background", st.session_state.set_bg, key="set_bg")
317-
st.radio("UI Theme Mode", ["Standard", "High Contrast", "OLED Dark"], horizontal=True)
318-
st.checkbox("Show Study Balloons", value=True)
319-
st.checkbox("Enable Navigation Tooltips", value=True)
320-
322+
st.write("### 🎨 UI")
323+
st.color_picker("Accent", accent, key=f"s11_{v_id}")
324+
st.color_picker("Card BG", bg_card, key=f"s12_{v_id}")
321325
with c3:
322-
st.subheader("🔐 System Info")
323-
st.info(f"Build: 14.6.5 (vID: {v_id})")
324-
st.write("Current Configuration Ledger:")
325-
st.code(f"Font: {st.session_state.set_font}x\nAccent: {st.session_state.set_color}\nBG: {st.session_state.set_bg}")
326-
st.button("📂 Export Study Session Data", use_container_width=True)
327-
st.button("☁️ Sync with GitHub Repository", use_container_width=True)
326+
st.write("### 🔐 Security")
327+
st.info(f"Build: 14.5.8 (vID: {v_id})")
328328

329329
# --- HOME ---
330330
elif choice == "🏠 Home":
331331
st.title("VERSO RESEARCH")
332-
q = st.text_input("🔍 Search Database:", placeholder="Type what you want to search for here...")
332+
q = st.text_input("🔍 Search Database:", placeholder="Search...")
333333
if q: st.markdown(f'<div style="height:600px; overflow:hidden;"><iframe src="https://www.google.com/search?q={q}&igu=1" style="width:100%; height:800px; border:none; margin-top:-120px;"></iframe></div>', unsafe_allow_html=True,)
334334

335335
# --- GLOBAL TRIGGERS ---

0 commit comments

Comments
 (0)