This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run dev # Start development server with hot reload on port 3000
npm run test # Start test server on localhostnpm run build # Production build
npm run build:dev # Development build
npm run build:test # Test environment build
npm run build-demo # Demo environment build
npm run preview # Preview production build locallynpm run lint # Run ESLint
npm run lint:fix # Fix ESLint errors automatically
npm run format # Format code with Prettier
npm run format:check # Check if code is formatted correctly
npm run type-check # TypeScript type checking without emitting files
npm run quality # Run all checks: format, lint, and type-checkThis is a React TypeScript frontend application built with Vite, serving as a console/admin interface for an AI agent platform. The application follows a modern React architecture with several key patterns:
- Build Tool: Vite with React plugin
- UI Framework: React 18 with TypeScript
- Component Library: Ant Design (antd) 5.19.1
- Routing: React Router v6 with lazy loading
- State Management: Multiple approaches:
- Zustand for global state
- Recoil with persistence for some state
- Local component state with hooks
- Internationalization: i18next with browser language detection
- Authentication: Casdoor JS SDK for SSO authentication
- HTTP Client: Axios with comprehensive interceptors
- Uses Casdoor SDK for SSO authentication with PKCE flow
- Automatic token refresh with JWT expiration handling
- Request interceptors add authentication headers and space/enterprise context
- Multi-environment configuration support (development, test, production)
The application supports both personal and enterprise (team) spaces:
- Personal Space: Individual user workspace
- Enterprise Space: Team/organization workspace with enterprise-id context
- Space switching is handled through dedicated hooks and stores
- All API requests automatically include space-id and enterprise-id headers
- Supports Chinese (zh) and English (en) locales
- Language detection from browser and localStorage
- Dynamic language switching updates HTTP request headers
- Integrated with Ant Design's locale providers
/ # Root redirects to /home
/home # Home page
/management/ # Management section
├── bot-api # Bot API management
├── model # Model management
└── release # Release management
/space/ # Personal space management
/enterprise/:enterpriseId # Enterprise space management
/store/plugin # Plugin store
/chat/:botId/:version? # Chat interface
/work_flow/:id/arrange # Workflow editor
src/
├── components/ # Reusable UI components
├── pages/ # Route-based page components
├── layouts/ # Layout components (sidebar, header)
├── hooks/ # Custom React hooks
├── store/ # State management (Zustand/Recoil stores)
├── services/ # API service layer
├── utils/ # Utility functions
├── config/ # Configuration files
├── locales/ # i18n translations
├── styles/ # Global styles and Sass files
└── types/ # TypeScript type definitions
- Centralized Axios configuration with request/response interceptors
- Automatic token refresh handling
- Request deduplication to prevent duplicate API calls
- Comprehensive error handling with business logic error codes
- Environment-specific base URL configuration
- Support for file downloads with authentication headers
Multiple stores handle different domains:
user-store: User authentication and profile dataspace-store: Current space context (personal/enterprise)enterprise-store: Enterprise management dataglobal-store: Global application statechat-store: Chat interface state- And specialized stores for specific features
.env.development- Development environment.env.test- Test environment.env.production- Production environment
CONSOLE_CASDOOR_URL- Casdoor authentication server URLCONSOLE_CASDOOR_ID- Casdoor client IDCONSOLE_CASDOOR_APP- Casdoor application nameCONSOLE_CASDOOR_ORG- Casdoor organization nameVITE_BASE_URL- API base URLCONSOLE_API_URL- Console API URL override
Development server proxies API requests:
/xingchen-api→ Backend API server/chat-→ Chat service endpoints/workflow→ Workflow service endpoints
- Uses ESLint with TypeScript and React plugins
- Prettier for code formatting
- Strict TypeScript configuration with comprehensive type checking
- Path aliases:
@/*maps tosrc/*
- Monaco Editor: Code editing capabilities
- ReactFlow: Workflow visualization
- ECharts: Data visualization
- Markdown Rendering: Multiple markdown processors
- File Handling: Excel, image processing, QR codes
- Crypto: Encryption utilities for sensitive data
This architecture enables a scalable, maintainable frontend for managing AI agents, workflows, and enterprise collaboration features.