Akki-jaiswal / Akki-jaiswal/fitness-chatbot

[Bug] Fix Context Persistence in Streamlit App

Ouverte
#64 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
HTML
Étoiles
5
Forks
16
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

**Description:** Currently, the bot.py script re-initializes the last_matched_intent variable to None every time the user submits a new message. Because Streamlit reruns the entire script on every interaction, the chatbot has "amnesia" and cannot remember context (e.g., if a user selects "Workout Plan" and then types "Beginner", the bot forgets they were talking about workouts).

**Expected Behavior:** The bot should remember the last_matched_intent across different user interactions so that follow-up logic (nested if-statements) works correctly.

Tasks:

- Replace the global last_matched_intent variable with st.session_state.
- Initialize st.session_state.last_intent if it does not exist.
- Update the get_chatbot_response function to read and write to st.session_state.last_intent.

I am a DSCWOC contributor, please assign it to me!

~@aaditya8979

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.