Akki-jaiswal / Akki-jaiswal/fitness-chatbot

[Bug] Fix Context Persistence in Streamlit App

Offen
#64 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
HTML
Sterne
5
Forks
16
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.