feat: implement task management store with IPC integration

- Added a new task store in `src-react/stores/task.ts` to manage tasks and their statuses.
- Implemented functions for creating, executing, and retrying tasks, along with handling task progress and completion.
- Introduced persistence for tasks using IPC.
- Created utility functions for normalizing room types and building subtasks.
- Added a new CSS file for global styles in `src-react/styles.css`.
- Created runtime types in `src-react/types/runtime.ts` and exported them.
- Updated the main entry points for Vue and React applications to support dynamic framework loading.
- Refactored chat model interfaces and utility functions into `src/shared/chat-model.ts`.
- Updated TypeScript configuration to include paths for React components and types.
- Enhanced Vite configuration to support both Vue and React frameworks.
This commit is contained in:
duanshuwen
2026-04-17 07:09:56 +08:00
parent d233b94b2a
commit b1dea9a5c2
68 changed files with 5910 additions and 397 deletions

View File

@@ -0,0 +1,32 @@
import { Navigate, Route, Routes } from 'react-router-dom';
import MainLayout from '../components/layout/MainLayout';
import HomePage from '../pages/Home';
import LoginPage from '../pages/Login';
import AgentsPage from '../pages/Agents';
import SkillsPage from '../pages/Skills';
import CronPage from '../pages/Cron';
import ScriptsPage from '../pages/Scripts';
import SettingPage from '../pages/Setting';
import KnowledgePage from '../pages/Knowledge';
import { DEFAULT_PATH } from './routes';
export function AppRouter() {
return (
<Routes>
<Route path="/" element={<Navigate to={DEFAULT_PATH} replace />} />
<Route path="/login" element={<LoginPage />} />
<Route element={<MainLayout />}>
<Route path="/home" element={<HomePage />} />
<Route path="/agents" element={<AgentsPage />} />
<Route path="/skills" element={<SkillsPage />} />
<Route path="/cron" element={<CronPage />} />
<Route path="/scripts" element={<ScriptsPage />} />
<Route path="/setting" element={<SettingPage />} />
<Route path="/knowledge" element={<KnowledgePage />} />
</Route>
<Route path="*" element={<Navigate to={DEFAULT_PATH} replace />} />
</Routes>
);
}

View File

@@ -0,0 +1,44 @@
export type AppPath =
| '/home'
| '/agents'
| '/skills'
| '/cron'
| '/scripts'
| '/setting'
| '/knowledge'
| '/login';
export type WorkspacePath = Exclude<AppPath, '/login'>;
export type NavItem = {
path: WorkspacePath;
label: string;
description: string;
};
export const DEFAULT_PATH: WorkspacePath = '/home';
export const NAV_ITEMS: NavItem[] = [
{ path: '/home', label: '首页', description: '对话与首页入口' },
{ path: '/knowledge', label: '知识库', description: '知识库与内容管理' },
{ path: '/agents', label: '模型', description: '智能体与提供方' },
{ path: '/skills', label: '技能', description: '技能与能力集' },
{ path: '/cron', label: '定时任务', description: '计划与调度' },
{ path: '/scripts', label: '脚本', description: '脚本与自动化' },
{ path: '/setting', label: '设置', description: '应用配置' },
];
export function normalizeWorkspacePath(pathname: string): WorkspacePath {
switch (pathname) {
case '/knowledge':
case '/agents':
case '/skills':
case '/cron':
case '/scripts':
case '/setting':
return pathname;
case '/home':
default:
return DEFAULT_PATH;
}
}