Scaffold web frontend: mock-backed chat + PDF split-view, Tailwind/shadcn

This commit is contained in:
2026-07-31 12:16:47 +07:00
parent b72d4bf9d9
commit 967b917001
43 changed files with 5192 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
export {};
export * from "./sendChatMessage";
+26
View File
@@ -0,0 +1,26 @@
import type { SendMessageResponse } from "@duoc-thu/shared-types";
let nextId = 1;
export function buildMockResponse(userContent: string): SendMessageResponse {
const id = String(nextId++);
return {
message: {
id,
role: "assistant",
content:
`(Mock) Paracetamol được chỉ định để giảm đau, hạ sốt. Liều thường dùng ở người ` +
`lớn là 500-1000mg mỗi 4-6 giờ, tối đa 4g/ngày. Đây là dữ liệu giả lập cho câu hỏi: "${userContent}".`,
citations: [
{
drugName: "PARACETAMOL",
sectionType: "lieu_dung",
sourcePageRange: [412, 413],
},
],
disclaimer:
"Câu trả lời chỉ mang tính tham khảo, không thay thế chỉ định của bác sĩ hoặc dược sĩ.",
createdAt: new Date().toISOString(),
},
};
}
@@ -0,0 +1,9 @@
import type { SendMessageResponse } from "@duoc-thu/shared-types";
import { buildMockResponse } from "./mockFixtures";
const MOCK_LATENCY_MS = 400;
export async function sendChatMessage(content: string): Promise<SendMessageResponse> {
await new Promise((resolve) => setTimeout(resolve, MOCK_LATENCY_MS));
return buildMockResponse(content);
}