feat: add global retry settings and endpoint filtering#38
feat: add global retry settings and endpoint filtering#38lich0821 merged 2 commits intolich0821:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds global retry configuration settings and endpoint filtering capabilities to the ccNexus proxy application. The implementation allows users to configure retry behavior (count and delay) globally and filter displayed endpoints by transformer type (Claude/OpenAI/Gemini).
Key changes:
- Added global retry count (1-10) and retry delay (0-300s) configuration settings
- Implemented retry logic with configurable backoff in the proxy handler
- Added UI filtering tabs to show endpoints by transformer type
Reviewed changes
Copilot reviewed 12 out of 13 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/storage/sqlite.go | Adds database schema columns for retry settings and migration logic (contains design issues - adds per-endpoint columns for what should be global settings) |
| internal/config/config.go | Adds RetryCount and RetryDelaySec fields with validation and thread-safe accessors (contains concurrency issue in Validate) |
| internal/proxy/proxy.go | Implements retry logic using global retry settings from config |
| app.go | Adds API methods GetRetryCount, GetRetryDelaySec, and SetRetrySettings (validation inconsistency) |
| frontend/wailsjs/runtime/runtime.js | Adds EventsOffAll function to runtime bindings |
| frontend/wailsjs/go/main/App.js | Adds generated bindings for retry settings API methods |
| frontend/wailsjs/go/main/App.d.ts | Adds TypeScript definitions for retry settings API methods |
| frontend/src/modules/ui.js | Adds transformer filter buttons (Claude/OpenAI/Gemini) and retry settings UI inputs |
| frontend/src/modules/settings.js | Adds retry settings validation and save logic |
| frontend/src/modules/endpoints.js | Implements endpoint filtering by transformer type (missing empty state handling) |
| frontend/src/main.js | Exports setTransformerFilter function |
| frontend/src/i18n/zh-CN.js | Adds Chinese translations for retry settings (contains duplication) |
| frontend/src/i18n/en.js | Adds English translations for retry settings (contains duplication) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
解决 PR lich0821#38 review comments 中指出的问题: - 删除 endpoints 表中的 retry_count 和 retry_delay_sec 列定义 - 删除 migrateRetrySettings 迁移函数及其调用 - 删除 mergeEndpoints 中对重试列的引用 - 删除前端 modal 中重复的重试设置翻译(保留 settings 部分) - 修复 Validate 函数在读锁下修改状态的并发安全问题 - 改进 SetRetrySettings 验证逻辑,返回错误而非静默修正 - 添加 requestID 用于请求日志追踪 重试设置现在完全作为全局配置存储在 app_config 表中。
- Add global retry count (1-10) and retry delay (0-300s) configuration - Implement retry logic with configurable backoff in proxy handler - Add endpoint filtering by transformer type (Claude/OpenAI/Gemini) - Add retry settings UI in settings panel with validation - Add database migration for retry_count and retry_delay_sec columns - Support i18n for retry settings in both English and Chinese
解决 PR lich0821#38 review comments 中指出的问题: - 删除 endpoints 表中的 retry_count 和 retry_delay_sec 列定义 - 删除 migrateRetrySettings 迁移函数及其调用 - 删除 mergeEndpoints 中对重试列的引用 - 删除前端 modal 中重复的重试设置翻译(保留 settings 部分) - 修复 Validate 函数在读锁下修改状态的并发安全问题 - 改进 SetRetrySettings 验证逻辑,返回错误而非静默修正 - 添加 requestID 用于请求日志追踪 重试设置现在完全作为全局配置存储在 app_config 表中。
50ce792 to
4147a9f
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
| retryCountInvalid: 'Retry count must be between 1 and 10', | ||
| retryDelayInvalid: 'Retry delay must be between 0 and 300 seconds', |
There was a problem hiding this comment.
Duplicate translation keys. The keys retryCountInvalid and retryDelayInvalid are already defined in the endpoints section (lines 69-70). These duplicate entries in the settings section should be removed to avoid confusion and maintain a single source of truth for these error messages.
| retryCountInvalid: 'Retry count must be between 1 and 10', | |
| retryDelayInvalid: 'Retry delay must be between 0 and 300 seconds', |
| // GetRetryCount returns the global retry count (thread-safe) | ||
| func (c *Config) GetRetryCount() int { | ||
| c.mu.RLock() | ||
| defer c.mu.RUnlock() | ||
| if c.RetryCount <= 0 { | ||
| return 2 | ||
| } | ||
| return c.RetryCount | ||
| } | ||
|
|
||
| // GetRetryDelaySec returns the global retry delay in seconds (thread-safe) | ||
| func (c *Config) GetRetryDelaySec() int { | ||
| c.mu.RLock() | ||
| defer c.mu.RUnlock() | ||
| if c.RetryDelaySec < 0 { | ||
| return 0 | ||
| } | ||
| return c.RetryDelaySec | ||
| } |
There was a problem hiding this comment.
Inconsistent validation between Validate() and getter methods. The Validate() method (lines 82-87) rejects RetryCount values less than 1, but GetRetryCount() (lines 136-138) accepts 0 and returns 2 as a fallback. Similarly, Validate() allows RetryDelaySec of 0, but GetRetryDelaySec() (lines 146-148) checks for negative values. This inconsistency could lead to confusion. Consider either:
- Aligning the validation to match the getter logic, or
- Making the getters simply return the values without fallback logic and rely on validation
|
|
||
|
|
There was a problem hiding this comment.
[nitpick] Unnecessary blank lines added. These two empty lines serve no purpose and should be removed to maintain code consistency.
| retryCountInvalid: '重试次数需在 1-10 之间', | ||
| retryDelayInvalid: '重试间隔需在 0-300 秒之间', |
There was a problem hiding this comment.
Duplicate translation keys. The keys retryCountInvalid and retryDelayInvalid are already defined in the endpoints section (lines 69-70). These duplicate entries in the settings section should be removed to avoid confusion and maintain a single source of truth for these error messages.
| retryCountInvalid: '重试次数需在 1-10 之间', | |
| retryDelayInvalid: '重试间隔需在 0-300 秒之间', |
|
兄弟你那边不用改了 ,已经把代码还原了,那2个功能实用性不大,已经去除了 |

Uh oh!
There was an error while loading. Please reload this page.