Spaces:
Sleeping
Sleeping
Update modules/task_management.py
Browse files- modules/task_management.py +24 -1
modules/task_management.py
CHANGED
@@ -189,4 +189,27 @@ def reset_weekly_data():
|
|
189 |
task_data.clear()
|
190 |
claimed_rewards.clear()
|
191 |
available_rewards.clear()
|
192 |
-
last_reset = datetime.date.today()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
task_data.clear()
|
190 |
claimed_rewards.clear()
|
191 |
available_rewards.clear()
|
192 |
+
last_reset = datetime.date.today()
|
193 |
+
|
194 |
+
|
195 |
+
def recall_from_memory(user_id, goal):
|
196 |
+
try:
|
197 |
+
query = user_id + ":" + goal.replace(" ", "_")
|
198 |
+
result = pine_index.fetch([query]) # β
returns a FetchResponse object
|
199 |
+
|
200 |
+
if query not in result.vectors:
|
201 |
+
return "β No saved plan found for this goal."
|
202 |
+
|
203 |
+
metadata = result.vectors[query].get("metadata", {})
|
204 |
+
steps = metadata.get("steps", [])
|
205 |
+
steps = [smart_label_converter(s) for s in steps if isinstance(s, str) and len(s.strip()) > 1]
|
206 |
+
summary = metadata.get("summary", "")
|
207 |
+
courses = metadata.get("courses", [])
|
208 |
+
course_section = ""
|
209 |
+
|
210 |
+
diagram = render_text_roadmap(goal, steps)
|
211 |
+
|
212 |
+
if courses:
|
213 |
+
course_section = "\n\n### π Recommended Courses\n" + "\n".join([f"- [{c['name']}]({c['url']})" for c in courses if 'name' in c and 'url' in c])
|
214 |
+
|
215 |
+
return f"""### π Recalled Plan for {goal}
|