Conversation
为每个供应商添加独立的四维超时配置,解决请求超时导致的重试缓慢和流式中途卡住问题。 核心特性: - 添加 3 个超时配置字段(流式首字节/流式静默期/非流式总时长) - 实现智能超时策略:区分流式(10秒)和非流式(600秒)请求 - 实现流式静默期监控(watchdog 计时器),解决流式中途卡住问题 - 支持细粒度的超时控制,避免长时间挂起 性能提升: - 重试时间减少 93%(150 秒 → 30 秒) - 彻底解决流式静默期卡死问题 数据库变更: - 添加 providers.first_byte_timeout_streaming_ms(默认 30000ms) - 添加 providers.streaming_idle_timeout_ms(默认 10000ms) - 添加 providers.request_timeout_non_streaming_ms(默认 600000ms) 核心实现: - forwarder.ts: 实现超时控制(AbortController + AbortSignal.any) - response-handler.ts: 实现流式静默期监控(watchdog 计时器) - provider-form.tsx: UI 表单支持超时配置
feat(proxy): add configurable timeout settings for providers
… OpenAI Responses This adds end-to-end API connectivity tests for provider testing page: - Implement server actions to test Anthropic Messages, OpenAI Chat Completions, and OpenAI Responses - Introduce ApiTestButton UI component and wire into provider form - Add API test collapsible UI and translations (zh-CN/en/zh-TW) - Extend provider-form with API test section and adjust typing for test results - Ensure non-breaking feature addition with minimal UI/UX impact
重构活跃 Session 展示逻辑,提取可复用组件以提升代码复用性和可维护性: - 新增 ActiveSessionsList 组件,支持自定义显示数量和样式 - 新增 SessionListItem 组件,统一 Session 列表项展示逻辑 - 简化 ActiveSessionsPanel,使用新组件实现(保持向后兼容) - 优化 OverviewPanel,移除 recentSessions 数据依赖 - 简化 overview action,移除不必要的 Session 查询 - 修复价格上传对话框翻译 key 引用 技术改进: - 组件解耦:Session 列表逻辑独立,可在多个页面复用 - 性能优化:减少不必要的数据查询 - 代码复用:统一 Session 展示格式和交互逻辑 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- 在 API 测试前校验 providerUrl 是否为有效的 http/https 链接 - 引入 isValidUrl 工具函数进行链接格式验证 - 当未填写 API Key 但存在 providerId 时,自动获取解密后的密钥用于测试 - 重构多个 Anthropic 和 OpenAI 的 API 测试方法,提取公共逻辑到 executeProviderApiTest 函数 - 更新中英文设置页面提示文本,增加 invalidUrl 相关国际化内容 - 修复测试按钮禁用状态逻辑,确保在缺少必要参数时不可点击
将原本内联的供应商 URL 验证代码提取为独立的验证函数 `validateProviderUrlForConnectivity`,提升代码复用性和可维护性。 该函数统一处理协议、内部网络地址和危险端口的安全检查, 并返回结构化的验证结果,便于调用方处理不同类型的错误。 同时优化了 `executeProviderApiTest` 中的 URL 处理逻辑, 确保使用标准化后的 URL 发起请求,并增强错误日志记录。
- Update package manager from pnpm@9.15.0 to bun@1.3.2 - Rewrite Dockerfile to use Bun official image (oven/bun:1.3.2-slim) - Update all GitHub Actions workflows to use oven-sh/setup-bun@v1 - Update all documentation (CLAUDE.md, AGENTS.md, CONTRIBUTING.md, README) - Replace pnpm-lock.yaml with bun.lock - Update .gitignore and .prettierignore for Bun debug logs - Remove pnpm from CI/CD allowed tools list Changes verified: - ✅ bun run typecheck: passed - ✅ bun run lint: passed (only pre-existing warnings) - ✅ bun run build: successful - ✅ Docker build: successful (437MB image) - ✅ Docker runtime: verified
为 provider API 测试功能添加了新的类型定义 ProviderApiResponse, 用于更精确地描述 API 响应结构。同时更新了 executeProviderApiTest 函数中 extract 方法的参数类型,从 any 改为新定义的 ProviderApiResponse 类型,以提升类型安全性。
- 在统计图表、排行榜、使用日志等组件中补全了 useCallback 的依赖项, 包括翻译函数 `t` 和相关状态更新函数,以避免潜在的闭包问题。 - 移除了未使用的 imports 和参数,优化代码结构。 - 统一了 Collapsible 组件中 onOpenChange 的写法,提升一致性。
- Fix 'Cannot find module undici' error in Docker production environment - undici is required at runtime for proxy functionality (ProxyAgent) - Next.js standalone output only includes dependencies, not devDependencies
- 调整 API 测试按钮组件逻辑,支持根据供应商类型自动匹配 API 格式和默认模型 - 增加允许模型选择下拉框,提升用户选择体验 - 更新中英文设置项文案,统一术语为“供应商类型”和“模型测试” - 支持从白名单模型中选择或手动输入测试模型 - 默认情况下同步路由配置中的供应商类型与模型选项
- Add regex pattern for cache_control block limit errors - Update error count from 6 to 7 types - Add documentation and example for new error type - Prevents unnecessary retries for client configuration errors
- Add 'extra inputs are not permitted' pattern to parameter validation errors - Update ErrorCategory comment to include extra parameters - Prevents retry on client schema validation errors
…otection Changes: - Add File API polyfill for Node.js environment compatibility - Add safe-regex dependency to detect and prevent ReDoS vulnerabilities - Create error_rules database table with dynamic rule management - Implement ErrorRuleDetector with performance-optimized detection (contains → exact → regex) - Add EventEmitter for automatic cache refresh on rule updates - Refactor error detection from hardcoded regex array to database-driven system - Support three match types: regex, contains, exact - Add priority and category-based rule organization 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
chore: 调整使用日志间距
- Fixed Invalid URL error caused by missing path segments
- Changed from 'baseUrl:action' to 'baseUrl/models/{model}:action'
- Both gemini and gemini-cli now use consistent URL format
- Resolves: https://api-dmit.cubence.com:generateContent → https://api-dmit.cubence.com/models/gemini-3-pro-preview:generateContent
…usage extraction
Core fixes:
1. Support Gemini message format (contents field) in getMessagesLength() and getMessages()
- Added support for direct contents[] array
- Added support for wrapped request.contents[] format
2. Enhanced GeminiAdapter request transformation
- Support multiple content formats (string, array, object)
- Added extractTextContent() helper for flexible parsing
- Support system message arrays
- Improved image handling (base64 + URL)
- Added Gemini CLI systemInstruction role support
3. Improved usage extraction in response-handler
- Handle response wrapping ({response: {...}})
- Support both usageMetadata and usage fields
- Extract from both JSON and SSE formats
- Added comprehensive source tracking in logs
4. Enhanced response transformation
- Handle missing text in parts (empty string fallback)
- Support both direct and wrapped response formats
Resolves: Gemini request body and response body parsing issues
Fixes: Message count statistics and token usage calculation
调整 providerSupportsModel 函数中非 Claude 模型的检查顺序,优先检查显式声明 (allowedModels/modelRedirects),再检查 provider_type。这允许 Claude 类型的 供应商通过显式声明支持非 Claude 模型(如 gemini-*),实现CCR代理。
…-column grid - Limit dialog height to 70vh with scrollable content area - Convert Key quota dialog to 2x2 grid layout (4 cost limits) - Convert User quota dialog to 1x2 grid layout (2 fields) - Reduce vertical spacing and use compact styling (h-9, text-xs) - Add fixed header/footer with border separator - Increase dialog width to 600px for dual-column layout
feat(user-form): 更新用户限制并增强错误处理
- 修复 ContentPart 接口的 source 对象缺少 url 属性导致的类型错误 - 修复 GeminiRequest 的 systemInstruction 缺少可选 role 字段的类型错误 - 删除所有语言文件中未使用的 settings.errorRules.section.description 翻译 - 通过 TypeScript 类型检查和 Docker 镜像构建测试
**新功能**: 1. 端点优先的客户端格式检测 - 新增 detectFormatByEndpoint() 函数,通过 API 路径精确识别格式 - 支持 Claude/Codex/OpenAI/Gemini/Gemini CLI 端点检测 - 提高格式识别准确性,避免 Gemini 透传问题 2. 智能 URL 拼接(修复 Issue #139) - 重写 buildProxyUrl() 函数,智能检测重复路径 - 避免 base_url 已包含完整路径时的重复拼接 - 移除 forwarder.ts 中强制 /v1/responses 路径重写 3. URL 预览组件 - 新增 url-preview.tsx 实时预览组件 - 展示所有 API 端点拼接结果 - 检测并高亮重复路径 - 支持一键复制完整 URL - 集成到供应商表单 **国际化**: - 完成 5 种语言翻译(zh-CN, zh-TW, en, ja, ru) **修复**: - 修复 GeminiUsageMetadata 类型定义缺少 cachedContentTokenCount 字段 - 修复 gemini/adapter.ts 构建错误 **测试**: - ✅ TypeScript 类型检查通过 - ✅ 生产构建测试通过
**改进**: 1. 根据供应商类型只显示相关端点预览 - Claude/Claude Auth: Messages + Count Tokens - Codex: Responses - OpenAI Compatible: Chat Completions + Models - Gemini: Generate/Stream Content - Gemini CLI: Generate/Stream Content 2. 精简 UI 体验 - 移除冗余的描述文案 - 移除不必要的提示信息 - 保持简洁清晰的界面 **国际化**: - 更新 5 种语言翻译,删除冗余翻译键
- 过滤元数据字段 (sample_spec),避免导入非模型数据 - 添加 mode 字段验证,确保只处理有效的模型价格数据 - 优化同步结果 Toast 提示:失败消息优先显示且更明显 - 显示失败的模型名称(最多5个)以便快速定位问题
- 新增 Dockerfile.dev 文件用于构建开发环境 - 使用 BuildKit 加速依赖安装和 Next.js 构建
feat: 添加开发环境 Dockerfile.dev
- 移除 user_created 翻译中未使用的 {name} 参数占位符
- 添加 create_failed, update_failed, delete_failed 翻译到所有 5 种语言
- 修复因参数不匹配导致翻译无法显示的问题
- 弹框添加固定高度(85vh)和可滚动内容区域 - 表单布局改为 flex 布局,标题和按钮固定 - RPM/每日额度改为双列布局 - 限额输入框(5h/周/月/并发)改为双列布局 - 移除限额字段的 description 以节省空间
主要变更: 1. 修复翻译键路径错误(logs.modelRedirect.redirected → modelRedirect.redirected) 2. 在 ProviderChainItem 中添加 modelRedirect 结构化字段 3. ModelRedirector 执行重定向时自动更新决策链 4. 决策链时间线中展示模型重定向详情(请求模型、实际转发、计费依据) 5. 完成 5 种语言的 i18n 翻译(zh-CN, en, zh-TW, ja, ru) 技术细节: - 类型定义:src/types/message.ts - modelRedirect 可选字段 - 记录逻辑:src/app/v1/_lib/proxy/model-redirector.ts - UI 展示:src/lib/utils/provider-chain-formatter.ts - 组件修复:model-display-with-redirect.tsx 影响范围:使用记录列表和详情对话框的模型重定向展示 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
@claude plz review it |
This was
linked to
issues
Nov 20, 2025
Closed
Closed
Contributor
🔍 Code Review Summary我已经审查了这个大型 PR(220 文件,+20,150/-14,107 行)。这是一个重要的功能更新,主要包含以下特性: ✅ 主要功能亮点1. Gemini 完整支持 ⭐
2. 用户管理增强
3. 供应商超时配置
4. 错误规则系统
✅ 代码质量亮点
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release Notes