rivapereira123 commited on
Commit
40c605f
Β·
verified Β·
1 Parent(s): 3b25ffa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -24
app.py CHANGED
@@ -410,12 +410,11 @@ input, textarea {
410
 
411
 
412
  def save_user_profile(nickname, weekly_goal):
413
- user_id = nickname.lower().replace(" ", "_")
414
- summary = f"User profile: {nickname}, goal: {weekly_goal}"
415
- steps = [] # optional placeholder
416
- courses = [] # optional placeholder
417
-
418
- success = save_to_memory(user_id, "profile", summary, steps, courses)
419
 
420
  if success:
421
  user_id_state.value = user_id
@@ -425,24 +424,21 @@ input, textarea {
425
 
426
 
427
  def load_user_profile():
428
- user_id = user_id_state.value
429
- if not user_id:
430
- return "", "", "❌ No user loaded."
431
-
432
- profile_result = recall_from_memory(user_id, "profile")
433
-
434
- if "❌ No saved plan" in profile_result:
435
- return "", "", "❌ Profile not found in memory."
436
-
437
- # Extract nickname & weekly goal from summary string
438
- lines = profile_result.splitlines()
439
- nickname_line = next((line for line in lines if "nickname" in line.lower()), "")
440
- goal_line = next((line for line in lines if "goal" in line.lower()), "")
441
-
442
- nickname = nickname_line.split(":")[-1].strip() if nickname_line else ""
443
- weekly_goal = goal_line.split(":")[-1].strip() if goal_line else ""
444
-
445
- return nickname, weekly_goal, "βœ… Loaded profile from memory."
446
 
447
 
448
  def generate_roadmap(goal, difficulty, pc, pine_index, client):
 
410
 
411
 
412
  def save_user_profile(nickname, weekly_goal):
413
+ user_id = nickname.lower().replace(" ", "_")
414
+ summary = f"User profile: {nickname}, goal: {weekly_goal}"
415
+ steps = [] # optional placeholder
416
+ courses = [] # optional placeholder
417
+ success = save_to_memory(user_id, "profile", summary, steps, courses)
 
418
 
419
  if success:
420
  user_id_state.value = user_id
 
424
 
425
 
426
  def load_user_profile():
427
+ user_id = user_id_state.value
428
+ if not user_id:
429
+ return "", "", "❌ No user loaded."
430
+
431
+ profile_result = recall_from_memory(user_id, "profile")
432
+ if "❌ No saved plan" in profile_result:
433
+ return "", "", "❌ Profile not found in memory."
434
+
435
+ lines = profile_result.splitlines()
436
+ nickname_line = next((line for line in lines if "nickname" in line.lower()), "")
437
+ goal_line = next((line for line in lines if "goal" in line.lower()), "")
438
+ nickname = nickname_line.split(":")[-1].strip() if nickname_line else ""
439
+ weekly_goal = goal_line.split(":")[-1].strip() if goal_line else ""
440
+
441
+ return nickname, weekly_goal, "βœ… Loaded profile from memory."
 
 
 
442
 
443
 
444
  def generate_roadmap(goal, difficulty, pc, pine_index, client):