-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(ui): display strategy template in trader card #923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
feat(ui): display strategy template in trader card #923
Conversation
Beta Competition kline count change to 5
Replace the inline header implementation in main app with HeaderBar component to match landing page: - Remove duplicate inline header code (168 lines) - Use HeaderBar component for all main app pages like landing page does - Ensure consistent header design across all routes (/competition, /traders, /dashboard) - Maintain proper onPageChange navigation handling - Keep all header functionality (user info, admin mode, language toggle, logout) This fixes the header inconsistency where different pages used different header implementations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…cture Revert PR NoFxAiOS#229: Remove UT infrastructure
…app pages Match main app layout with proven working /competition route layout: - Use px-6 py-6 pt-24 padding (same as /competition route) - Ensures HeaderBar doesn't overlap content on /traders and /dashboard pages - Provides consistent 6rem (96px) top clearance for fixed positioned HeaderBar - Removes responsive padding variants that differed from competition page This fixes header overlap issues across all main application routes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
# Conflicts: # api/server.go
Resolved conflicts in: - api/server.go: Preserved beta_mode config and user permission checks - manager/trader_manager.go: Kept optimized concurrent competition data with caching Maintained all performance optimizations while merging new features from dev. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…y-markers chore(web): add peer dependency markers to package-lock.json
Removed unused 'Zap' import from App.tsx that was causing build failure. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
fix: resolve go vet warnings for non-constant format strings
Removed App.test.tsx and AITradersPage.test.tsx that were causing TypeScript build issues and are not currently in use. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Removed test script from package.json - Removed testing dependencies (@testing-library/react, vitest, jsdom) - Deleted test directory and vitest.config.ts - Updated package-lock.json to reflect changes - Build still works perfectly without test dependencies 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Beta Merge dev、Bug fix
The chart was not showing data because the API response format changed. Fixed the calculation of PnL percentage by computing it from total_pnl and balance values (initial_balance = balance - total_pnl). Now the AI competition chart should properly display performance comparison data. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add NOFX watermark to ComparisonChart (competition page) - Add NOFX watermark to EquityChart (dashboard page) - Fix empty state handling and internationalization in CompetitionPage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Beta bugfix
Fix(workflow): add title and size validation comments
fix(readme): update readme and pr reviewer
…ssing-fields fix(database): GetTraderConfig missing critical fields causes edit to fail
Fix:fix the main branch history issue from November 3rd.
Merge pull request NoFxAiOS#395 from NoFxAiOS/beta fix:fix the main branch history issue from November 3rd.
…oFxAiOS#852) - Add visual diagrams to explain override_base_prompt behavior - Clarify the difference between "append" (false) and "replace" (true) modes - Add warning messages for advanced users about risks - Update maintainer to "Nofx Team CoderMageFox" - Improve both English and Chinese documentation This change addresses user confusion about the override_base_prompt setting by providing clear visual explanations and practical examples. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
NoFxAiOS#860) 修复密码验证UI组件与验证逻辑之间的特殊字符不一致问题。 问题描述: - PasswordChecklist组件默认接受所有特殊字符(如^_-~等) - 实际验证函数isStrongPassword()仅接受@#$%!&*?共8个特殊字符 - 导致用户输入包含其他特殊字符时,UI显示绿色勾选但注册按钮仍禁用 修改内容: - 在RegisterPage.tsx的PasswordChecklist组件添加specialCharsRegex属性 - 限制特殊字符为/[@#$%!&*?]/,与isStrongPassword()保持一致 影响范围: - 仅影响注册页面的密码验证UI显示 - 不影响后端验证逻辑 - 提升用户体验,避免误导性的UI反馈 Closes NoFxAiOS#859 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
) * Support 3m volume and ATR4 * test(market): add unit tests for Volume and ATR14 indicators - Add comprehensive tests for calculateIntradaySeries Volume collection - Add tests for ATR14 calculation with various data scenarios - Add edge case tests for insufficient data - Test Volume value precision and consistency with other indicators - All 8 test cases pass successfully Resolves code review blocking issue from PR NoFxAiOS#830
# Conflicts: # decision/engine.go
* fix(auth): allow re-fetching OTP for unverified users
**Problem:**
- User registers but interrupts OTP setup
- Re-registration returns "邮箱已被注册" error
- User stuck, cannot retrieve QR code to complete setup
**Root Cause:**
- handleRegister rejects all existing emails without checking OTPVerified status
- No way for users to recover from interrupted registration
**Fix:**
- Check if existing user has OTPVerified=false
- If unverified, return original OTP QR code instead of error
- User can continue completing registration with same user_id
- If verified, still reject with "邮箱已被注册" (existing behavior)
**Code Changes:**
```go
// Before:
_, err := s.database.GetUserByEmail(req.Email)
if err == nil {
c.JSON(http.StatusConflict, gin.H{"error": "邮箱已被注册"})
return
}
// After:
existingUser, err := s.database.GetUserByEmail(req.Email)
if err == nil {
if !existingUser.OTPVerified {
// Return OTP to complete registration
qrCodeURL := auth.GetOTPQRCodeURL(existingUser.OTPSecret, req.Email)
c.JSON(http.StatusOK, gin.H{
"user_id": existingUser.ID,
"otp_secret": existingUser.OTPSecret,
"qr_code_url": qrCodeURL,
"message": "检测到未完成的注册,请继续完成OTP设置",
})
return
}
c.JSON(http.StatusConflict, gin.H{"error": "邮箱已被注册"})
return
}
```
**Testing Scenario:**
1. User POST /api/register with email + password
2. User receives OTP QR code but closes browser (interrupts)
3. User POST /api/register again with same email + password
4. ✅ Now returns original OTP instead of error
5. User can complete registration via /api/complete-registration
**Security:**
✅ No security issue - still requires OTP verification
✅ Only returns OTP for unverified accounts
✅ Password not validated on re-fetch (same as initial registration)
**Impact:**
✅ Users can recover from interrupted registration
✅ Better UX for registration flow
✅ No breaking changes to existing verified users
**API Changes:**
- POST /api/register response for unverified users:
- Status: 200 OK (was: 409 Conflict)
- Body includes: user_id, otp_secret, qr_code_url, message
Fixes NoFxAiOS#615
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* test(api): add comprehensive unit tests for OTP re-fetch logic
- Test OTP re-fetch logic for unverified users
- Test OTP verification state handling
- Test complete registration flow scenarios
- Test edge cases (ID=0, empty OTPSecret, verified users)
All 11 test cases passed, covering:
1. OTPRefetchLogic (3 cases): new user, unverified refetch, verified rejection
2. OTPVerificationStates (2 cases): verified/unverified states
3. RegistrationFlow (3 cases): first registration, interrupted resume, duplicate attempt
4. EdgeCases (3 cases): validates behavior with edge conditions
Related to PR NoFxAiOS#653 - ensures proper OTP re-fetch behavior for unverified users.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
* style: apply go fmt after rebase
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: ZhouYongyou <[email protected]>
Co-authored-by: Claude <[email protected]>
…S#678) * fix(web): display '—' for missing data instead of NaN% or 0% (NoFxAiOS#633) - Add hasValidData validation for null/undefined/NaN - Display '—' for invalid trader.total_pnl_pct - Only show gap calculations when both values are valid - Prevents misleading users with 0% when data is missing Fixes NoFxAiOS#633 * test(web): add comprehensive unit tests for CompetitionPage NaN handling - Test data validation logic (null/undefined/NaN detection) - Test gap calculation with valid and invalid data - Test display formatting (shows '—' instead of 'NaN%') - Test leading/trailing message display conditions - Test edge cases (Infinity, very small/large numbers) All 25 test cases passed, covering: 1. hasValidData check (7 cases): valid/null/undefined/NaN/zero/negative 2. gap calculation (3 cases): valid data, invalid data, negative gap 3. display formatting (6 cases): positive/negative/null/undefined/NaN/zero 4. leading/trailing messages (5 cases): conditional display logic 5. edge cases (4 cases): Infinity, -Infinity, very small/large numbers Related to PR NoFxAiOS#678 - ensures missing data displays as '—' instead of 'NaN%'. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: ZhouYongyou <[email protected]> Co-authored-by: Claude <[email protected]>
## 🐛 问题描述 币安交易所配置页面中的服务器IP复制功能无法正常工作 ## 🔍 根因分析 原始实现仅使用 navigator.clipboard.writeText() API: - 在某些浏览器环境下不可用或被阻止 - 需要 HTTPS 或 localhost 环境 - 缺少错误处理和用户反馈 ## ✅ 修复方案 1. **双重降级机制**: - 优先使用现代 Clipboard API - 降级到传统 execCommand 方法 2. **错误处理**: - 添加 try-catch 错误捕获 - 失败时显示友好的错误提示 - 提供IP地址供用户手动复制 3. **多语言支持**: - 添加 copyIPFailed 翻译键(中英文) ## 📝 修改文件 - web/src/components/AITradersPage.tsx - handleCopyIP 函数重构为异步函数 - 添加双重复制机制和错误处理 - web/src/i18n/translations.ts - 添加 copyIPFailed 错误提示翻译 ## 🧪 测试验证 ✅ TypeScript 编译通过 ✅ Vite 构建成功 ✅ 支持现代和传统浏览器环境 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
* fix(decision): 添加槓桿超限 fallback 機制並澄清盈虧計算說明 1. AI 決策輸出超限槓桿時(如 20x),驗證直接拒絕導致整個交易週期失敗 2. Prompt 未明確說明盈虧百分比已包含槓桿效應,導致 AI 思維鏈中誤用價格變動% - **Before**: 超限直接報錯 → 決策失敗 - **After**: 自動降級為配置上限 → 決策繼續執行 - **效果**: SOLUSDT 20x → 自動修正為 5x(配置上限) - 明確告知 AI:系統提供的「盈虧%」已包含槓桿效應 - 公式: 盈虧% = (未實現盈虧 / 保證金) × 100 - 示例: 5x 槓桿,價格漲 2% = 實際盈利 10% - 測試山寨幣超限修正(20x → 5x) - 測試 BTC/ETH 超限修正(20x → 10x) - 測試正常範圍不修正 - 測試無效槓桿拒絕 ``` PASS: TestLeverageFallback/山寨币杠杆超限_自动修正为上限 PASS: TestLeverageFallback/BTC杠杆超限_自动修正为上限 PASS: TestLeverageFallback/杠杆在上限内_不修正 PASS: TestLeverageFallback/杠杆为0_应该报错 ``` - ✅ 向後兼容:正常槓桿範圍不受影響 - ✅ 容錯性增強:AI 輸出超限時系統自動修正 - ✅ 決策質量提升:AI 對槓桿收益有正確認知 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * style: apply go fmt after rebase 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: ZhouYongyou <[email protected]> Co-authored-by: Claude <[email protected]>
…xAiOS#796) * fix(trader): add mutex to prevent race condition in Meta refresh (issue NoFxAiOS#742) **問題**: 根據 issue NoFxAiOS#742 審查標準,發現 BLOCKING 級別的並發安全問題: - refreshMetaIfNeeded() 中的 `t.meta = meta` 缺少並發保護 - 多個 goroutine 同時調用 OpenLong/OpenShort 會造成競態條件 **修復**: 1. 添加 sync.RWMutex 保護 meta 字段 2. refreshMetaIfNeeded() 使用寫鎖保護 meta 更新 3. getSzDecimals() 使用讀鎖保護 meta 訪問 **符合標準**: - issue NoFxAiOS#742: "並發安全問題需使用 sync.Once 等機制" - 使用 RWMutex 實現讀寫分離,提升並發性能 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * test(trader): add comprehensive race condition tests for meta field mutex protection - Test concurrent reads (100 goroutines accessing getSzDecimals) - Test concurrent read/write (50 readers + 10 writers simulating meta refresh) - Test nil meta edge case (returns default value 4) - Test valid meta with multiple coins (BTC, ETH, SOL) - Test massive concurrency (1000 iterations with race detector) All 5 test cases passed, including -race verification with no data races detected. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: ZhouYongyou <[email protected]> Co-authored-by: Claude <[email protected]>
…FxAiOS#833) * feat: 启动交易员时自动重新加载系统提示词模板 ## 改动内容 - 在 handleStartTrader 中调用 decision.ReloadPromptTemplates() - 每次启动交易员时从硬盘重新加载 prompts/ 目录下的所有 .txt 模板文件 - 添加完整的单元测试和端到端集成测试 ## 测试覆盖 - 单元测试:模板加载、获取、重新加载功能 - 集成测试:文件修改 → 重新加载 → 决策引擎使用新内容的完整流程 - 并发测试:验证多 goroutine 场景下的线程安全性 - Race detector 测试通过 ## 用户体验改进 - 修改 prompt 文件后无需重启服务 - 只需停止交易员再启动即可应用新的 prompt - 控制台会输出重新加载成功的日志提示 * feat: 在重新加载日志中显示当前使用的模板名称 * feat: fallback 到 default 模板时明确显示原因 * fix: correct GetTraderConfig return type to get SystemPromptTemplate * refactor: extract reloadPromptTemplatesWithLog as reusable method
…ced Layout System, and Integrated React Router (NoFxAiOS#872)
在交易員卡片顯示當前使用的策略模板,提升用戶體驗。 Changes: **Backend (api/server.go):** - handleTraderList: 添加 system_prompt_template 到 API 返回 - 與 handleGetTraderConfig 保持一致 **Frontend (web/src/types.ts):** - TraderInfo: 添加 system_prompt_template 可選字段 **Frontend (web/src/components/AITradersPage.tsx):** - 新增 getStrategyTemplateKey() helper function - 交易員卡片顯示策略模板名稱(翻譯後) - 位置:Model • EXCHANGE 下方 **Frontend (web/src/i18n/translations.ts):** - 添加 'strategy' 翻譯 (EN: Strategy, ZH: 策略) - 已有策略模板翻譯keys: promptTemplateDefault, promptTemplateAdaptive 等 Result: - 交易員卡片現在顯示: - 交易員名稱 - AI 模型 • 交易所 - 策略: 默认稳健 / 激进策略 等 - 運行狀態 User Experience: - 用戶可以快速識別每個交易員使用的策略 - 無需點擊編輯才能查看策略設置 - 提升信息透明度 Technical Details: - 策略模板映射: default → 默认稳健, adaptive → 保守策略 等 - 支持 6 種策略: default, adaptive, adaptive_relaxed, Hansen, nof1, taro_long_prompts - 如果 system_prompt_template 為空,不顯示策略行(兼容舊數據) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
🤖 Advisory Check ResultsThese are advisory checks to help improve code quality. They won't block your PR from being merged. 📋 PR InformationTitle Format: ✅ Good - Follows Conventional Commits 🔧 Backend ChecksGo Formatting: Files needing formattingGo Vet: ✅ Good Fix locally: go fmt ./... # Format code
go vet ./... # Check for issues
go test ./... # Run tests⚛️ Frontend ChecksBuild & Type Check: ✅ Success Fix locally: cd web
npm run build # Test build (includes type checking)📖 ResourcesQuestions? Feel free to ask in the comments! 🙏 These checks are advisory and won't block your PR from being merged. This comment is automatically generated from pr-checks-run.yml. |
43aad91 to
5517269
Compare
02cb78a to
7bd5ca0
Compare
Summary
在交易員卡片顯示當前使用的策略模板,提升用戶體驗。
Changes
Backend (api/server.go):
Frontend (web/src/types.ts):
Frontend (web/src/components/AITradersPage.tsx):
Frontend (web/src/i18n/translations.ts):
Result
User Experience
Technical Details
Testing
go fmt🤖 Generated with Claude Code