-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(web): restore missing system_prompt_template field in trader edit request #922
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
fix(web): restore missing system_prompt_template field in trader edit request #922
Conversation
修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR NoFxAiOS#872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR NoFxAiOS#872: UI 重構時遺漏 - commit c1f080f: 原始添加 system_prompt_template 支持 - commit e58fc3c: 修復 types.ts 缺失字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 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. |
補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 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
… request (NoFxAiOS#922) * fix(web): restore missing system_prompt_template in handleSaveEditTrader 修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR NoFxAiOS#872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR NoFxAiOS#872: UI 重構時遺漏 - commit c1f080f: 原始添加 system_prompt_template 支持 - commit e58fc3c: 修復 types.ts 缺失字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(types): add missing system_prompt_template field to TraderConfigData 補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: the-dev-z <the-dev-z@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
… request (#922) * fix(web): restore missing system_prompt_template in handleSaveEditTrader 修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR #872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR #872: UI 重構時遺漏 - commit c1f080f: 原始添加 system_prompt_template 支持 - commit e58fc3c: 修復 types.ts 缺失字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community <tinklefund@gmail.com> * fix(types): add missing system_prompt_template field to TraderConfigData 補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community <tinklefund@gmail.com> --------- Co-authored-by: the-dev-z <the-dev-z@users.noreply.github.com> Co-authored-by: tinkle-community <tinklefund@gmail.com>
… request (#922) * fix(web): restore missing system_prompt_template in handleSaveEditTrader 修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR #872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR #872: UI 重構時遺漏 - commit c1f080f: 原始添加 system_prompt_template 支持 - commit e58fc3c: 修復 types.ts 缺失字段 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community <tinklefund@gmail.com> * fix(types): add missing system_prompt_template field to TraderConfigData 補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: tinkle-community <tinklefund@gmail.com> --------- Co-authored-by: the-dev-z <the-dev-z@users.noreply.github.com> Co-authored-by: tinkle-community <tinklefund@gmail.com>
… request (#922) * fix(web): restore missing system_prompt_template in handleSaveEditTrader 修復編輯交易員時策略模板無法保存的問題。 Issue: - 用戶編輯交易員時,選擇的策略模板(system_prompt_template)沒有被保存 - 重新打開編輯窗口,總是顯示默認值 - 用戶困惑為什麼策略模板無法持久化 Root Cause: - PR #872 在 UI 重構時遺漏了 system_prompt_template 字段 - handleSaveEditTrader 的 request 對象缺少 system_prompt_template - 導致更新請求不包含策略模板信息 Fix: - 在 handleSaveEditTrader 的 request 對象中添加 system_prompt_template 字段 - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與後端 API 和 TraderConfigModal 保持一致 Result: - 編輯交易員時,策略模板正確保存 - 重新打開編輯窗口,顯示正確的已保存值 - 用戶可以成功切換和保存不同的策略模板 Technical Details: - web/src/types.ts TraderConfigData 接口已有 system_prompt_template ✓ - Backend handleUpdateTrader 接收並保存 SystemPromptTemplate ✓ - Frontend TraderConfigModal 表單提交包含 system_prompt_template ✓ - Frontend handleSaveEditTrader request 缺失此字段 ✗ → ✓ (已修復) Related: - PR #872: UI 重構時遺漏 - commit c1f080f: 原始添加 system_prompt_template 支持 - commit e58fc3c: 修復 types.ts 缺失字段 Co-Authored-By: tinkle-community <tinklefund@gmail.com> * fix(types): add missing system_prompt_template field to TraderConfigData 補充完整修復:確保 TypeScript 類型定義與 API 使用一致。 Issue: - AITradersPage.tsx 提交時包含 system_prompt_template 字段 - 但 TraderConfigData 接口缺少此字段定義 - TypeScript 類型不匹配 Fix: - 在 TraderConfigData 接口添加 system_prompt_template: string - 位置:override_base_prompt 之後,is_cross_margin 之前 - 與 CreateTraderRequest 保持一致 Result: - TypeScript 類型完整 - 編輯交易員時正確加載和保存策略模板 - 無類型錯誤 Technical: - web/src/types.ts Line 200 - 與後端 SystemPromptTemplate 字段對應 Co-Authored-By: tinkle-community <tinklefund@gmail.com> --------- Co-authored-by: the-dev-z <the-dev-z@users.noreply.github.com> Co-authored-by: tinkle-community <tinklefund@gmail.com>
Pull Request - Frontend | 前端 PR
📝 Description | 描述
English:
This PR fixes a critical bug where the
system_prompt_template(strategy template) selection is not persisted when editing a trader. Users would select a strategy template, save the changes, but upon reopening the edit modal, the selection would revert to the default value instead of showing their saved choice.中文:
修复编辑交易员时策略模板(system_prompt_template)选择无法保存的严重问题。用户选择策略模板并保存后,重新打开编辑窗口时,选择会恢复为默认值而非用户保存的值。
🎯 Type of Change | 变更类型
🔗 Related Issues | 相关 Issue
用户反馈:编辑交易员时,策略模板选择无法持久化
📋 Changes Made | 具体变更
English:
system_prompt_templatefield inhandleSaveEditTraderrequest object (line 289 in AITradersPage.tsx)中文:
handleSaveEditTrader请求对象中恢复缺失的system_prompt_template字段(AITradersPage.tsx 第 289 行)🐛 Root Cause Analysis | 根本原因分析
Timeline:
system_prompt_templatefield support added to trader edit functionalityImpact:
system_prompt_templatevalue when opening editsystem_prompt_templatein the form datahandleSaveEditTraderfunction was missing this field in the API request objectFix:
Added one line (289) in the request object construction:
Now the complete flow works:
🧪 Testing | 测试
Test Environment | 测试环境
Manual Testing | 手动测试
🌐 Internationalization | 国际化
✅ Checklist | 检查清单
Code Quality | 代码质量
Testing | 测试
Documentation | 文档
Git
devbranch | 已 rebase 到最新dev分支📚 Additional Notes | 补充说明
English:
This is a regression fix. The field was working correctly after c1f080f but was lost during the PR #872 refactoring. This affects all users editing traders with custom strategy templates.
中文:
这是一个回归修复。该字段在 c1f080f 之后工作正常,但在 PR #872 重构期间丢失。影响所有使用自定义策略模板编辑交易员的用户。
By submitting this PR, I confirm | 提交此 PR,我确认:
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com