Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(reading): render study-guidance steps

XZH928be1e5f215
diff --git a/web/components/reading/ReadingExtensionBar.tsx b/web/components/reading/ReadingExtensionBar.tsx
index 4cf4c9c12..f068a1662 100644
--- a/web/components/reading/ReadingExtensionBar.tsx
+++ b/web/components/reading/ReadingExtensionBar.tsx
@@ -155,6 +155,9 @@ function ExtensionResult({
const items = Array.isArray(result.payload.items)
? result.payload.items.map(String)
: [];
+ const steps = Array.isArray(result.payload.steps)
+ ? result.payload.steps.map(String)
+ : [];
const body = String(result.payload.body || result.payload.overview || "");
return (
<section className="relative shrink-0 border-b border-[var(--border)] bg-[var(--card)] px-3 py-3 text-xs text-[var(--foreground)]">
@@ -173,11 +176,18 @@ function ExtensionResult({
{body ? <p className="mt-2 whitespace-pre-wrap">{body}</p> : null}
{items.length ? (
<ul className="mt-2 list-disc space-y-1 pl-5">
- {items.map((item) => (
- <li key={item}>{item}</li>
+ {items.map((item, index) => (
+ <li key={`${index}-${item}`}>{item}</li>
))}
</ul>
) : null}
+ {steps.length ? (
+ <ol className="mt-2 list-decimal space-y-1 pl-5">
+ {steps.map((step, index) => (
+ <li key={`${index}-${step}`}>{step}</li>
+ ))}
+ </ol>
+ ) : null}
{questions.map((question, index) => (
<div key={question.id || index} className="mt-3">
<p className="font-medium">{question.prompt}</p>
diff --git a/web/tests/reading-extensions.test.ts b/web/tests/reading-extensions.test.ts
index 6dfca0608..fa9b73a2d 100644
--- a/web/tests/reading-extensions.test.ts
+++ b/web/tests/reading-extensions.test.ts
@@ -51,3 +51,9 @@ test("the built-in study-guidance action is localized", () => {
assert.match(english, /"Guide me": "Guide me"/);
assert.match(chinese, /"Guide me": "引导我"/);
});
+
+test("study-guidance steps are visible in the result card", () => {
+ assert.match(component, /result\.payload\.steps/);
+ assert.match(component, /steps\.map\(\(step, index\) =>/);
+ assert.match(component, /list-decimal/);
+});