refactor: update knowledge document types and API client interfaces

- Refactored types in `Knowledge/types.ts` to introduce new interfaces for document handling.
- Added `KnowledgeDocItem`, `KnowledgeDocsListResponse`, `KnowledgeDocsUploadInput`, `KnowledgeDocsUploadResponse`, and `KnowledgeDocsDeleteResponse` for better structure and clarity.
- Updated `KnowledgeDocsApiClient` interface to include methods for listing, uploading, and deleting documents.

fix: replace deprecated icons in AccountSettingsPanel and SettingMenu

- Replaced `CheckCircleIcon` with `CheckCircle` from `lucide-react` in `AccountSettingsPanel.tsx`.
- Updated `SettingMenu.tsx` to use `Settings` and `User` from `lucide-react` instead of custom icons.

test: add tests for knowledge docs routes and KnowledgePage

- Created `knowledge-docs-routes.test.ts` to test API routes for listing, uploading, and deleting knowledge documents.
- Added `knowledge-page.test.tsx` to test the rendering and functionality of the KnowledgePage component, including document loading and deletion.
This commit is contained in:
duanshuwen
2026-04-19 09:40:07 +08:00
parent 92ec3189bc
commit 5cc9b86e1f
20 changed files with 1752 additions and 1159 deletions

View File

@@ -0,0 +1,42 @@
export type KnowledgePageHeaderProps = {
title: string;
subtitle: string;
totalCount: number;
totalSize: string;
documentsLabel: string;
storageLabel: string;
};
export default function KnowledgePageHeader({
title,
subtitle,
totalCount,
totalSize,
documentsLabel,
storageLabel,
}: KnowledgePageHeaderProps) {
return (
<div className="mb-6 flex shrink-0 flex-col justify-between gap-4 md:flex-row md:items-start">
<div>
<h1
className="mb-3 text-5xl font-normal tracking-tight text-[#171717] dark:text-[#f3f4f6] md:text-6xl"
style={{ fontFamily: "Georgia, Cambria, 'Times New Roman', Times, serif" }}
>
{title}
</h1>
<p className="text-[17px] font-medium text-[#171717]/70 dark:text-gray-400">{subtitle}</p>
</div>
<div className="grid gap-3 sm:grid-cols-2 md:mt-2 md:min-w-[320px]">
<div className="rounded-[24px] bg-[#f4f7fb] px-5 py-4 dark:bg-[#222225]">
<div className="text-xs uppercase tracking-[0.18em] text-[#99A0AE] dark:text-gray-500">{documentsLabel}</div>
<div className="mt-3 text-3xl font-semibold text-[#171717] dark:text-[#f3f4f6]">{totalCount}</div>
</div>
<div className="rounded-[24px] bg-[#fff7ed] px-5 py-4 dark:bg-[#31251a]">
<div className="text-xs uppercase tracking-[0.18em] text-[#6b7280] dark:text-gray-400">{storageLabel}</div>
<div className="mt-3 text-3xl font-semibold text-[#171717] dark:text-[#f3f4f6]">{totalSize}</div>
</div>
</div>
</div>
);
}