feat: 聊天室对话渲染增强 - 思考内容Markdown渲染 + 工具调用参数卡片化
This commit is contained in:
@@ -46,4 +46,32 @@ describe("ReasoningPart", () => {
|
||||
|
||||
expect(screen.getByText("思考中内容")).toBeTruthy();
|
||||
});
|
||||
|
||||
test("Markdown 代码块渲染(流式状态展开)", () => {
|
||||
const part = { state: "streaming", text: "```typescript\nconst x = 1;\n```", type: "reasoning" };
|
||||
|
||||
renderWithProviders(createElement(ReasoningPart, { part }));
|
||||
|
||||
expect(screen.getByText("const x = 1;")).toBeTruthy();
|
||||
expect(document.querySelector(".code-block")).toBeTruthy();
|
||||
});
|
||||
|
||||
test("Markdown 有序列表渲染(流式状态展开)", () => {
|
||||
const part = { state: "streaming", text: "1. 第一项\n2. 第二项", type: "reasoning" };
|
||||
|
||||
const { container } = renderWithProviders(createElement(ReasoningPart, { part }));
|
||||
|
||||
const ol = container.querySelector("ol");
|
||||
expect(ol).toBeTruthy();
|
||||
expect(screen.getByText("第一项")).toBeTruthy();
|
||||
});
|
||||
|
||||
test("Markdown 表格渲染(流式状态展开)", () => {
|
||||
const part = { state: "streaming", text: "| A | B |\n| --- | --- |\n| 1 | 2 |", type: "reasoning" };
|
||||
|
||||
renderWithProviders(createElement(ReasoningPart, { part }));
|
||||
|
||||
expect(screen.getByText("A")).toBeTruthy();
|
||||
expect(document.querySelector(".markdown-table")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user