+
-
{props.hint}
+
{props.hint}
);
}
diff --git a/src/components/rag/rag-study-panel.tsx b/src/components/rag/rag-study-panel.tsx
index f732724..a8c60cc 100644
--- a/src/components/rag/rag-study-panel.tsx
+++ b/src/components/rag/rag-study-panel.tsx
@@ -1,4 +1,4 @@
-import { For, Show, createSignal, onCleanup } from "solid-js";
+import { For, Show, createEffect, createSignal, on, onCleanup } from "solid-js";
import { formatApiError } from "@/api/client";
import type { RagMessage, RagThread } from "@/api/client";
import {
@@ -14,11 +14,12 @@ import { RagComposer } from "@/components/rag/rag-composer";
import { ragCopy } from "@/components/rag/rag-copy";
import { RagMessageRow } from "@/components/rag/rag-message-row";
import { RagStudyActions } from "@/components/rag/rag-study-actions";
+import { RagStudyWelcome } from "@/components/rag/rag-study-welcome";
import { RagThreadList } from "@/components/rag/rag-thread-list";
import { Alert } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import { ConfirmDialog } from "@/components/ui/confirm-dialog";
-import { IconEdit, IconPlus } from "@/components/ui/icons";
+import { IconBook, IconEdit, IconPlus } from "@/components/ui/icons";
import { scopeFromCitations } from "@/lib/rag-study-scope";
import { usePreferences } from "@/stores/preferences-context";
@@ -161,6 +162,25 @@ export function RagStudyPanel() {
}
};
+ // Follow the conversation: a new turn (or a streamed chunk) keeps the view
+ // on the latest message, unless the reader has scrolled up to reread.
+ let scroller: HTMLDivElement | undefined;
+ createEffect(
+ on(
+ () => {
+ const items = messages();
+ return `${items.length}:${items[items.length - 1]?.content.length ?? 0}`;
+ },
+ () => {
+ const el = scroller;
+ if (!el) return;
+ const nearBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 160;
+ if (nearBottom || sending()) queueMicrotask(() => el.scrollTo({ top: el.scrollHeight }));
+ },
+ { defer: true },
+ ),
+ );
+
/** The user turn an answer replies to, used as the study range's label. */
const questionBefore = (index: number) => {
for (let i = index - 1; i >= 0; i -= 1) if (messages()[i]?.role === "user") return messages()[i]!.content;
@@ -172,7 +192,7 @@ export function RagStudyPanel() {