Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,28 +12,12 @@ with open("info.txt", "r", encoding="utf-8") as file:
|
|
| 12 |
clinic_data = file.read().lower()
|
| 13 |
|
| 14 |
# Keep track of conversation state
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
"income": None,
|
| 22 |
-
"last_eligible_program": None,
|
| 23 |
-
}
|
| 24 |
-
|
| 25 |
-
message = message.strip().lower()
|
| 26 |
-
|
| 27 |
-
# (Insert your same logic here, replacing conversation_state with state)
|
| 28 |
-
|
| 29 |
-
# Example:
|
| 30 |
-
if state["stage"] == "intro":
|
| 31 |
-
response = "Hi! I can help you find free clinics in your Washington county, or figure out what health programs you may qualify for."
|
| 32 |
-
state["stage"] = "wait_for_choice"
|
| 33 |
-
|
| 34 |
-
# ... rest of your logic using state["..."]
|
| 35 |
-
|
| 36 |
-
return response, state
|
| 37 |
|
| 38 |
# Helper to get clinics by county
|
| 39 |
def find_clinic_by_county(county_name, file_path="info.txt"):
|
|
|
|
| 12 |
clinic_data = file.read().lower()
|
| 13 |
|
| 14 |
# Keep track of conversation state
|
| 15 |
+
conversation_state = {
|
| 16 |
+
"stage": "intro",
|
| 17 |
+
"age": None,
|
| 18 |
+
"income": None,
|
| 19 |
+
"last_eligible_program": None, # <--- NEW FIELD
|
| 20 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Helper to get clinics by county
|
| 23 |
def find_clinic_by_county(county_name, file_path="info.txt"):
|