fix: restore model activity reasoning stream
This commit is contained in:
@@ -6,14 +6,22 @@ import { ModelActivityPanel } from "./ModelActivityPanel";
|
||||
|
||||
beforeEach(() => useSessionStore.getState().resetSession());
|
||||
|
||||
test("renders the streamed model transcript", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: "Promoting table dim_patient." });
|
||||
test("renders the streamed model activity", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "activity_delta", text: "Promoting table dim_patient." });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
expect(screen.getByText(/Promoting table dim_patient/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("does not treat final assistant text as model reasoning", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: "Final answer" });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
|
||||
expect(screen.queryByText("Final answer")).not.toBeInTheDocument();
|
||||
expect(screen.getByText("No activity yet.")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("renders markdown emphasis instead of literal asterisks", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: "Chiarimento su **fibrillazione atriale**." });
|
||||
useSessionStore.getState().applyEvent({ type: "activity_delta", text: "Chiarimento su **fibrillazione atriale**." });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
expect(screen.getByText("fibrillazione atriale").tagName).toBe("STRONG");
|
||||
});
|
||||
@@ -28,7 +36,7 @@ test("close button calls onClose", async () => {
|
||||
const EIGHT = ["para-01", "para-02", "para-03", "para-04", "para-05", "para-06", "para-07", "para-08"].join("\n\n");
|
||||
|
||||
test("collapsed shows only the last 5 paragraphs of the model-stream tail", () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: EIGHT });
|
||||
useSessionStore.getState().applyEvent({ type: "activity_delta", text: EIGHT });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
expect(screen.getByText("para-08")).toBeInTheDocument();
|
||||
expect(screen.getByText("para-04")).toBeInTheDocument();
|
||||
@@ -37,7 +45,7 @@ test("collapsed shows only the last 5 paragraphs of the model-stream tail", () =
|
||||
});
|
||||
|
||||
test("expanding reveals the full stream", async () => {
|
||||
useSessionStore.getState().applyEvent({ type: "text_delta", text: EIGHT });
|
||||
useSessionStore.getState().applyEvent({ type: "activity_delta", text: EIGHT });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
await userEvent.click(screen.getByRole("button", { name: /show more/i }));
|
||||
expect(screen.getByText("para-01")).toBeInTheDocument();
|
||||
@@ -46,7 +54,7 @@ test("expanding reveals the full stream", async () => {
|
||||
test("paragraphs stay separated as distinct blocks", () => {
|
||||
useSessionStore
|
||||
.getState()
|
||||
.applyEvent({ type: "text_delta", text: "Primo paragrafo.\n\nSecondo paragrafo." });
|
||||
.applyEvent({ type: "activity_delta", text: "Primo paragrafo.\n\nSecondo paragrafo." });
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
const first = screen.getByText("Primo paragrafo.");
|
||||
const second = screen.getByText("Secondo paragrafo.");
|
||||
@@ -58,7 +66,7 @@ test("paragraphs stay separated as distinct blocks", () => {
|
||||
|
||||
test("separates activity updates concatenated after sentence punctuation", () => {
|
||||
useSessionStore.getState().applyEvent({
|
||||
type: "text_delta",
|
||||
type: "activity_delta",
|
||||
text: "Ambiguità principale risolta.Finestra temporale risolta.Terza ambiguità risolta.",
|
||||
});
|
||||
render(<ModelActivityPanel onClose={vi.fn()} />);
|
||||
|
||||
Reference in New Issue
Block a user