Skip to content

fix(web): 优化项目管理路由页签的间距与选择样式#1

Closed
whhjdi wants to merge 85 commits intomainfrom
fix/project-routes-tab-spacing
Closed

fix(web): 优化项目管理路由页签的间距与选择样式#1
whhjdi wants to merge 85 commits intomainfrom
fix/project-routes-tab-spacing

Conversation

@whhjdi
Copy link
Owner

@whhjdi whhjdi commented Feb 15, 2026

变更内容

  • 修复项目管理路由页使用无效间距类导致的贴边问题
  • 统一项目详情 tabs 与路由子 tabs 的左右留白(px-4 sm:px-6)
  • 优化路由页客户端选择按钮的激活态可读性和 focus 样式
  • 为主 tabs 和子 tabs 增加横向滚动支持,提升小屏可用性
  • 调整路由头部在移动端的布局(列布局、轻量纵向间距)

影响文件

  • web/src/pages/projects/detail.tsx
  • web/src/pages/projects/tabs/routes.tsx

验证

  • pnpm -C web run typecheck 通过

solarhell and others added 30 commits January 18, 2026 14:23
- 添加智谱 AI 官方 logo (zhipu.svg)
- 在 quickTemplates 中新增智谱配置
- 配置 Claude Code 端点: https://open.bigmodel.cn/api/anthropic
- 支持 GLM-4.7 模型
- 添加中英文国际化翻译

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* feat: 添加全局时区配置并优化 Dashboard

- 新增 Settings 页面时区配置选项,默认 Asia/Shanghai
- RollUp 聚合基于配置的时区划分天/周/月边界
- Dashboard API 使用配置的时区计算今日/昨日统计
- 新增 ActivityHeatmap 组件,展示 GitHub 风格的活动热力图
- 热力图支持时区感知,正确显示未来日期为禁用状态
- 优化 Dashboard 页面布局和 Top Models 显示

* fix: 修复 Docker 容器无 tzdata 导致的 panic

使用 time.FixedZone 作为 fallback,避免在没有 tzdata 的环境中调用
time.LoadLocation 失败导致 nil Location panic。

* fix: 在 Docker 镜像中添加 tzdata 支持时区

在 Alpine 运行时镜像中安装 tzdata 包,确保 time.LoadLocation 能正常工作。

* fix: 在 CI Docker 镜像中也添加 tzdata
* feat: 添加 PostgreSQL 数据库支持

- 添加 gorm.io/driver/postgres 驱动依赖
- 在 NewDBWithDSN 函数中添加 PostgreSQL 支持逻辑
- 使用 switch case 重构数据库选择逻辑,添加错误处理
- PostgreSQL 使用 libpq 格式连接字符串(host=... port=... 格式)
- 将所有 longtext 类型改为通用的 text 类型以兼容多数据库
- 删除 LongText 函数调用,简化代码
- 更新 README 文档,添加 PostgreSQL 配置说明(包含 timezone=UTC 参数)

现在项目支持三种数据库:SQLite(默认)、MySQL 和 PostgreSQL

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: 在设置页面显示当前数据库类型

- 在数据保留设置卡片中新增数据库类型显示
- 使用带颜色的 badge 组件优化视觉效果
  - SQLite: 蓝色
  - MySQL: 橙色
  - PostgreSQL: 紫色
- 支持深色模式主题
- 添加了相应的中英文翻译

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: 重构数据库层以支持跨数据库类型兼容

1. 包重命名
   - 重命名 internal/repository/sqlite -> internal/repository/gormdb
   - 更准确地反映支持多数据库(MySQL、PostgreSQL、SQLite)的特性

2. 实现跨数据库 LongText 类型
   - 新增 types.go,定义 LongText 自定义类型
   - 使用 GORM 官方 GormDBDataTypeInterface 接口
   - 自动根据数据库类型选择合适的字段类型:
     * MySQL: LONGTEXT (最大 4GB)
     * PostgreSQL: TEXT (无限制)
     * SQLite: TEXT (无限制)
   - 实现 Scanner 和 Valuer 接口,支持自动类型转换

3. 更新 models.go
   - 将大文本字段类型从 string 改为 LongText
   - 包括:Config、RequestInfo、ResponseInfo 等字段

