The Chat page is the heart of Lumina AI. It gives students a single, conversational space to ask academic questions, get explanations, and access study tools—without navigating away from the conversation. The interface is deliberately minimal: a dark galaxy-themed background with animated twinkling stars, a left sidebar for navigation and stats, and a centered message thread that keeps the focus on learning.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/diazdavilajesus16-stack/IA-LUMINA/llms.txt
Use this file to discover all available pages before exploring further.
Chat interface overview
When you open Lumina AI, the Chat page loads immediately. The layout has three zones:- Galaxy background — A deep-space visual with 140 procedurally placed stars that twinkle using CSS animations. If
assets/galaxy.pngis present it is loaded as a base64 background image; otherwise a CSS radial gradient fallback is used. - Left sidebar — Persistent across all pages. Shows the Lumina robot avatar, navigation buttons, quick-action shortcuts, gamification stats, and the PDF upload panel.
- Chat thread — A scrollable message area (
max-width: 980px, centered) with animated message bubbles. Assistant messages appear on the left with an avatar; user messages appear on the right in a purple gradient bubble.
H:MM AM/PM. User bubbles show a double-checkmark (✓✓) after the timestamp.
Lumina AI responds entirely in Spanish. All built-in prompts, quick actions, and chatbot responses are in Spanish (es-ES). The voice recognition engine is also configured for Spanish.
Text input
Students type questions in a fixed bottom input bar that stays visible as the conversation scrolls. The bar is styled as a pill-shaped field (border-radius: 56px) anchored at the bottom center of the viewport (position: fixed; bottom: 24px). It is limited to max-width: 880px and spans 90% of the viewport width on desktop, adjusting to 95% on mobile.
Pressing Enter or clicking the send button calls send_message(), which:
- Checks for a PDF context first (see PDF context below).
- Falls back to
get_response()from the intent-matching system. - Appends both the user message and the assistant reply to
st.session_state.messages. - Awards XP and updates the streak via
update_streak_and_xp().
Voice input
Students can speak their questions instead of typing them. Thetranscribe_audio() function in Main.py handles audio-to-text conversion using the Google Speech Recognition API with the es-ES locale.
.webm file and attempting recognition directly.
Dependencies for voice input:
PDF context
Students can upload a PDF document to ground Lumina AI’s answers in their own study material. The PDF panel lives inside a collapsible📄 Cargar PDF expander in the left sidebar.
How it works
Upload a PDF
Click the expander in the sidebar and select a
.pdf file. Lumina reads it with extract_text_from_pdf(), which uses PyPDF2 to extract text from every page and concatenate the results.Ask a question
Type or speak your question normally. Before querying the chatbot,
send_message() calls query_pdf() to search the extracted text.Relevance scoring
query_pdf() splits the PDF text into paragraphs (separated by blank lines) and scores each one by counting how many words from the user’s question appear in the paragraph. A paragraph must score at least 2 keyword matches to be considered relevant. The highest-scoring paragraph wins.
Quick actions
The sidebar includes six one-tap prompts that send a pre-written message to the chat, triggering an immediate response from the chatbot. These are useful for standard study tasks without having to type a full question.Explícame esto con una analogía
Ask Lumina to explain the current topic using an everyday comparison or metaphor.
Dame ejemplos prácticos
Request concrete, real-world examples to illustrate an abstract concept.
Haz un resumen claro del tema
Generate a concise summary of whatever topic is being discussed.
Hazme un quiz sobre esto
Start a quiz session to test your understanding of the topic.
Dame técnicas de memorización
Get science-backed memorization strategies such as spaced repetition and the memory palace.
Dame motivación para estudiar
Receive an encouraging message to help you push through a difficult study session.
send_message() with the corresponding prompt string, so the interaction is identical to typing that prompt manually.
Text-to-speech
Every assistant message has a ♪ button below the bubble. Clicking it generates an MP3 audio file from the message text using gTTS (Google Text-to-Speech) withlang="es", then plays it inline via Streamlit’s audio widget.
.mp3 file, which is passed to st.audio() with format="audio/mp3". Each message gets its own button keyed by message index (speak_{idx}), so multiple messages can be played without conflict.