46 lines
2.0 KiB
Python
Executable File
46 lines
2.0 KiB
Python
Executable File
"""好奇心驱动的学习计划:元认知缺口 → 驱动力排序 → 价值观排序 → 周计划。"""
|
|
from __future__ import annotations
|
|
|
|
import time
|
|
from typing import Optional
|
|
|
|
from core.intrinsic_motivation import IntrinsicMotivation
|
|
from core.metacognition import Metacognition
|
|
from core.value_system import ValueSystem
|
|
|
|
WEEKDAYS = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
|
|
|
|
|
class LearningPlan:
|
|
def __init__(self, metacognition: Metacognition, motivation: IntrinsicMotivation,
|
|
values: ValueSystem):
|
|
self.metacognition = metacognition
|
|
self.motivation = motivation
|
|
self.values = values
|
|
|
|
def weekly_plan(self) -> dict:
|
|
scan = self.metacognition.scan()
|
|
gaps = [g["topic"] for g in scan["knowledge_gaps"]]
|
|
gaps += [w["domain"] for w in scan["weakest_domains"]
|
|
if w["domain"] not in gaps and w["certainty"] < 0.5]
|
|
drive_priority = self.motivation.levels.get("curiosity", 0.5)
|
|
scored = self.values.score_options([
|
|
{"name": topic, "impacts": {"curiosity": 0.5, "helpfulness": 0.3, "efficiency": 0.2}}
|
|
for topic in gaps
|
|
])
|
|
ordered = [o["name"] for o in scored]
|
|
schedule = {}
|
|
for i, day in enumerate(WEEKDAYS[:6]):
|
|
schedule[day] = ordered[i] if i < len(ordered) else "自由探索/复盘"
|
|
schedule["周日"] = "周复盘:检查缺口是否补齐,更新不确定地图"
|
|
return {"generated_at": time.time(), "drive_priority": round(drive_priority, 3),
|
|
"gaps": gaps, "schedule": schedule}
|
|
|
|
def daily_slice(self, plan: dict, weekday: str) -> Optional[str]:
|
|
return plan.get("schedule", {}).get(weekday)
|
|
|
|
def review(self, plan: dict, resolved_topics: list) -> dict:
|
|
for topic in resolved_topics:
|
|
self.metacognition.resolve_gap(topic)
|
|
remaining = [t for t in plan.get("gaps", []) if t not in resolved_topics]
|
|
return {"resolved": len(resolved_topics), "remaining": remaining} |