4. 简化数据库迁移
   - 移除手动字段类型转换代码
   - GORM 自动处理不同数据库的类型映射

5. 新增 PostgreSQL Docker Compose 配置
   - 添加 docker-compose.postgres.yml
   - 方便 PostgreSQL 数据库测试

优势:
- 零配置自动适配不同数据库
- 无需手动维护字段列表
- 基于 GORM 官方推荐方案
- 类型安全且易于维护

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复 LongText.Scan 方法的错误处理并清理无关注释

- 为 LongText.Scan 添加显式返回值以满足 sql.Scanner 接口规范
- 添加 default 分支处理不支持的类型,返回描述性错误
- 删除 db.go 中与 Close 函数无关的遗留注释

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore: 将 docker-compose.postgres.yml 移出版本控制

- 添加 docker-compose.postgres.yml 到 .gitignore
- 从 git 跟踪中移除该文件(本地开发配置文件)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore: 升级 pgx 驱动至 v5.8.0 以兼容 gorm postgres 驱动

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
- 新增 BackupService 支持导出/导入所有配置数据
- 支持备份: SystemSettings, Providers, Projects, Routes, RetryConfigs, RoutingStrategies, APITokens, ModelMappings
- 使用 name/slug 作为外键引用,支持跨实例导入
- 支持冲突处理策略: skip, overwrite, error
- 前端设置页面添加备份与恢复 UI
- 显示导入结果摘要和警告信息
- 修复 .gitignore 中 maxx 规则匹配 cmd/maxx 目录的问题
* feat: 添加 PostgreSQL 数据库支持并优化 GORM 模型

