@bojackduy/opencode-learn 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server.js +302 -141
- package/dist/tui.js +14 -14
- package/package.json +2 -2
- package/plugins/learn.ts +266 -106
package/dist/tui.js
CHANGED
|
@@ -453,14 +453,14 @@ function QuizDialog(props) {
|
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
455
|
setSelected(m);
|
|
456
|
-
const
|
|
456
|
+
const correct = computeCorrect(eff);
|
|
457
457
|
setFeedback({
|
|
458
|
-
correct
|
|
458
|
+
correct,
|
|
459
459
|
selectedIndices: eff
|
|
460
460
|
});
|
|
461
461
|
if (reason)
|
|
462
462
|
setNote((prev) => prev ? `${prev} \u2014 ${reason}` : prev);
|
|
463
|
-
tlog("QuizDialog classify done", eff.join(","),
|
|
463
|
+
tlog("QuizDialog classify done", eff.join(","), correct, reason || "");
|
|
464
464
|
} else if (inferredValues && inferredValues.length) {
|
|
465
465
|
const byVal = new Map(options().map((o, i) => [o.value, i + 1]));
|
|
466
466
|
let idxs = inferredValues.map((v) => byVal.get(v)).filter(Boolean);
|
|
@@ -480,15 +480,15 @@ function QuizDialog(props) {
|
|
|
480
480
|
});
|
|
481
481
|
}
|
|
482
482
|
setSelected(m);
|
|
483
|
-
const
|
|
483
|
+
const correct = computeCorrect(idxs);
|
|
484
484
|
setFeedback({
|
|
485
|
-
correct
|
|
485
|
+
correct,
|
|
486
486
|
selectedIndices: idxs
|
|
487
487
|
});
|
|
488
488
|
} else {
|
|
489
|
-
const
|
|
489
|
+
const correct = typeof semanticCorrect === "boolean" ? semanticCorrect : false;
|
|
490
490
|
setFeedback({
|
|
491
|
-
correct
|
|
491
|
+
correct,
|
|
492
492
|
selectedIndices: []
|
|
493
493
|
});
|
|
494
494
|
if (reason)
|
|
@@ -1722,13 +1722,13 @@ function QuizBatchDialog(props) {
|
|
|
1722
1722
|
if (eff.length !== inferred.length)
|
|
1723
1723
|
tlog("QuizBatchDialog classify enforce single", inferred.join(","), "->", eff.join(","));
|
|
1724
1724
|
const mm = new Map;
|
|
1725
|
-
for (const
|
|
1726
|
-
const opt = cur().options[
|
|
1725
|
+
for (const idx of eff) {
|
|
1726
|
+
const opt = cur().options[idx - 1];
|
|
1727
1727
|
if (opt)
|
|
1728
|
-
mm.set(`opt:${
|
|
1728
|
+
mm.set(`opt:${idx - 1}`, {
|
|
1729
1729
|
label: opt.label,
|
|
1730
1730
|
value: opt.value,
|
|
1731
|
-
index:
|
|
1731
|
+
index: idx
|
|
1732
1732
|
});
|
|
1733
1733
|
}
|
|
1734
1734
|
setSelected(mm);
|
|
@@ -2667,12 +2667,12 @@ var tui = async (api) => {
|
|
|
2667
2667
|
data.sessionID = curSid;
|
|
2668
2668
|
try {
|
|
2669
2669
|
const cur = api.route?.current;
|
|
2670
|
-
const
|
|
2671
|
-
if (
|
|
2670
|
+
const curSid = cur?.params?.sessionID || cur?.sessionID;
|
|
2671
|
+
if (curSid && data.sessionID && data.sessionID !== curSid) {
|
|
2672
2672
|
const anyState = api.state;
|
|
2673
2673
|
const exists = anyState.session?.get ? anyState.session.get(data.sessionID) : undefined;
|
|
2674
2674
|
if (!exists)
|
|
2675
|
-
data.sessionID =
|
|
2675
|
+
data.sessionID = curSid;
|
|
2676
2676
|
}
|
|
2677
2677
|
} catch {}
|
|
2678
2678
|
current = {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@bojackduy/opencode-learn",
|
|
4
|
-
"version": "1.2.
|
|
5
|
-
"description": "Pi learn system for OpenCode
|
|
4
|
+
"version": "1.2.3",
|
|
5
|
+
"description": "Pi learn system for OpenCode — Socratic teaching, graded quiz, Obsidian md_log, and visual makers. Port of amosblomqvist/learn (video: How I Use AI to Learn Things) to OpenCode.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "AGPL-3.0-or-later",
|
|
8
8
|
"private": false,
|