Files
aiops/frontend
attacker b8cab7ed0f feat: AIOps智能助手接入真实LLM后端(OpenAI兼容代理+配置持久化)
后端:
- models/llm.go: LLMConfig模型(单行配置)+请求/响应struct
- handlers/llm.go: GetLLMConfig/SaveLLMConfig(脱敏+upsert)/Chat(OpenAI兼容代理)/TestLLMConnection
- routes.go: 注册 /aiops/llm-config(GET/PUT/test)+/aiops/chat(POST)
- database.go: AutoMigrate LLMConfig
- 支持OpenAI/DeepSeek/通义千问/Moonshot/Ollama/自定义6种提供商
- API Key脱敏(仅保留后4位)+回传脱敏值保留原值
- 优雅错误处理(连接超时/401/未配置均返回友好消息)
- 120s超时+AIOps运维助手默认系统提示词

前端:
- AIOpsAssistant.tsx: 全量重写接入真实后端
  · 配置弹窗从后端加载(持久化),提供商切换自动填充endpoint/模型
  · 启用开关+测试连接按钮+保存反馈
  · 真实对话(发送最近10条上下文),思考中spinner,错误红色气泡
  · 状态徽章(未配置/在线+模型名),新对话清空
- api.ts: aiApi替代mock aiAssistantApi(getConfig/saveConfig/testConnection/chat)

验证: tsc零错误+build通过+/health正常+前后端联调通过(配置CRUD+API Key脱敏+masked-key保留+chat错误优雅降级) // Logan.Li
2026-06-18 02:12:17 +08:00
..

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:

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...
    },
  },
])