- 添加 PostgreSQL 驱动支持 (postgres://, postgresql://)
- 实现 LongText 自定义类型,MySQL 使用 longtext,其他数据库使用 text
- 移除冗余的 GORM 标签 (not null, default:0, default:'')
- 使用 size:N 替代硬编码的 type:varchar(N)

* fix: 修复 CodeRabbit review 问题

- api_token.go: Update 方法使用 LongText(t.Description)
- system_setting.go: DoUpdates 使用 LongText(value)
- go.mod: 将 postgres driver 移到 direct dependencies
- db.go: 更新 Dialector 注释包含 postgres
* feat: 移除 Header 组件并在 NavProxyStatus 中添加版本显示

* fix: 移除调试日志以清理代码
- 移除前端硬编码的 v 前缀,直接使用后端返回的版本号
- 为整个代理状态区域添加点击复制功能

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
## 热力图修复
- 修复热力图未正确补全日期的问题,现在始终显示 53 周(约一年)
- 后端只返回 count > 0 的日期,减少数据传输
- 正确处理今日数据的实时更新

## WebSocket 数据刷新优化
- 移除前端轮询,改用 WebSocket 事件触发数据刷新
- 请求完成/失败时自动刷新 dashboard、provider stats
- 请求失败时额外刷新 cooldowns(可能触发冷却)
- 保留外部 API 配额(Antigravity/Kiro)的定时刷新

## 清理死代码
- 移除未使用的 BroadcastStats / stats_update 事件
当有正在进行中的请求时,Today Requests 卡片右上角的图标会变成当前活跃请求数量,
并带有发光边框和脉冲动画效果(与 sidebar 风格一致)。
* feat: 优化 Cooldown 机制和前端交互体验

- 修复网络错误未正确触发 Cooldown 的问题
- 将默认 Cooldown 时间从 60s 改为 5s 起步
- 将 Cooldown 策略从分钟级改为秒级,支持更精细的控制
- Provider Row 点击 Unfreeze 按钮可立即解冻
- 手动解冻时清空失败计数器
- 修复倒计时到期后前端未正确恢复的问题
- 拖拽时全局设置 cursor 为 grab
- 优化倒计时使用递归 setTimeout 替代 setInterval

* feat: 优化 Cooldown 落雪效果视觉样式

- 雪花使用 radial-gradient 实现半透明柔和边缘效果
- Light 模式使用深灰色雪花,Dark 模式使用白色雪花
- Cooldown 行背景改为透明,保留可见边框
- 倒计时框背景改为透明
- Icon 框使用实色背景,Cooldown 时隐藏字母只显示雪花图标
- 雪花动画置于所有元素后面 (z-0)
- 增强 Cooldown 状态下 Row 的 hover 效果
- 创建 CooldownsProvider 共享 cooldowns 数据
- 更新 ClientTypeRoutesContent 包装 CooldownsProvider
- 更新 provider-row 使用 useCooldownsContext
- 更新 dialog 组件使用 useCooldownsContext

解决 Routes 页面多个组件各自调用 /api/admin/cooldowns 导致重复请求的问题
* feat: 添加一键排序 Antigravity 路由功能

在 Routes 页面添加"一键排序 Antigravity"按钮,根据 Claude 模型的重刷时间
(resetTime) 对 Antigravity 类型的路由进行排序,越早重刷的排在前面。

- 仅当存在 Antigravity 路由时显示排序按钮
- 排序只影响 Antigravity 路由之间的顺序,非 Antigravity 路由位置不变
- 添加中英文 i18n 翻译

* feat: 添加 Antigravity 额度管理功能

- 新增后台任务服务 (AntigravityTaskService) 定期刷新配额
- 在 Provider 列表添加手动刷新额度按钮
- 显示 Image 模型额度 (alongside Claude quota)
- 添加 /antigravity/refresh-quotas API 端点
* feat: 为 Edit Provider 页面添加完整的多语言支持

- 新增 provider.edit, provider.editDescription 等 7 个多语言键
- 新增 providers.supportModels 和 providers.deleteConfirm 配置
- 替换所有硬编码文本为多语言键,包括:
  * 页面标题和描述
  * 表单标签(Basic Information, Display Name, API Endpoint, API Key)
  * 按钮文本(Delete, Cancel)
  * 错误提示(updateError)
  * Supported Models 章节
  * 删除确认对话框

支持中英文切换,提升国际化体验。

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: 优化侧边栏折叠时按钮交互顺序

在侧边栏折叠状态下,调整主题切换和折叠触发按钮的显示顺序,
使主题切换按钮在上,折叠触发按钮在下,提升用户体验。

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: Antigravity Provider 页面多语言适配及删除按钮样式统一

- 为 Antigravity Provider 详情页添加完整的多语言支持(中英文)
- 统一删除按钮样式,使用 Button 组件的 destructive variant
- 添加 useTranslation hook 并替换所有硬编码文本

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: ymk233 <ymk233@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
…wsl-project#140)

* feat: enhance theme toggle with luxury themes and improved UI

- Refactored ThemeToggle component to include luxury themes with swatches and tooltips.
- Added theme transition animations in CSS for smoother visual effects.
- Updated theme metadata structure to support luxury themes with detailed descriptions and brand inspirations.
- Enhanced settings page to allow selection of both default and luxury themes with visual previews.
- Improved accessibility with tooltips and aria-labels for theme selection buttons.

* feat: 优化主题切换组件,使用按钮替代原有按钮元素并调整样式

* feat: 确保获取活动请求时返回数组,增加类型检查和警告日志

* feat: 优化主题切换和设置页面,增加奢华主题选项及样式调整

* feat: 调整提供者信息展示顺序,优化样式以提升可读性

* feat(theme): enhance theme configuration with typography, spacing, radius, shadow, and animation settings

refactor(settings): improve layout and styling in settings page components

* feat(chart): implement reusable chart components with tooltip and legend support

- Added ChartContainer, ChartTooltip, and ChartLegend components for better chart management.
- Integrated chart configuration with semantic colors for improved readability.
- Updated OverviewPage and StatsPage to utilize new chart components, enhancing code maintainability.
- Refactored chart rendering logic to use Recharts with improved styling and tooltip functionality.
- Adjusted CSS variables for chart colors to support various themes and improve visual consistency.

* feat(theme): 增加主题验证,确保从 localStorage 获取的主题有效性

* feat(settings): 优化备份部分的代码格式,提升可读性
glebarez/sqlite 库使用 _pragma=name(value) 格式而非 _name=value

- 旧: ?_journal_mode=WAL&_busy_timeout=30000
- 新: ?_pragma=journal_mode(WAL)&_pragma=busy_timeout(30000)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: 优化 Stats 页面和升级计费精度至纳美元

- 添加 year 粒度支持,用于全时间范围查询
- 修复时间范围边界问题,避免 lastWeek/lastMonth 等重复计算边界日期
- 使用系统配置的时区而不是 UTC 进行时间桶计算
- 添加筛选条件摘要显示(精确到时间)
- 修复 model 参数未传递到 API 的问题
- 移除侧边栏折叠功能,保持始终显示
- 图表颜色使用主题变量,Cost 在图例和 Tooltip 中优先显示
- 修复 Filter 清空按钮的布局位移问题
- Provider 分组显示类型名称标签

- 成本计算从微美元(microUSD)升级到纳美元(nanoUSD),精度提升1000倍
- 使用 big.Int 进行计算,防止大数量 token 时的整数溢出
- 添加 CacheCreationCount fallback 支持
- 保留旧函数作为兼容层(标记为 Deprecated)

* fix: 设置失败请求的 EndTime 和 Duration

在 defer 块中,当 attempt 仍处于 IN_PROGRESS 状态需要标记为
failed/cancelled 时,之前没有设置 EndTime 和 Duration,
导致统计数据不准确。

* feat: 添加首字时长 (TTFT) 字段用于流式响应延迟追踪

为 ProxyRequest 和 ProxyUpstreamAttempt 添加 TTFT (Time To First Token) 字段,
记录流式 API 请求从开始到收到第一个 token 的时间间隔。

主要改动:
- domain: 添加 TTFT time.Duration 字段
- sqlite: 添加 TTFTMs 毫秒存储字段及转换逻辑
- adapters: custom/antigravity/kiro 适配器追踪首字时间
- executor: 处理 EventFirstToken 事件并同步到 proxyReq
- frontend: 同步添加 ttft 类型字段

* feat: 添加请求列表状态过滤器和斑马纹样式

- 添加状态过滤器下拉框,支持按 COMPLETED/FAILED/IN_PROGRESS 等状态筛选
- 后端 API 支持 status 查询参数过滤
- 实时更新逻辑支持状态过滤,新数据会根据当前过滤条件正确显示或隐藏
- 表格添加斑马纹背景(奇数行微透明),提升可读性
- 失败状态行根据奇偶行使用不同透明度的红色背景
- Hover 效果使用伪元素叠加,不覆盖原有背景色
- 修复 TTFT 列表查询时数据丢失问题(添加 ttft_ms 到 SELECT)
- Cost 格式化保留完整 6 位小数

* fix: 修复请求列表表格列错位和样式问题

- 移除 TableRow 伪元素避免列错位
- 为所有单元格添加明确宽度和 padding
- 修复 Failed 行顶部细线问题(移除 border-l)
- 添加 Table border-collapse 消除行间隙
- 移除 TableRow 默认边框
- 增强正常行 hover 效果
- 添加 TTFT 字段聚合到 UsageStats
- 修复多处 lint 警告

* feat: 添加 Stats 页面缓存率和 TTFT 显示,以及优雅关机支持

- Token 统计包含所有 token (input + output + cacheRead + cacheWrite)
- 添加缓存命中率显示 (cacheRead / (input + cacheRead))
- 添加平均首字时长 (TTFT) 显示在 RPM 后面
- 实现 Proxy Server 优雅关机,等待所有请求完成后再关闭
- 增加 SIGTERM/SIGINT 信号处理,支持 docker down 优雅关机
- 关机超时 2 分钟,每 5 秒检查一次活跃请求

* refactor: 优化优雅关机和完善失败请求处理

- 使用 channel 通信替代定时轮询,请求完成时实时打印日志
- 标记失败请求时设置 end_time 和计算 duration_ms
- 同步处理 upstream_attempt 表的失败状态

* fix: 启动时修复历史遗留的没有 end_time 的失败请求

将 FAILED 状态但 end_time=0 的请求/attempts 设置正确的 end_time,
避免它们一直显示在请求列表最前面

* fix: 创建 attempt 时设置 RequestInfo
* feat: 添加端口管理功能,支持检查和终止占用端口的进程

* feat: 实现跨平台端口管理功能,添加非 Windows 平台的空实现
* feat: 添加 pprof 性能分析支持

新增功能:
- 支持动态启用/禁用 pprof 性能分析
- 可配置端口(默认 6060)
- 可选密码保护(Basic Auth,用户名:pprof)
- 配置修改后自动重载,无需重启服务
- 只监听 localhost,不暴露到公网

后端实现:
- internal/core/pprof_manager.go: 新增 PprofManager 管理 pprof 生命周期
- internal/domain/model.go: 添加 pprof 配置常量
- internal/core/server.go: 集成 pprof manager
- internal/core/database.go: 统一初始化顺序,添加 PprofManager 到 ServerComponents
- internal/service/admin.go: 添加配置更新/删除时的重载逻辑
- internal/desktop/launcher.go: 简化初始化流程
- cmd/maxx/main.go: 添加 context import

前端实现:
- web/src/pages/settings/index.tsx: 添加完整的 pprof 设置界面
  * 启用/禁用开关
  * 端口配置输入框
  * 密码保护开关
  * 密码输入框(支持显示/隐藏)
  * 访问地址链接(可点击)
  * 认证信息提示
  * 禁用密码保护时自动从数据库删除密码
  * 所有设置统一保存按钮
- web/src/locales/zh.json: 中文翻译
- web/src/locales/en.json: 英文翻译

架构优化:
- 统一了 CLI 和 GUI 的初始化顺序
- PprofManager 在创建 AdminService 前初始化并传入
- 通过 ServerComponents 传递,避免循环依赖
- 移除了 SetPprofReloader 延迟初始化方法
- 使用 switch case 简化 pprof 配置判断
- 移除不必要的 nil 检查
- 移除重复的日志记录(错误已通过 return 返回)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复 pprof 数据竞争、启动验证和代码质量问题

- 使用 net.Listen 同步验证端口绑定成功后再设置 m.isRunning
- 只在端口成功绑定后才标记服务运行,避免 IsRunning() 不准确
- 添加绑定失败时的错误返回和处理
- 服务器异常退出时自动更新 m.isRunning 状态

- basicAuthMiddleware 在创建时捕获密码值
- 避免在请求处理时无锁读取 m.config.Password
- 消除与 ReloadPprofConfig 更新配置时的数据竞争

1. **pprof_manager.go**: 创建独立的 ServeMux,避免暴露主应用路由
2. **admin.go**: 在调用 pprofReloader 前添加空指针检查
3. **main.go**: 添加信号处理和优雅关闭逻辑 (Ctrl+C)
4. **server.go**: 为 pprof manager 创建独立的 2 秒超时上下文

1. **settings/index.tsx**: handleSave 添加 try-catch 错误处理
2. **settings/index.tsx**: 禁止保存空密码(只在密码非空时保存)
3. **settings/index.tsx**: 移除访问提示的冗余条件检查
4. **settings/index.tsx**: Switch 组件同时检查 deleteSetting.isPending

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复 Code Review 中的主要问题和 Nitpick 建议

- 添加密码错误状态 `passwordError` 和验证逻辑
- `handleSave` 中验证密码非空,否则阻止保存并显示错误
- `hasChanges` 计算中添加 `isPasswordInvalid` 检查
- Save 按钮在密码无效时自动禁用
- 密码输入框在有错误时显示红色边框和错误提示
- 输入密码时自动清除错误提示

**问题**: loadConfig 之前忽略所有数据库错误
**修复**:
- 区分"配置不存在"(返回空字符串) 和"数据库错误"(应该报错)
- Get 返回错误时立即返回错误,不再静默忽略
- 恢复 Start 和 ReloadPprofConfig 中的错误处理

**问题**: cooldown 清理 goroutine 使用无条件循环,缺乏优雅停止机制
**修复**:
- 创建可取消的 cleanupCtx 用于控制后台任务
- 使用 select 监听 context 取消和 ticker
- 收到取消信号时立即退出 goroutine
- 在服务器关闭时调用 cleanupCancel() 停止后台任务

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复最新 Code Review 中的数据竞争和用户体验问题

## 主要修复 (Actionable Issues)

### 1. 修复 goroutine 中的数据竞争 (pprof_manager.go:203-217)
**问题**: goroutine 在锁释放后访问 m.config.Password 导致数据竞争
**修复**:
- 在启动 goroutine 前,在锁内将 `m.config.Password != ""` 复制到局部变量 `hasPassword`
- goroutine 中使用局部变量 `hasPassword` 而非访问 `m.config`
- 避免与 ReloadPprofConfig 并发修改 m.config 时的数据竞争

### 2. 修复认证提示使用错误的翻译 key (settings/index.tsx:753-758)
**问题**: 使用 `t('settings.pprofPasswordRequired')` (错误消息) 显示在认证提示中
**修复**:
- 改为显示 `{t('settings.pprofPassword')}: ***`
- 更符合认证信息提示的语义("密码: ***" 而非 "需要密码")

## Nitpick 优化

### 1. 优化外部配置更新逻辑 (settings/index.tsx:554-572)
**问题**: 外部配置变化时会覆盖用户未保存的输入
**修复**:
- 在 useEffect 中计算 currentHasChanges
- 只在用户无未保存更改时同步外部配置
- 保护用户正在编辑的内容不被意外覆盖

### 2. 添加端口验证错误提示 (settings/index.tsx)
**问题**: 端口无效时静默跳过保存,用户不知道端口未保存
**修复**:
- 添加 `portError` 状态
- `handleSave` 中验证端口范围 (1-65535)
- 无效时显示错误提示:"端口必须在 1-65535 之间"
- 端口输入框红色边框 + 下方错误提示
- 输入时自动清除错误
- `hasChanges` 和 Save 按钮禁用状态考虑端口有效性

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修正密码占位符文本的误导性提示

**问题**: 占位符文本"留空表示无需密码" / "Leave empty for no password" 有误导性

**原因**:
- 密码输入框只在"启用密码保护"开关打开时才显示
- 当输入框显示时,密码是必填的(已有验证逻辑)
- 用户看到输入框就意味着必须输入密码

**修复**:
- 中文: "留空表示无需密码" → "请输入访问密码"
- 英文: "Leave empty for no password" → "Enter access password"

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复完整 Code Review 中的三个 Actionable 问题

## 问题 1: 英文密码占位符仍然有误导性 (en.json:404)
**问题**: "Enter access password" 没有明确表示必填
**修复**: 改为 "Required for access" 明确指出这是必填字段

## 问题 2: 禁用 pprof 时不应验证端口 (settings/index.tsx:588-643)
**问题**:
- 用户禁用 pprof 时仍然验证端口,导致端口无效时无法保存
- hasChanges 在禁用时仍检查端口变化
- handleSave 在禁用时仍验证和保存端口

**修复**:
- `isPortInvalid`: 只在 `enabledDraft === true` 时才验证端口
- `hasChanges`: 只在 `enabledDraft === true` 时才检查 `portDraft !== pprofPort`
- `handleSave`: 只在 `enabledDraft === true` 时才验证和保存端口
- 添加 useEffect: 禁用 pprof 时自动清除端口错误

## 问题 3: 硬编码的中文错误消息 (settings/index.tsx:608-613)
**问题**: 端口验证错误使用硬编码中文 "端口必须在 1-65535 之间"
**修复**:
- 添加翻译 key `pprofPortInvalid`:
  - zh.json: "端口必须在 1-65535 之间"
  - en.json: "Port must be between 1-65535"
- 使用 `t('settings.pprofPortInvalid')` 替换硬编码文本

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 修复 pprof 数据竞争和前端同步逻辑

- 修复 goroutine 中访问 m.server 的数据竞争,通过捕获 server 实例避免在 Stop/Reload 时产生竞争
- 修复前端 currentHasChanges 逻辑,只在 pprof 启用时才比较 port/password,确保禁用时外部配置可以正确同步

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: 清除冲突标记

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
## 主要变更

### 模型价格管理
- 新增 model_prices 表,支持模型级版本化价格管理
- 每次价格更新创建新版本记录,保留历史价格
- 支持软删除和重置为默认价格
- 新增 Model Prices 管理页面

### 请求成本追踪
- ProxyRequest 和 ProxyUpstreamAttempt 新增 model_price_id 和 multiplier 字段
- Provider 支持配置 ClientMultiplier(按客户端类型设置价格倍率)
- 请求详情页展示完整的成本计算明细(竖式计算)

### UI 改进
- 请求详情页显示 Multiplier 行(始终显示)
- 修复 Provider 倍率输入框无法正确删除的问题
- 使用 AlertDialog 替代原生 confirm 对话框

### 默认价格更新
- 新增 claude-sonnet-4-5-20250929 价格
- 新增 claude-sonnet-4-20250514 价格
- 新增文档页面,包含 Claude Code、OpenAI、Codex CLI、Gemini 四个 tab
- 每个 tab 提供详细的配置说明和代码示例
- 添加 Token 认证的启用/禁用说明
- 更新 README 和 README_CN,补充完整的配置文档
- 优化 tab 激活状态的视觉效果(阴影和边框)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: 修复路由页面无法滚动的问题

- TabsContent 使用 overflow-y-auto 替代 overflow-hidden
- Tabs 添加 overflow-hidden 防止内容溢出
- TabsList 容器添加 shrink-0 防止被压缩
- 简化 ClientTypeRoutesContent 布局,让父容器处理滚动
- 项目 tab 的 toggle bar 添加 sticky 定位

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: 修复文档页面 lint 错误

- 删除未使用的 CardHeader 和 CardTitle import
- 将 CodeBlock 组件移到 DocumentationSection 外部定义,避免在渲染期间创建组件

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* feat: 重构路由页面,合并到 client-routes 并改用 ID 路由

- 将全局路由页面合并到 client-routes,添加 Global/Projects 标签页
- 项目详情页改用 ID 路由替代 slug 路由
- 添加项目自定义路由开关功能
- 后端添加项目更新时 name 和 slug 必填验证

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: 修复手动设置 cooldown 时 clientType 为空的问题

- 修复 provider-details-dialog 中 setCooldown 调用缺少 clientType 参数
- 重构 routes 页面顶部 Tab 样式,分为 Global 和 Projects 两个分组
- 无 Project 时隐藏 Tab 栏
- Tab 栏设置最大宽度并居中对齐

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix: 修复 routes 页面无法滚动的问题

- 给 Tabs 和 ClientTypeRoutesContent 添加 min-h-0 允许 flex 子元素收缩
- 修正 px-lg 为 px-6

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat: 添加手动冻结功能和修复 cooldown clientType

- 后端:添加 SetCooldownUntil 方法支持手动设置冻结时间
- 后端:添加 ReasonManual 冻结原因
- 后端:添加 PUT /admin/cooldowns/{id} API
- 前端:在 CooldownsContext 添加 setCooldown 方法
- 前端:在 provider-details-dialog 添加手动冻结 UI
- 前端:修复 setCooldown 调用时缺少 clientType 参数

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
- 拆分 ForceProjectDialog 为多个子组件 (SessionInfo, CountdownTimer, ProjectSelector)
- 提取 useCountdown hook 用于倒计时逻辑
- 点击项目直接绑定,无需确认按钮
- 优化项目按钮样式,更加明显 (amber 边框和背景)
- 在请求列表中为等待绑定的请求显示 "等待绑定" 状态
- 在请求详情页添加项目绑定横幅,支持重新绑定
- 完善国际化支持
- 修复弹窗 z-index 问题,移至 SidebarProvider 外部

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Codex Provider:
- 新增 Codex OAuth 认证流程和 Token 导入
- 添加 Codex 配额查询和缓存机制
- 支持 Codex provider 的创建、编辑和删除
- 在 Provider 列表页显示 Codex 配额进度条(5H/Week)

路由自动排序:
- 在 Provider 列表页添加 Auto-Sort Switch(Antigravity/Codex)
- 在 Routes 页面 tabs bar 添加手动排序按钮
- 将 Settings 页面的 "Antigravity Settings" 改名为 "Quota Settings"
- 添加 useUpdateSetting 乐观更新,防止 Switch 切换闪烁

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
awsl233777 and others added 27 commits February 6, 2026 22:28
- 更新 CLIProxyAPI SDK,CodexExecutor 自动刷新 access_token
- 修复 SSE 流式转发:透传所有 chunk 包括空行(事件分隔符),
  不再过滤空 payload,确保 event:/data: 行正确换行终结

Co-authored-by: awsl23377 <awsl233777@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix: 修复 Codex adapter 刷新 token 不持久化到数据库的问题

- Router 创建 adapter 后通过 duck-typing 注入 providerUpdate 回调
- CPA Codex adapter 添加 token 持久化逻辑(与原生 codex adapter 对齐)
- 两个 adapter 的持久化错误改为日志输出,便于排查
- 更新 CLIProxyAPI replace 依赖到最新版本

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: CPA adapter 直接复用 ProviderConfigCodex,修复并发写 Metadata

- CPA adapter 改为直接持有真实 provider,读写 Config.Codex
- codex.NewAdapter CPA 路径简化为直接传真实 provider
- updateAuthToken 用 tokenMu 保护 Metadata map 写入
- 移除 ProviderConfigCLIProxyAPICodex 上多余的 token 字段

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: CPA adapter cfg 读写加锁保护,TTL clamp 防无限刷新

- getAccessToken 读 cfg 字段用 RLock 快照本地变量
- 写 cfg 字段合并到 tokenCache 更新的 Lock 临界区
- ExpiresIn <= 60 时 TTL clamp 到 1s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: awsl23377 <awsl233777@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* align claude forwarding behavior with CLIProxyAPI

* align codex provider behavior with CLIProxyAPI

* add gpt-5.3 and claude-opus-4.6 defaults and pricing

* models: supplement /v1/models with pricing defaults by client

* docs: acknowledge router-for-me/CLIProxyAPI

* fix: address PR review on client detection and model filtering
* fix: only passthrough user-agent for CLI clients

* fix: avoid duplicate claude prompt injection and align client detection

* fix: address PR review comments for UA and cloaking
* chore: add CLIProxyAPI sync workflow

* chore: run CLIProxyAPI sync daily at UTC+8 10:00
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…ject#208)

启动时 MarkStaleAsFailed (~2.8s) 和 FixFailedAttemptsWithoutEndTime (~3.6s)
因缺少索引导致全表扫描,总计耗时约 6.4s。

- proxy_requests: 添加 status 单列索引 + (status, end_time) 复合索引
- proxy_upstream_attempts: 添加 status 单列索引 + (status, end_time) 复合索引
- 启动流程添加 [Startup] 计时日志,方便后续诊断

GORM AutoMigrate 会自动创建索引,兼容 SQLite 和 MySQL。
* fix: hide Codex sort button on wrong pages

Issue awsl-project#198: "一键排序 Codex" button incorrectly appears on claude and gemini pages. Fixed by only showing Antigravity sort button for antigravity client type and Codex sort button for codex client type.

Co-authored-by: longxiazy <longxiazy@users.noreply.github.com>

* fix: avoid rendering empty container when no sort buttons are visible

Optimize the condition check so the container div only renders when at least one sort button is visible.

---------

Co-authored-by: maxx-contributor <contributor@maxx.local>
Co-authored-by: longxiazy <longxiazy@users.noreply.github.com>
* fix: add exact antigravity opus 4.5/4.6 mappings

* fix: use wildcard opus 4.5/4.6 mapping rules
…t#217)

* fix: catch and resolve TS2367 in client routes lint flow

* fix: correct client-routes sort button visibility conditions
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Bumps [axios](https://github.com/axios/axios) from 1.13.2 to 1.13.5.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.13.2...v1.13.5)

---
updated-dependencies:
- dependency-name: axios
  dependency-version: 1.13.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…oded localhost (awsl-project#222)

Replace hardcoded `http://localhost:9880` URLs in the documentation page
with the actual proxy address from useProxyStatus(), matching the URL
displayed in the sidebar.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix: 修复托盘设置路由跳转

* fix: 清理URL中的target残留
* fix: 修复托盘设置路由跳转

* fix: 清理URL中的target残留

* style: 优化侧边栏底部式样
@whhjdi
Copy link
Owner Author

whhjdi commented Feb 15, 2026

Closing in favor of upstream PR: awsl-project#233

@whhjdi whhjdi closed this Feb 15, 2026
@github-actions
Copy link

Failed to generate code suggestions for PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.