-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: Add decision limit selector with 5/10/20/50 options #638
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
Conversation
🤖 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. |
25257db to
9fb9b82
Compare
🤖 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. |
9fb9b82 to
f69bde3
Compare
🤖 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. |
代码审查报告 - PR #638📋 基本信息
1️⃣ 业务逻辑审查✅ 问题定义用户痛点: 决策记录显示数量固定(5条),无法查看更多历史
时间覆盖不足: ✅ 解决方案验证功能设计:
业务价值: ✅ 显著提升用户体验
2️⃣ 技术实现审查✅ 后端实现 -
|
| 维度 | 评分 | 说明 |
|---|---|---|
| 业务价值 | ⭐⭐⭐⭐⭐ | 显著提升远程监控体验 |
| 技术实现 | ⭐⭐⭐⭐⭐ | 代码简洁,向后兼容,性能优化 |
| 安全性 | ⭐⭐⭐⭐⭐ | 完善的输入验证和性能保护 |
| 可维护性 | ⭐⭐⭐⭐⭐ | 最小侵入,易于理解和扩展 |
🎯 核心价值
- 用户体验: 灵活查看历史,满足不同场景需求
- 性能优化: SWR缓存隔离,50条限制保护服务器
- 向后兼容: 默认行为不变,无破坏性变更
🔧 行动建议
必须修复: 无
强烈建议:
- 增强localStorage读取安全性(验证
parseInt结果是否为NaN) - 添加
try-catch处理localStorage禁用情况(隐私模式)
可选优化:
- 添加单元测试(API层和组件层)
- 添加
aria-label提升可访问性 - 考虑添加"自定义"选项(让用户输入任意值1-50)
- 添加Tooltip说明每个选项对应的时间覆盖(如"5 (约15分钟)")
🌟 特别表扬
实现亮点:
- 文档完善: PR描述包含时间覆盖表格、测试清单、性能分析
- 向后兼容: 完全兼容现有API调用,无需迁移
- 用户体验: 持久化偏好,立即生效,国际化支持
建议后续工作:
- 收集用户反馈(是否需要更大的limit,如100/200)
- 添加分析功能(基于更多历史决策的AI策略评估)
- 考虑添加"导出"功能(导出选定数量的决策为CSV)
总评: 这是一个高质量、低风险的用户体验改进。代码简洁、向后兼容、性能优化到位,建议合并。localStorage读取建议增强验证,其他均符合生产级标准。
审查时间: 2025-11-08
审查者: Claude AI Code Reviewer
|
Pls help fix conflicts and will be merged. This is a good point. |
f69bde3 to
62786ee
Compare
Fixed the conflict |
🤖 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 💡 Suggestion: This is a large PR. Consider breaking it into smaller, focused PRs for easier review. 🔧 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. |
## Summary Allow users to select the number of decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage. ## Changes ### Backend - api/server.go: Add 'limit' query parameter support to /api/decisions/latest - Default: 5 (maintains current behavior) - Max: 50 (prevents excessive data loading) - Fully backward compatible ### Frontend - web/src/lib/api.ts: Update getLatestDecisions() to accept limit parameter - web/src/pages/TraderDashboard.tsx: - Add decisionLimit state management with localStorage persistence - Add dropdown selector UI (5/10/20/50 options) - Pass limit to API calls and update SWR cache key ## Time Coverage - 5 records = 15 minutes (default, quick check) - 10 records = 30 minutes (short-term review) - 20 records = 1 hour (medium-term analysis) - 50 records = 2.5 hours (deep pattern analysis)
62786ee to
2933c84
Compare
🤖 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. |
Includes: - PR NoFxAiOS#931: Fix Go formatting for test files - PR NoFxAiOS#800: Data staleness detection (Part 2/3) - already in z-dev-v2 - PR NoFxAiOS#918: Improve UX messages for empty states and error feedback - PR NoFxAiOS#922: Fix missing system_prompt_template field in trader edit - PR NoFxAiOS#921: Remove duplicate exchange config fields (Aster & Hyperliquid) - PR NoFxAiOS#917: Fix two-stage private key input validation (0x prefix support) - PR NoFxAiOS#713: Add backend safety checks for partial_close - PR NoFxAiOS#908: Web Crypto environment check (0xEmberZz) - PR NoFxAiOS#638: Decision limit selector with 5/10/20/50 options (xqliu) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> # Conflicts: # market/data.go # web/src/components/TwoStageKeyModal.tsx
## Summary Allow users to select the number of decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage. ## Changes ### Backend - api/server.go: Add 'limit' query parameter support to /api/decisions/latest - Default: 5 (maintains current behavior) - Max: 50 (prevents excessive data loading) - Fully backward compatible ### Frontend - web/src/lib/api.ts: Update getLatestDecisions() to accept limit parameter - web/src/pages/TraderDashboard.tsx: - Add decisionLimit state management with localStorage persistence - Add dropdown selector UI (5/10/20/50 options) - Pass limit to API calls and update SWR cache key ## Time Coverage - 5 records = 15 minutes (default, quick check) - 10 records = 30 minutes (short-term review) - 20 records = 1 hour (medium-term analysis) - 50 records = 2.5 hours (deep pattern analysis)
## Summary Allow users to select the number of decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage. ## Changes ### Backend - api/server.go: Add 'limit' query parameter support to /api/decisions/latest - Default: 5 (maintains current behavior) - Max: 50 (prevents excessive data loading) - Fully backward compatible ### Frontend - web/src/lib/api.ts: Update getLatestDecisions() to accept limit parameter - web/src/pages/TraderDashboard.tsx: - Add decisionLimit state management with localStorage persistence - Add dropdown selector UI (5/10/20/50 options) - Pass limit to API calls and update SWR cache key ## Time Coverage - 5 records = 15 minutes (default, quick check) - 10 records = 30 minutes (short-term review) - 20 records = 1 hour (medium-term analysis) - 50 records = 2.5 hours (deep pattern analysis)
## Summary Allow users to select the number of decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage. ## Changes ### Backend - api/server.go: Add 'limit' query parameter support to /api/decisions/latest - Default: 5 (maintains current behavior) - Max: 50 (prevents excessive data loading) - Fully backward compatible ### Frontend - web/src/lib/api.ts: Update getLatestDecisions() to accept limit parameter - web/src/pages/TraderDashboard.tsx: - Add decisionLimit state management with localStorage persistence - Add dropdown selector UI (5/10/20/50 options) - Pass limit to API calls and update SWR cache key ## Time Coverage - 5 records = 15 minutes (default, quick check) - 10 records = 30 minutes (short-term review) - 20 records = 1 hour (medium-term analysis) - 50 records = 2.5 hours (deep pattern analysis)
## Summary Allow users to select the number of decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage. ## Changes ### Backend - api/server.go: Add 'limit' query parameter support to /api/decisions/latest - Default: 5 (maintains current behavior) - Max: 50 (prevents excessive data loading) - Fully backward compatible ### Frontend - web/src/lib/api.ts: Update getLatestDecisions() to accept limit parameter - web/src/pages/TraderDashboard.tsx: - Add decisionLimit state management with localStorage persistence - Add dropdown selector UI (5/10/20/50 options) - Pass limit to API calls and update SWR cache key ## Time Coverage - 5 records = 15 minutes (default, quick check) - 10 records = 30 minutes (short-term review) - 20 records = 1 hour (medium-term analysis) - 50 records = 2.5 hours (deep pattern analysis)
📝 Summary
Add a dropdown selector to allow users to choose how many decision records to display (5/10/20/50) in the Web UI, with persistent storage in localStorage.
Fixes #639
效果如下图
chrome-capture-2025-11-06.mp4
🎯 Motivation
Users need to review AI decision history beyond the default 5 records (15 mins). Remote server access is not always available, and the Web UI is the primary way to monitor trading activity - especially when accessing from mobile devices or outside the office.
🎨 Changes
Backend Changes
api/server.go(Line 1292-1298): Addlimitquery parameter support to/api/decisions/latestFrontend Changes
web/src/lib/api.ts(Line 222-238): UpdategetLatestDecisions()to acceptlimitparameterweb/src/App.tsx:decisionLimitstate management with localStorage persistence (Line 65-75)Documentation
docs/decision-limit-feature-design.md: Complete technical design documentdocs/feature-tickets/FEATURE-001-decision-limit-selector.md: Feature ticket with requirements📊 Time Coverage
✅ Backward Compatibility
Fully backward compatible:
limitparameter is not provided🧪 Testing
📈 Performance Impact
🎬 Demo Video
[录屏演示将在这里添加]
Demo will show:
📚 Related Documentation
🚀 Deployment Status
📝 Checklist
Type: Feature Enhancement
Priority: Medium
Risk: Low
Effort: ~1 hour
Resolves: FEATURE-001