diff --git a/TalkHeal.py b/TalkHeal.py index 785d7e1..cc28d6e 100644 --- a/TalkHeal.py +++ b/TalkHeal.py @@ -55,7 +55,6 @@ from components.emergency_page import render_emergency_page from components.profile import apply_global_font_size - # --- 1. INITIALIZE SESSION STATE --- if "chat_history" not in st.session_state: st.session_state.chat_history = [] @@ -80,7 +79,6 @@ # --- 2. SET PAGE CONFIG --- apply_global_font_size() - # --- 3. APPLY STYLES & CONFIGURATIONS --- apply_custom_css() model = configure_gemini() @@ -136,6 +134,79 @@ def get_tone_prompt():

🗣️ Current Chatbot Tone: {st.session_state['selected_tone']}

""", unsafe_allow_html=True) + + # --- Mood Slider with Keyboard Navigation --- + def mood_slider(): + slider_html = """ +
+ + +
Neutral
+ + +
+ """ + mood_value = st.components.v1.html(slider_html, height=100) + return mood_value + + # --- Mood Slider --- + st.subheader("😊 Track Your Mood") + mood_options = ['Very Sad', 'Sad', 'Neutral', 'Happy', 'Very Happy'] + mood = st.slider( + 'Select your mood', + min_value=1, max_value=5, value=3, step=1 +) + coping_tips = { + 1: "It’s okay to feel this way. Try some deep breathing exercises to find calm.", + 2: "Consider writing down your thoughts in the journal to process your feelings.", + 3: "A short walk or some light stretching might help you feel balanced.", + 4: "Great to hear you’re feeling happy! Share something positive in your journal.", + 5: "You’re shining today! Keep spreading that positivity with a kind act." +} + st.write(f"Selected mood: {mood_options[mood-1]}") + st.write(f"Coping tip: {coping_tips.get(mood, 'Let’s explore how you’re feeling.')}") + render_chat_interface() handle_chat_input(model, system_prompt=get_tone_prompt()) @@ -150,20 +221,4 @@ def get_tone_prompt(): } setTimeout(scrollToBottom, 100); -""", unsafe_allow_html=True) - -st.markdown(""" - -""", unsafe_allow_html=True) \ No newline at end of file +""", unsafe_allow_html=True) \ No newline at end of file