mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-06-17 21:50:15 +08:00
### 性能优化 - 后端任务执行从串行锁改为 ThreadPoolExecutor 并发执行(默认3线程) - 添加 GZipMiddleware 响应压缩 + Nginx gzip 配置 - 数据库连接池参数优化(pool_size=10, max_overflow=20) - 视频帧提取并行化(ThreadPoolExecutor) - LLM 重试配置缓存到实例,避免每次请求读 env var - 前端路由级代码拆分(React.lazy + Suspense) - Vite manualChunks 拆分 markdown/markmap/vendor - MarkdownViewer 用 React.memo + useMemo 减少不必要渲染 - NoteHistory Fuse.js 实例 useMemo 缓存 - useTaskPolling 无待处理任务时跳过轮询 - 移除 antd 依赖(NoteForm Alert、modelForm Tag),改用 shadcn/ui ### 前端转写器配置(新功能) - 新增 TranscriberConfigManager(JSON 文件存储,替代环境变量) - 新增 GET/POST /transcriber_config API 端点 - 新增 GET /transcriber_models_status 模型下载状态查询 - 新增 POST /transcriber_download 后台模型下载触发 - 前端转写器设置页面:引擎选择、模型大小选择、模型下载管理 - deploy_status 端点同步从配置文件读取 ### Bug 修复 - 修复任务进行中切换页面后进度丢失:Home.tsx status 派生逻辑补全中间状态 - 修复 MLX Whisper 静默回退 fast-whisper:移除环境变量门控,macOS 下自动尝试导入 - MLX Whisper 不可用时抛出 RuntimeError 而非静默回退 - 前端展示 MLX Whisper 可用性状态,不可用时禁用保存 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74 lines
2.9 KiB
TypeScript
74 lines
2.9 KiB
TypeScript
import './App.css'
|
|
import { lazy, Suspense, useEffect } from 'react'
|
|
import { BrowserRouter, Navigate, Routes, Route } from 'react-router-dom'
|
|
import { useTaskPolling } from '@/hooks/useTaskPolling.ts'
|
|
import { useCheckBackend } from '@/hooks/useCheckBackend.ts'
|
|
import { systemCheck } from '@/services/system.ts'
|
|
import BackendInitDialog from '@/components/BackendInitDialog'
|
|
import Index from '@/pages/Index.tsx'
|
|
import { HomePage } from './pages/HomePage/Home.tsx'
|
|
|
|
// 非首屏页面使用 React.lazy 按需加载
|
|
const SettingPage = lazy(() => import('./pages/SettingPage/index.tsx'))
|
|
const Model = lazy(() => import('@/pages/SettingPage/Model.tsx'))
|
|
const ProviderForm = lazy(() => import('@/components/Form/modelForm/Form.tsx'))
|
|
const AboutPage = lazy(() => import('@/pages/SettingPage/about.tsx'))
|
|
const Monitor = lazy(() => import('@/pages/SettingPage/Monitor.tsx'))
|
|
const Downloader = lazy(() => import('@/pages/SettingPage/Downloader.tsx'))
|
|
const DownloaderForm = lazy(() => import('@/components/Form/DownloaderForm/Form.tsx'))
|
|
const TranscriberPage = lazy(() => import('@/pages/SettingPage/transcriber.tsx'))
|
|
const NotFoundPage = lazy(() => import('@/pages/NotFoundPage'))
|
|
|
|
function App() {
|
|
useTaskPolling(3000) // 每 3 秒轮询一次
|
|
const { loading, initialized } = useCheckBackend()
|
|
|
|
// 在后端初始化完成后执行系统检查
|
|
useEffect(() => {
|
|
if (initialized) {
|
|
systemCheck()
|
|
}
|
|
}, [initialized])
|
|
|
|
// 如果后端还未初始化,显示初始化对话框
|
|
if (!initialized) {
|
|
return (
|
|
<>
|
|
<BackendInitDialog open={loading} />
|
|
</>
|
|
)
|
|
}
|
|
|
|
// 后端已初始化,渲染主应用
|
|
return (
|
|
<>
|
|
<BrowserRouter>
|
|
<Suspense fallback={<div className="flex h-screen items-center justify-center">加载中…</div>}>
|
|
<Routes>
|
|
<Route path="/" element={<Index />}>
|
|
<Route index element={<HomePage />} />
|
|
<Route path="settings" element={<SettingPage />}>
|
|
<Route index element={<Navigate to="model" replace />} />
|
|
<Route path="model" element={<Model />}>
|
|
<Route path="new" element={<ProviderForm isCreate />} />
|
|
<Route path=":id" element={<ProviderForm />} />
|
|
</Route>
|
|
<Route path="download" element={<Downloader />}>
|
|
<Route path=":id" element={<DownloaderForm />} />
|
|
</Route>
|
|
<Route path="transcriber" element={<TranscriberPage />} />
|
|
<Route path="monitor" element={<Monitor />}></Route>
|
|
<Route path="about" element={<AboutPage />}></Route>
|
|
<Route path="*" element={<NotFoundPage />} />
|
|
</Route>
|
|
<Route path="*" element={<NotFoundPage />} />
|
|
</Route>
|
|
</Routes>
|
|
</Suspense>
|
|
</BrowserRouter>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default App
|