Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
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
|