Skip to content

Comments

feat: add global retry settings and endpoint filtering#38

Merged
lich0821 merged 2 commits intolich0821:masterfrom
spongehah:feat-retrycount
Dec 2, 2025
Merged

feat: add global retry settings and endpoint filtering#38
lich0821 merged 2 commits intolich0821:masterfrom
spongehah:feat-retrycount

Conversation

@spongehah
Copy link
Contributor

@spongehah spongehah commented Nov 30, 2025

  • 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

Copilot AI review requested due to automatic review settings November 30, 2025 11:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

spongehah added a commit to spongehah/ccNexus that referenced this pull request Dec 1, 2025
解决 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 表中。
Copilot AI review requested due to automatic review settings December 2, 2025 11:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +164 to +165
retryCountInvalid: 'Retry count must be between 1 and 10',
retryDelayInvalid: 'Retry delay must be between 0 and 300 seconds',
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
retryCountInvalid: 'Retry count must be between 1 and 10',
retryDelayInvalid: 'Retry delay must be between 0 and 300 seconds',

Copilot uses AI. Check for mistakes.
Comment on lines +132 to +150
// 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
}
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Aligning the validation to match the getter logic, or
  2. Making the getters simply return the values without fallback logic and rely on validation

Copilot uses AI. Check for mistakes.
Comment on lines +113 to +114


Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Unnecessary blank lines added. These two empty lines serve no purpose and should be removed to maintain code consistency.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +164 to +165
retryCountInvalid: '重试次数需在 1-10 之间',
retryDelayInvalid: '重试间隔需在 0-300 秒之间',
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
retryCountInvalid: '重试次数需在 1-10 之间',
retryDelayInvalid: '重试间隔需在 0-300 秒之间',

Copilot uses AI. Check for mistakes.
@lich0821 lich0821 merged commit 81ece2b into lich0821:master Dec 2, 2025
13 checks passed
lich0821 added a commit that referenced this pull request Dec 5, 2025
@hea7enn
Copy link
Contributor

hea7enn commented Dec 5, 2025

  • 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导致bug了,现在只要拖动排序就会报错,无法排序了,你新增的分组引起的,感觉这个分组功能没多大必要,一个配置的端点数量不会很庞大需要分组来显示,另外界面上多加这3个按钮也感觉不太好看,看是否可以删除这个功能还原到原始代码,请修复这个报错问题
image

@hea7enn
Copy link
Contributor

hea7enn commented Dec 5, 2025

兄弟你那边不用改了 ,已经把代码还原了,那2个功能实用性不大,已经去除了

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.

3 participants