AIOpsAssistant.tsx (505L) → 288L (-43%) 提取 5 个独立文件到 aiops-assistant/ 子目录: - types.ts (39L): Message/QuickAction 接口 + defaultConfig + fmtTime - context-loaders.ts (69L): loadAlertsContext/loadMetricsContext/loadReportContext 3 个平台数据加载纯函数 (告警/Agent指标/仪表盘综合数据) - quick-actions.tsx (17L): quickActions 数组 (4 快捷操作) - ChatMessage.tsx (47L): 消息气泡 (streaming/thinking/error 三态 + 光标) - AssistantSidebar.tsx (76L): 快捷操作卡片 + 能力清单卡片 验证: tsc -b=0, npm build✓ (17.68s), ESLint errors=0/any=0, go build=0, 17/17 集成测试通过
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel (or oxc when used in rolldown-vite) for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])