diff --git a/.cursor/rules/project.mdc b/.cursor/rules/project.mdc index b4b99bb5834..7e86f01780b 100644 --- a/.cursor/rules/project.mdc +++ b/.cursor/rules/project.mdc @@ -12,7 +12,7 @@ This is an AI API gateway/proxy built with Go. It aggregates 40+ upstream AI pro ## Tech Stack - **Backend**: Go 1.22+, Gin web framework, GORM v2 ORM -- **Frontend**: React 18, Vite, Semi Design UI (@douyinfe/semi-ui) +- **Frontend**: React 18, Vite, Hero UI (@heroui/react) with compatibility wrappers - **Databases**: SQLite, MySQL, PostgreSQL (all three must be supported) - **Cache**: Redis (go-redis) + in-memory cache - **Auth**: JWT, WebAuthn/Passkeys, OAuth (GitHub, Discord, OIDC, etc.) diff --git a/.gitignore b/.gitignore index c17652a21a3..3e0f152379f 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,12 @@ tiktoken_cache web/bun.lock plans .claude +.playwright-mcp +*.png +*.jpg +*.jpeg +!web/public/**/*.png +!web/public/**/*.jpg electron/node_modules electron/dist diff --git a/AGENTS.md b/AGENTS.md index cd1756d5566..acc88c20cb1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -7,7 +7,7 @@ This is an AI API gateway/proxy built with Go. It aggregates 40+ upstream AI pro ## Tech Stack - **Backend**: Go 1.22+, Gin web framework, GORM v2 ORM -- **Frontend**: React 18, Vite, Semi Design UI (@douyinfe/semi-ui) +- **Frontend**: React 18, Vite, Hero UI (@heroui/react) with compatibility wrappers - **Databases**: SQLite, MySQL, PostgreSQL (all three must be supported) - **Cache**: Redis (go-redis) + in-memory cache - **Auth**: JWT, WebAuthn/Passkeys, OAuth (GitHub, Discord, OIDC, etc.) diff --git a/CLAUDE.md b/CLAUDE.md index f0385a574bc..3b576e48199 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,7 +7,7 @@ This is an AI API gateway/proxy built with Go. It aggregates 40+ upstream AI pro ## Tech Stack - **Backend**: Go 1.22+, Gin web framework, GORM v2 ORM -- **Frontend**: React 18, Vite, Semi Design UI (@douyinfe/semi-ui) +- **Frontend**: React 18, Vite, Hero UI (@heroui/react) with compatibility wrappers - **Databases**: SQLite, MySQL, PostgreSQL (all three must be supported) - **Cache**: Redis (go-redis) + in-memory cache - **Auth**: JWT, WebAuthn/Passkeys, OAuth (GitHub, Discord, OIDC, etc.) diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000000..73bf409cd8a --- /dev/null +++ b/TODO.md @@ -0,0 +1,337 @@ +# TODO + +## HeroUI Migration + +- [x] Start local dev environment at `http://localhost:5173/`. +- [x] Refresh current Semi compatibility wrapper inventory. +- [x] Continue migrating low-risk settings containers away from `@/components/ui/semi`. +- [x] Re-scan remaining Semi wrapper imports after each migration batch. +- [x] Verify frontend build or targeted lint before handoff. +- [x] Migrate second low-risk batch: `ParamOverrideEntry`, `ThinkingContent`, `ImageUrlInput`, `ModelPricingCombined`, `ChatsSetting`. +- [x] Migrate third low-risk settings batch: `DashboardSetting`, `ModelDeploymentSetting`, `OperationSetting`. +- [x] Migrate personal settings batch: `PreferencesSettings`, `EmailBindModal`, `WeChatBindModal`, `ChangePasswordModal`, `PersonalSetting`. +- [x] Migrate fifth low-risk batch: `AccountDeleteModal`, `UserInfoHeader`, and native language selector cleanup in `PreferencesSettings`. +- [x] Migrate playground batch: `ConfigManager`, `CustomRequestEditor`. +- [x] Migrate SSE viewer: `SSEViewer`. +- [x] Migrate playground controls: `ParameterControl`, `SettingsPanel`. +- [x] Complete playground direct migration: `DebugPanel`, `ChatArea`, `MessageContent`, `pages/Playground/index.jsx`. +- [x] Remove playground Semi token references: `CodeViewer`, `CustomInputRender`. +- [x] Complete settings direct migration: settings files now import Hero compatibility entrypoints instead of `@/components/ui/semi*`. +- [x] Remove settings Semi token references. +- [x] Complete table direct migration: table files now import Hero compatibility entrypoints instead of `@/components/ui/semi*`. +- [x] Remove table and table-hook Semi token references. +- [x] Complete other business migration: `topup` and `helpers` now import Hero compatibility entrypoints. +- [x] Remove all remaining Semi token references. +- [x] Delete unused deep typography shims under `web/src/components/ui/semi/lib/es/typography/`. +- [x] Start true HeroUI cleanup: `SubscriptionPlansCard` no longer uses `HeroCompat` and now uses HeroUI `Card.Content`, `Chip`, `Separator`, native select, and lightweight skeletons. +- [x] Continue pricing cleanup: `PricingCardSkeleton`, `PricingCardView`, and `FilterModalFooter` moved away from old Skeleton/Tag/Button props. +- [x] Fix console layout root causes: Console pages hide footer, main content scrolls, Console routes remount by path/search, settings tabs use controlled native buttons. +- [x] Rewrite Operation/SettingsHeaderNavModules + SettingsSidebarModulesAdmin to native HeroUI v3 (CSS Grid, native Switch+Control+Thumb, Button isPending). +- [x] Fix semi.js Spin/Switch/Col/Form/Banner compat bugs that were silently breaking page layouts (collapsed grids, invisible toggles, missing banner descriptions, infinite re-render loops). +- [x] Stabilize useTableFilterForm api ref to fix infinite update loop on /console/token. +- [x] Map semi-icons string sizes (small/default/large) to numeric pixels (fixed giant warning triangle on /console/models). +- [x] Rewrite Operation tab batch (SettingsCheckin, SettingsCreditLimit, SettingsLog, SettingsSensitiveWords, SettingsMonitoring, HttpStatusCodeRulesInput) to native HeroUI v3. +- [x] Rewrite Dashboard tab (SettingsDataDashboard) and Drawing tab (SettingsDrawing) to native HeroUI v3. +- [x] Rewrite RateLimit tab (SettingsRequestRateLimit) to native HeroUI v3. +- [x] Rewrite Payment tab batch (SettingsGeneralPayment, SettingsPaymentGateway easy-pay, SettingsPaymentGatewayStripe) to native HeroUI v3. +- [x] Rewrite Model tab batch (SettingGlobalModel, SettingGeminiModel, SettingClaudeModel, SettingGrokModel) and Model Deployment (SettingModelDeployment) to native HeroUI v3. +- [x] Rewrite Operation/SettingsGeneral (额度展示类型 + currency exchange combined control) to native HeroUI v3. +- [x] Rewrite ModelHeader / ModelEndpoints / ModelBasicInfo (model-pricing detail subviews) to native HeroUI v3 + lucide. +- [x] Rewrite ChannelsTabs / ModelsTabs to native pill-style tabs with action menus and ConfirmDialog instead of Semi Tabs/Dropdown/Modal.confirm. +- [x] Rewrite SelectionNotification: replace Semi Notification with a fixed bottom-anchored bar. +- [x] Rewrite small modals to native v3 Modal: BatchTagModal, ConfirmationDialog (model-deployments), SyncWizardModal, MissingModelsModal, EditVendorModal, PricingFilterModal. +- [x] Rewrite channels/index, models/index, subscriptions/index to drop Banner/Modal compat (use Tailwind warning panels + ConfirmDialog). +- [x] Rewrite AutoGroupList (Ratio/components) to native HTML datalist + lucide buttons + window.confirm. +- [x] Rewrite GroupTable (Ratio/components) to native inputs + Tailwind + lucide. +- [x] Rewrite ModelDetailSideSheet to a native fixed-position aside panel with backdrop. +- [x] Rewrite PrefillGroupManagement to a native fixed left-side panel + ConfirmDialog. +- [x] Rewrite Codex/SingleModel/EditDeployment modals to native HeroUI v3 Modal anatomy. +- [x] Rewrite GroupGroupRatioRules + GroupSpecialUsableRules (Ratio/components) to native datalist + lucide buttons + window.confirm. +- [x] Rewrite AddUserModal (table/users) to a native fixed left-side panel. +- [x] Rewrite ModelsActions to drop Modal/Popover/RadioGroup compat (uses ConfirmDialog, custom HoverPopover, Button isPending). +- [x] Inline Tag/Avatar/Typography/Toast wrappers in helpers/render.jsx and helpers/utils.jsx (removes 2 high-fanout HeroCompat imports — 6 files dropped from compat in one shot). +- [x] Rewrite ModelPricingTable (model-pricing detail) to native HTML table + Tailwind chips. +- [x] Rewrite ChannelsActions (batch operations) to ConfirmDialog + ClickDropdown + lucide ChevronDown. +- [x] Rewrite UsersColumnDefs to native chips + HoverPanel + ClickMenu (drops Space/Tag/Progress/Popover/Typography/Dropdown/IconMore from compat in one shot). +- [x] Rewrite SubscriptionsColumnDefs to native chips + HoverPanel + ConfirmDialog (drops Modal/Tag/Typography/Popover/Divider/Space from compat). +- [x] Extract HoverPanel and ClickMenu shared components (`web/src/components/common/ui/HoverPanel.jsx`, `ClickMenu.jsx`) so future column defs can reuse without duplicating. +- [x] Rewrite ModelsColumnDefs to native StringTag/ConfirmDialog/CopyableText (drops Space/Tag/Typography/Modal from compat). +- [x] Rewrite Ratio/ModelRatioSettings (8 JSON textareas + reset model ratio confirm) to native textarea + Switch + ConfirmDialog (drops Form/Col/Row/Spin/Popconfirm/Space from compat). +- [x] Rewrite PricingTableColumns to native chips + lucide HelpCircle (drops Tag/Space/IconHelpCircle from compat). +- [x] Rewrite ChannelUpstreamUpdateModal to native v3 Modal anatomy + custom pill-style tabs + native checkbox grid + ConfirmDialog (drops Modal/Checkbox/Empty/Tabs/Typography/IconSearch/Illustrations from compat). +- [x] Rewrite UpstreamConflictModal (model conflict resolution table) to native HTML table with sticky-left model column, per-column header checkboxes (with `indeterminate` ref), HoverPanel for diff content, and a simple Pager (drops Modal/Table/Checkbox/Empty/Tag/Popover/Typography/Illustrations from compat). +- [x] Rewrite EditPrefillGroupModal (left-side panel) to native fixed aside + custom TagInput (Backspace removal, comma/Enter commit, click X to remove tag) + native select for type (drops SideSheet/Form/Tag/Spin/Avatar/Row/Col + Form.TagInput from compat). +- [x] Rewrite UserBindingManagementModal to native v3 Modal anatomy + Spinner + ConfirmDialog (drops Modal/Spin/Typography/Checkbox/Tag/IconLink/IconMail/IconDelete/IconGithubLogo from compat). +- [x] Rewrite UserSubscriptionsModal to right-side panel + native select + ConfirmDialog (keeps CardTable for now; drops SideSheet/Modal/Empty/Tag/Typography/Space/IconPlusCircle/Illustrations). +- [x] Rewrite CheckinCalendar with custom MonthCalendar (7-col grid, prev/next/today nav, today pill, dateRender callback) + ConfirmDialog-style Modal for Turnstile (drops Calendar/Spin/Collapsible/Avatar/Typography/Modal from compat). +- [x] Rewrite EditRedemptionModal (left/right side panel) to native fixed aside + custom NumberField with prefix slot + native datetime-local input + ConfirmDialog for post-create download (drops SideSheet/Modal/Form/Spin/Tag/Typography/Avatar/Row/Col/InputNumber/IconCreditCard/IconSave/IconClose/IconGift from compat). +- [x] Rewrite ChannelSelectorModal (settings) to v3 Modal + native HTML table with HighlightText (mark element), HeaderCheckbox (indeterminate ref), simple per-page pager + page size select (drops Modal/Table/Space/Highlight/Tag/IconSearch from compat). +- [x] Rewrite SettingsPaymentGatewayCreem (Payment tab) to native HeroUI v3: 3-col grid + product table with v3 Modal for add/edit (drops Form/Avatar/Typography/Tag/Modal/Table/InputNumber/IconCoinMoneyStroked from compat). +- [x] Rewrite SettingsFAQ (Dashboard tab) to native HTML table + HeaderCheckbox + ConfirmDialog + v3 Modal for add/edit (drops Space/Table/Form/Typography/Empty/Divider/Modal/Illustrations from compat). +- [x] Rewrite SettingsPaymentGatewayWaffoPancake (Payment tab) to native v3 Switch+Field grid (3+3+2+2+2 column layout, multi-environment webhook keys, sandbox toggle) (drops Banner/Col/Form/Row/Spin from compat). +- [x] Rewrite SettingsUptimeKuma (Dashboard tab) to native HTML table + HeaderCheckbox + ConfirmDialog + v3 Modal (drops Space/Table/Form/Typography/Empty/Divider/Modal/Illustrations from compat). +- [x] Rewrite SettingsAPIInfo (Dashboard tab) to native HTML table + custom ColorChip/ColorDot palette + HeaderCheckbox + ConfirmDialog + v3 Modal (drops Space/Table/Form/Typography/Empty/Divider/Avatar/Modal/Tag/Illustrations from compat). +- [x] Rewrite SettingsAnnouncements (Dashboard tab) to native HTML table + TypeChip + datetime-local input + 2 v3 Modals (edit + content fullscreen) + ConfirmDialog (drops Space/Table/Form/Typography/Empty/Divider/Modal/Tag/TextArea/Illustrations from compat). +- [x] Rewrite TaskLogsColumnDefs (task logs columns) and MjLogsColumnDefs (Midjourney logs columns) to native ColorTag/ProgressBar/EllipsisText/UserChip helpers with 16-color palette and lucide icon prefixes (drops Progress/Tag/Typography/Avatar/Space from compat across both files). +- [x] Rewrite TokensColumnDefs (tokens columns) to native Chip/ProgressBar/HoverPanel/ClickMenu/ConfirmDialog primitives with show-hide token key cell, vendor avatar pills, split chat menu, and inline copy popover (drops Dropdown/Space/SplitButtonGroup/Tag/AvatarGroup/Avatar/Progress/Popover/Typography/Modal + IconTreeTriangleDown/IconCopy/IconEyeOpened/IconEyeClosed from compat). +- [x] Rewrite UsageLogsColumnDefs (usage logs columns) to native ColorTag/UserChip/EllipsisText/HoverPanel primitives with channel-affinity sparkles overlay, stream-status alert overlay, model-mapped popover, cache-summary subtitle, and segment-style detail summary (drops Avatar/Space/Tag/Popover/Typography + IconHelpCircle from compat). +- [x] Rewrite tokens/index (FluentRead detection notice) without HeroCompat: Notification.info popup is replaced by a controlled top-right `FluentNoticePanel` (HeroUI Button + native `