Refactor Sidebar and AssistantPage components to enhance type definitions and user interaction

Updated the Sidebar component to include an optional className property in the icon type definition for better styling flexibility. In the AssistantPage, introduced new FastGptForm and DifyForm types, updated the assistant type options to reflect their availability, and enhanced the state management for creating and editing assistants. Improved the user experience by refining the view handling logic and adding dedicated forms for FastGPT and Dify configurations.
This commit is contained in:
Xin Wang
2026-06-08 11:11:10 +08:00
parent e2a0eedd63
commit 048c274bd1
2 changed files with 312 additions and 12 deletions

View File

@@ -26,7 +26,7 @@ type SidebarProps = {
const mainItems: Array<{
key: NavKey;
label: string;
icon: React.ComponentType<{ size?: number }>;
icon: React.ComponentType<{ size?: number; className?: string }>;
}> = [
{ key: "home", label: "首页", icon: Home },
{ key: "test", label: "测试助手", icon: PlayCircle },
@@ -35,7 +35,7 @@ const mainItems: Array<{
const componentSubItems: Array<{
key: NavKey;
label: string;
icon: React.ComponentType<{ size?: number }>;
icon: React.ComponentType<{ size?: number; className?: string }>;
}> = [
{ key: "components-models", label: "模型资源", icon: Brain },
{ key: "components-knowledge", label: "知识库", icon: Database },
@@ -45,7 +45,7 @@ const componentSubItems: Array<{
const monitorSubItems: Array<{
key: NavKey;
label: string;
icon: React.ComponentType<{ size?: number }>;
icon: React.ComponentType<{ size?: number; className?: string }>;
}> = [
{ key: "history", label: "历史记录", icon: Clock3 },
{ key: "dashboard", label: "数据看板", icon: Database },
@@ -294,7 +294,7 @@ function NavButton({
}: {
active: boolean;
collapsed: boolean;
icon: React.ComponentType<{ size?: number }>;
icon: React.ComponentType<{ size?: number; className?: string }>;
label: string;
onClick: () => void;
small?: boolean;