46a10ba091
后端: - assessment-template entity: attemptLimit/scheduledStart/End/reviewMode/shuffleQuestions - DTO 更新: 新增 P2 字段验证 - startSession: 尝试次数检查、预约时段检查、题目随机排序 - getSessionState: reviewMode 控制答案可见性 - 新增 GET /assessment/:id/review 回顾端点 前端: - AssessmentTemplateManager: 新增尝试次数/答题回顾/题目排序/预约时段配置 - AssessmentView: 答题回顾按钮(完成页)+提交确认弹窗+标记回头功能 - types.ts: 新增 P2 字段类型 - assessmentService: 新增 getReview 方法 - 进度导航点: 可视化题序+标记状态 测试 20项全部通过 + 系统测试 142项全部通过 ✅ Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
AuraK V2 — Frontend (web)
A modern multi-tenant knowledge base and AI assistant platform built with React 19, Vite, and Tailwind CSS.
🏗️ Architecture
The frontend uses React Router for navigation with a clean role-based routing structure:
| Route | Access | Description |
|---|---|---|
/login |
Public | Password or API Key sign-in |
/ |
All users | Workspace overview |
/chat |
All users | AI Chat with scope selection |
/knowledge |
All users | Document (Knowledge Base) management |
/notebooks |
All users | Notebooks and notes |
/settings |
All users | Model and app settings |
/admin |
TENANT_ADMIN+ | Team management, share approvals |
/admin/tenants |
SUPER_ADMIN | Global tenant management |
/admin/models |
TENANT_ADMIN+ | Model configuration |
🔐 Authentication
The app supports two login methods:
- Password login — POST to
/api/v1/auth/login, receives anapiKeyback - Direct API Key — paste the API key directly
All API calls include x-api-key: <key> in the request headers automatically via services/apiClient.ts.
🛠️ Tech Stack
- React 19 + TypeScript
- Vite (dev server + build)
- TailwindCSS v3 (styling)
- React Router v6 (routing)
- framer-motion (animations)
- Lucide React (icons)
- clsx + tailwind-merge (
cn()utility)
🚀 Quick Start
1. Install dependencies
cd web
yarn install
2. Configure environment
Copy .env.example to .env and set the backend URL if needed:
VITE_API_BASE_URL=http://localhost:13000
The Vite dev server proxies /api/* to http://localhost:13000 by default (see vite.config.ts).
3. Start the dev server
yarn dev
# → http://localhost:13001
4. Build for production
yarn build
# Output: dist/
📁 Project Structure
web/
├── index.tsx # App root — BrowserRouter + all routes
├── index.html
├── src/
│ ├── contexts/
│ │ └── AuthContext.tsx # User auth state (apiKey, user, role)
│ ├── components/
│ │ └── layouts/
│ │ ├── WorkspaceLayout.tsx # Sidebar + header for main workspace
│ │ └── AdminLayout.tsx # Admin console layout
│ ├── pages/
│ │ ├── auth/
│ │ │ └── Login.tsx # Dual-mode login (password + API key)
│ │ ├── workspace/
│ │ │ ├── ChatPage.tsx
│ │ │ ├── KnowledgePage.tsx
│ │ │ ├── NotebooksPage.tsx
│ │ │ └── SettingsPage.tsx
│ │ └── admin/
│ │ ├── SuperAdminPage.tsx # Tenant management (SUPER_ADMIN)
│ │ └── TenantAdminPage.tsx # Team management (TENANT_ADMIN)
│ └── utils/
│ └── cn.ts # clsx + twMerge helper
├── components/ # Legacy rich view components (still used)
│ └── views/
│ ├── ChatView.tsx
│ ├── KnowledgeBaseView.tsx
│ ├── NotebooksView.tsx
│ └── SettingsView.tsx
└── services/ # API service layer
├── apiClient.ts # Base HTTP client (auto-injects x-api-key)
├── chatService.ts # Streaming chat
├── knowledgeBaseService.ts
└── ...
🔑 Default Credentials (Development)
After running the backend migration, a default super admin is seeded:
- Email:
admin@system.local - Password:
admin123
The /api/v1/auth/api-key endpoint returns your API key after login.
⚠️ Troubleshooting
- 401 errors: Your session expired. You will be redirected to
/loginautomatically. - Upload fails: Ensure the backend is running and the
uploads/directory is writable. - No AI response: Configure at least one LLM model in
/settingsor/admin/models.