KeenWoo commited on
Commit
5a20464
·
verified ·
1 Parent(s): 1d3f707

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -8
app.py CHANGED
@@ -352,6 +352,33 @@ def collect_settings(*args):
352
  "disease_stage",
353
  "behaviour_tag", "emotion_tag", "topic_tag", "active_theme", "tts_on", "debug_mode"]
354
  return dict(zip(keys, args))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
 
356
 
357
  # In app.py, replace the entire parse_and_tag_entries function.
@@ -759,14 +786,7 @@ def save_file_selection(theme, enabled):
759
  def refresh_file_list_ui(theme):
760
  files = list_theme_files(theme)
761
  return gr.update(choices=[f for f, _ in files], value=[f for f, en in files if en]), f"Found {len(files)} file(s)."
762
- def auto_setup_on_load(theme):
763
- if not os.listdir(theme_upload_dir(theme)): seed_files_into_theme(theme)
764
- # Changed the 11th argument from "All" to "None"
765
- settings = collect_settings("patient", "", "", "warm", "English", "English", 0.7,
766
- "None", "None", "None", "None", True, False)
767
- files_ui, status = refresh_file_list_ui(theme)
768
- return settings, files_ui, status
769
-
770
  def test_save_file():
771
  try:
772
  path = PERSONAL_DATA_BASE / "persistence_test.txt"
 
352
  "disease_stage",
353
  "behaviour_tag", "emotion_tag", "topic_tag", "active_theme", "tts_on", "debug_mode"]
354
  return dict(zip(keys, args))
355
+
356
+ # NEW: MUST be consistent with collect_settings() defined above
357
+ def auto_setup_on_load(theme):
358
+ if not os.listdir(theme_upload_dir(theme)): seed_files_into_theme(theme)
359
+
360
+ # --- START: DEFINITIVE FIX ---
361
+ # This now provides the correct number and order of default settings.
362
+ settings = collect_settings(
363
+ "patient", # role
364
+ "", # patient_name
365
+ "", # caregiver_name
366
+ "warm", # tone
367
+ "English", # language
368
+ "English", # tts_lang
369
+ 0.7, # temperature
370
+ "Default: Mild Stage", # disease_stage <-- Correctly set
371
+ "None", # behaviour_tag
372
+ "None", # emotion_tag
373
+ "None", # topic_tag
374
+ "All", # active_theme <-- Correctly set
375
+ True, # tts_on
376
+ False # debug_mode
377
+ )
378
+ # --- END: DEFINITIVE FIX ---
379
+
380
+ files_ui, status = refresh_file_list_ui(theme)
381
+ return settings, files_ui, status
382
 
383
 
384
  # In app.py, replace the entire parse_and_tag_entries function.
 
786
  def refresh_file_list_ui(theme):
787
  files = list_theme_files(theme)
788
  return gr.update(choices=[f for f, _ in files], value=[f for f, en in files if en]), f"Found {len(files)} file(s)."
789
+
 
 
 
 
 
 
 
790
  def test_save_file():
791
  try:
792
  path = PERSONAL_DATA_BASE / "persistence_test.txt"