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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -8
app.py CHANGED
@@ -414,32 +414,34 @@ input, textarea {
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
421
- return f"Profile for **{nickname}** saved! Weekly goal: **{weekly_goal}**"
422
- else:
423
- return "❌ Failed to save profile."
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):
445
  # This function would use the RAG system to generate a roadmap
 
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
422
+ return f"Profile for **{nickname}** saved! Weekly goal: **{weekly_goal}**"
423
+ else:
424
+ return "❌ Failed to save profile."
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
  if "❌ No saved plan" in profile_result:
434
  return "", "", "❌ Profile not found in memory."
435
+
436
  lines = profile_result.splitlines()
437
  nickname_line = next((line for line in lines if "nickname" in line.lower()), "")
438
  goal_line = next((line for line in lines if "goal" in line.lower()), "")
439
  nickname = nickname_line.split(":")[-1].strip() if nickname_line else ""
440
  weekly_goal = goal_line.split(":")[-1].strip() if goal_line else ""
441
+
442
  return nickname, weekly_goal, "βœ… Loaded profile from memory."
443
 
444
+
445
 
446
  def generate_roadmap(goal, difficulty, pc, pine_index, client):
447
  # This function would use the RAG system to generate a roadmap