Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -410,12 +410,11 @@ input, textarea {
|
|
410 |
|
411 |
|
412 |
def save_user_profile(nickname, weekly_goal):
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
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 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
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):
|