Refactor UUID generation, remove unused logger and encryption utilities, and clean up request handling

- Updated `generateUUID` function for improved readability and performance.
- Deleted `logger.ts`, `other.ts`, `request.ts`, `storage.ts`, `tansParams.ts`, and `validate.ts` as they were no longer needed.
- Simplified TypeScript configuration by removing unnecessary paths and aliases.
- Enhanced Vite configuration for better project structure and maintainability.
This commit is contained in:
DEV_DSW
2026-04-17 15:38:08 +08:00
parent b1dea9a5c2
commit 79bea4f107
360 changed files with 14495 additions and 30856 deletions

View File

@@ -0,0 +1,23 @@
import { Outlet } from 'react-router-dom';
import Sidebar from './Sidebar';
import TitleBar from './TitleBar';
export default function MainLayout() {
const platform = (window as any).api?.platform ?? '';
return (
<div className="bg-white dark:!bg-[#0f0f10] h-screen flex flex-col">
<TitleBar />
<main
className="box-border w-full flex pt-2 pb-2 pl-2"
style={{ height: platform === 'linux' ? '100vh' : 'calc(100vh - 40px)' }}
>
<div className="flex-1 flex min-w-0 min-h-0">
<Outlet />
</div>
<Sidebar />
</main>
</div>
);
}

View File

@@ -0,0 +1,67 @@
import { useLocation, useNavigate } from 'react-router-dom';
import { NAV_ITEMS, normalizeWorkspacePath } from '../../router/routes';
const MENU_MARKS: Record<string, string> = {
'/home': '首',
'/knowledge': '知',
'/agents': '模',
'/skills': '技',
'/cron': '时',
'/scripts': '脚',
'/setting': '设',
};
export default function Sidebar() {
const location = useLocation();
const navigate = useNavigate();
const currentId = normalizeWorkspacePath(location.pathname);
return (
<aside className="w-[80px] h-full box-border flex flex-col items-center pb-[8px]">
<div className="flex flex-col gap-[16px] w-full">
{NAV_ITEMS.map((item) => {
const active = currentId === item.path;
const isSetting = item.path === '/setting';
return (
<div
key={item.path}
className={['flex flex-col gap-[16px]', isSetting ? 'mt-auto mb-[8px] shrink-1' : ''].join(' ')}
>
<button
type="button"
className="cursor-pointer flex flex-col items-center justify-center"
onClick={() => navigate(item.path)}
>
<div
className={[
'box-border rounded-[16px] w-[48px] h-[48px] flex flex-col items-center justify-center hover:bg-white dark:hover:bg-[#222225]',
active ? 'bg-white dark:bg-[#222225]' : '',
].join(' ')}
>
<span
className="text-[18px] font-semibold leading-none"
style={{ color: active ? '#2B7FFF' : '#525866' }}
>
{MENU_MARKS[item.path]}
</span>
</div>
<div
className="text-[14px] mt-[4px] mb-[8px] hover:text-[#2B7FFF]"
style={{ color: active ? '#2B7FFF' : '#525866' }}
>
{item.label}
</div>
</button>
</div>
);
})}
</div>
<div className="w-[48px] h-[48px] rounded-full overflow-hidden mt-auto bg-white dark:bg-[#222225] flex items-center justify-center border border-black/10 dark:border-[#2a2a2d]">
<span className="text-[16px] font-bold text-[#2B7FFF]">Z</span>
</div>
</aside>
);
}

View File

@@ -0,0 +1,71 @@
type TitleBarProps = {
variant?: 'default' | 'light';
};
export default function TitleBar({ variant = 'default' }: TitleBarProps) {
const platform = (window as any).api?.platform ?? '';
if (platform === 'linux') return null;
const iconColorClass =
variant === 'light' ? 'text-white' : 'text-[#525866] dark:text-gray-300';
const borderColorClass =
variant === 'light' ? 'border-b-white/30' : 'border-b-gray-300 dark:border-gray-700';
if (platform === 'darwin') {
return (
<div
className={['drag-region h-10 shrink-0 border-b', borderColorClass].join(' ')}
style={{ background: 'transparent' }}
/>
);
}
return (
<div
className={['drag-region flex h-10 shrink-0 items-center justify-end border-b', borderColorClass].join(
' ',
)}
style={{ background: 'transparent' }}
>
<div className="no-drag flex h-full">
<button
type="button"
className={['flex h-full w-11 items-center justify-center hover:bg-[#999] hover:text-white transition-colors', iconColorClass].join(
' ',
)}
title="Minimize"
onClick={() => {
(window as any).api?.windowMinimize?.();
}}
>
<span className="text-base leading-none"></span>
</button>
<button
type="button"
className={['flex h-full w-11 items-center justify-center hover:bg-[#999] hover:text-white transition-colors', iconColorClass].join(
' ',
)}
title="Maximize"
onClick={() => {
(window as any).api?.windowMaximize?.();
}}
>
<span className="text-[14px] leading-none"></span>
</button>
<button
type="button"
className={['flex h-full w-11 items-center justify-center hover:bg-[#ff0000] hover:text-white transition-colors', iconColorClass].join(
' ',
)}
title="Close"
onClick={() => {
(window as any).api?.windowClose?.();
}}
>
<span className="text-base leading-none">×</span>
</button>
</div>
</div>
);
}

View File

@@ -0,0 +1,3 @@
export { default as MainLayout } from './MainLayout';
export { default as Sidebar } from './Sidebar';
export { default as TitleBar } from './TitleBar';