Commit Graph

401 Commits

Author SHA1 Message Date
Roninchen
b336efde0f Merge pull request #176 from yuanshi2016/dev
Kline获取方式为Websocket缓存
2025-11-02 21:54:16 +08:00
tinkle-community
37c98c9626 Merge pull request #257 from SkywalkerJi/dev
Google Tag Manager
2025-11-02 21:47:38 +08:00
SkywalkerJi
4850aa568e Google Tag Manager 2025-11-02 21:44:53 +08:00
ZhouYongyou
fed3ce95f3 fix: 修复部分平仓盈利计算错误
问题:部分平仓时,历史记录显示的是全仓位盈利,而非实际平仓部分的盈利

根本原因:
- AnalyzePerformance 使用开仓总数量计算部分平仓的盈利
- 应该使用 action.Quantity(实际平仓数量)而非 openPos["quantity"](总数量)

修复:
- 添加 actualQuantity 变量区分完整平仓和部分平仓
- partial_close 使用 action.Quantity
- 所有相关计算(PnL、PositionValue、MarginUsed)都使用 actualQuantity

影响范围:logger/decision_logger.go:428-465

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 21:26:58 +08:00
tinkle-community
e9f6ded053 Merge pull request #246 from xqliu/fix/model-config-validation-245 2025-11-02 18:32:45 +08:00
Liu Xiang Qian
4577adabbd fix: Update model validation in handleSaveModelConfig to support both configured and supported models
- Change validation to check allModels first, then supportedModels
- This allows saving new model configurations without "model does not exist" error
- Fixes issue where users couldn't save AI model config after selecting from dropdown

Fixes #245

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 18:08:25 +08:00
yuanshi2016
95c32fcb2e 修改Kline获取方式为Websocket缓存。 2025-11-02 17:59:19 +08:00
yuanshi2016
3b1db6f64f K线获取方式改为websocket组合流. 带重拨机制
流程为下:
1. 启动时使用所有交易员设置的币种(去重) 如果交易员未配置,则使用系统默认
2. 在决策获取K线时 如果没有缓存 则先实时获取后再添加订阅. ps: 适用于Api方式的币种列表
2025-11-02 14:03:13 +08:00
原始
1862223528 Merge branch 'tinkle-community:dev' into dev 2025-11-02 14:02:11 +08:00
Xeron
5c9b396e5a fix: detect and record stop-loss/take-profit auto-close trades
Fixes #200

Previously, positions closed via stop-loss or take-profit were not
recorded in decision logs, causing inaccurate performance metrics
(win rate, profit factor, etc.) displayed in the frontend.

This commit implements a position snapshot mechanism to detect
auto-closed positions by comparing positions between trading cycles.

Changes:
- Add PositionSnapshot struct to track position state
- Add detectAutoClosedPositions() to detect disappeared positions
- Update position snapshots at cycle end (after AI execution)
- Support auto_close_long/auto_close_short action types in logger
- Ensure accurate performance analysis including auto-closed trades

Key fix:
- Snapshots are updated AFTER AI execution to avoid false positives
- AI manual closes won't be mistakenly detected as auto-closes
2025-11-02 12:35:37 +08:00
tinkle
4f8be19a73 update aster exchange guide 2025-11-02 12:23:33 +08:00
原始
ebfdf4b9b6 Merge branch 'tinkle-community:dev' into dev 2025-11-02 12:19:40 +08:00
tinkle
23392e7409 update aster exchange guide 2025-11-02 12:15:40 +08:00
Liu Xiang Qian
8b4c107dfd docs: Enhance timestamp/timezone troubleshooting based on Issue #60
Enhanced the Exchange API errors section with more detailed solutions
for timestamp-related failures, based on Issue #60.

Problem:
- code=-1021: Timestamp outside of recvWindow
- System time not synced with Binance servers
- Docker container time drift

Enhanced Solutions:
1. System Time Sync (Multiple methods)
   - ntpdate pool.ntp.org (recommended)
   - ntpdate with different NTP servers
   - timedatectl for automatic sync
   - Aliyun NTP for China users

2. Docker-specific fixes
   - Check container time vs host time
   - Restart Docker service
   - Add TZ environment variable

3. API Key verification steps
   - Regeneration procedure
   - Permission checklist

4. Rate limit considerations
   - Reduce trader count
   - Increase decision interval

Both English and Chinese versions updated.

Fixes: #60

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 11:44:57 +08:00
Liu Xiang Qian
1271e278f2 docs: Add Docker image pull failure troubleshooting (China)
Added comprehensive troubleshooting guide for Docker image pull failures
in mainland China, based on Issue #168.

Problem:
- Users in China cannot pull Docker images from Docker Hub
- ERROR: load metadata for docker.io/library/...
- Timeouts and connection failures

Solutions Added:
1. Configure Docker registry mirrors (Recommended)
   - List of working China mirrors
   - Step-by-step configuration for Linux/macOS/Windows
   - Verification commands

2. Use VPN
   - Taiwan nodes recommended
   - Global mode required

3. Offline image download
   - Image proxy websites
   - Manual import instructions

Both English and Chinese versions updated.

Fixes: #168

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 11:38:53 +08:00
Liu Xiang Qian
65809aa037 docs: Fix AI model list in FAQ - correct supported models
Fixed incorrect information about supported AI models:

Before (Incorrect):
- Listed OpenAI GPT-4 and Claude as directly supported
- These are NOT natively supported

After (Correct):
- DeepSeek (native support, recommended)
- Qwen (native support, Alibaba Cloud)
- Custom OpenAI-compatible APIs (can use OpenAI, Claude via proxy, etc.)

Also updated cost estimates to reflect actual supported models.

Reference: mcp/client.go shows only DeepSeek, Qwen, and Custom providers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 11:09:18 +08:00
Liu Xiang Qian
89bb8d3eb6 docs: Expand FAQ and clarify separation from TROUBLESHOOTING
Addressed review feedback on PR #226:
- FAQ and TROUBLESHOOTING serve different purposes and should both be kept
- FAQ: Quick Q&A format for common questions (now expanded)
- TROUBLESHOOTING: Detailed step-by-step diagnostic guide

Changes:
- Expanded FAQ from 26 lines to 200+ lines with 7 sections:
  * General Questions (What is NOFX, supported exchanges, profitability)
  * Setup & Configuration (requirements, API keys, subaccounts)
  * Trading Questions (decision frequency, position limits, customization)
  * Technical Issues (quick fixes for common errors)
  * AI & Model Questions (supported models, costs, learning)
  * Data & Privacy (storage, security, export)
  * Contributing (how to help, feature requests)

- Added cross-references between FAQ and TROUBLESHOOTING
- FAQ provides quick answers with links to detailed troubleshooting
- TROUBLESHOOTING remains comprehensive diagnostic guide

Both English and Chinese versions updated.

Fixes review comment from @reviewer on PR #226

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 11:04:58 +08:00
Luna Martinez
7b5970567f Merge pull request #88 from fanyinghao/fix-decision-result
fix: Correct error handling in GetFullDecision function
2025-11-01 23:03:55 -04:00
Luna Martinez
5878b10c8f Merge pull request #181 from Xeron2000/fix-broken-dashscope-link-issue-128
Fix broken DashScope link in README files (fixes #128)
2025-11-01 23:00:27 -04:00
Liu Xiang Qian
9ab7a36fbb test: Add minimal UT infrastructure and fix Issue #227
This commit sets up a minimal, KISS-principle testing infrastructure
for both backend and frontend, and includes the fix for Issue #227.

Backend Changes:
- Add Makefile with test commands (test, test-backend, test-frontend, test-coverage)
- Add example test: config/database_test.go
- Fix Go 1.25 printf format string warnings in trader/auto_trader.go
  (Changed log.Printf to log.Print for non-format strings)
- All backend tests pass ✓

Frontend Changes:
- Add Vitest configuration: web/vitest.config.ts (minimal setup)
- Add test utilities: web/src/test/test-utils.tsx
- Add example test: web/src/App.test.tsx
- Add dependencies: vitest, jsdom, @testing-library/react
- All frontend tests pass ✓

Issue #227 Fix:
- Fix AITradersPage to allow editing traders with disabled models/exchanges
- Change validation to use allModels/allExchanges instead of enabledModels/enabledExchanges
- Add comprehensive tests in web/src/components/AITradersPage.test.tsx
- Fixes: https://github.com/tinkle-community/nofx/issues/227

CI/CD:
- Add GitHub Actions workflow: .github/workflows/test.yml
- Non-blocking tests (continue-on-error: true)
- Runs on push/PR to main and dev branches

Test Results:
- Backend: 1 test passing
- Frontend: 5 tests passing (including 4 for Issue #227)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 10:58:31 +08:00
Xeron
ff9b66bf11 Fix broken DashScope link in README files (fixes #128) 2025-11-02 10:56:24 +08:00
Luna Martinez
1333121b85 Merge pull request #228 from hzb1115/dev
fix: github workflow permission
2025-11-01 22:28:22 -04:00
zbhan
c084de7277 fix: github workflow permission 2025-11-01 22:25:32 -04:00
Liu Xiang Qian
03d709de8e docs: Enhance bug report template and add comprehensive troubleshooting guide
- Enhanced bug report template with detailed log capture instructions
  - Added bug categorization system (6 main categories)
  - Frontend error capture guide (DevTools Console/Network tabs)
  - Backend log capture for Docker and PM2 deployments
  - Trading/decision logs location and usage
  - Comprehensive environment information checklist
  - Quick diagnostic tips for faster issue resolution

- Created bilingual troubleshooting guides (EN/ZH)
  - Common trading issues (e.g., Issue #202: only short positions)
  - Detailed explanation of Binance position mode requirements
  - AI decision problems and diagnostics
  - Connection and API error solutions
  - Frontend and database issues
  - Complete log capture instructions with commands
  - Emergency reset procedures

- Updated documentation cross-references
  - Added troubleshooting guide links to bug report template
  - Added links in README Common Issues section
  - Bilingual support for better accessibility

This reduces maintainer workload by helping users self-diagnose issues
and submit higher-quality bug reports with all necessary information.

Addresses Issue #202 root cause documentation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 10:19:19 +08:00
ZhouYongyou
46053c5fe9 fix: 添加 HTTP/2 stream error 到可重試錯誤列表
問題:
- 用戶遇到錯誤:stream error: stream ID 1; INTERNAL_ERROR
- 這是 HTTP/2 連接被服務端關閉的錯誤
- 當前重試機制不包含此類錯誤,導致直接失敗

修復:
- 添加 "stream error" 到可重試列表
- 添加 "INTERNAL_ERROR" 到可重試列表
- 遇到此類錯誤時會自動重試(最多 3 次)

影響:
- 提高 API 調用穩定性
- 自動處理服務端臨時故障
- 減少因網絡波動導致的失敗
2025-11-02 09:05:47 +08:00
ZhouYongyou
45ec64537d fix: 補充 System Prompt 中新動作的格式說明
問題:
- System Prompt 的 action 列表缺少新增的動作
- 只列出:open_long, open_short, close_long, close_short, hold, wait
- 缺少:update_stop_loss, update_take_profit, partial_close
- 導致 AI 不知道可以使用這些新動作

修復:
- 補充完整的 action 列表(9 個動作)
- 添加每個新動作的必填字段說明:
  * update_stop_loss: new_stop_loss, reasoning
  * update_take_profit: new_take_profit, reasoning
  * partial_close: close_percentage (0-100), reasoning

影響:
- AI 現在知道可以使用動態止盈止損功能
- 明確每個動作需要哪些字段
- 與 Decision 結構定義完全一致
2025-11-02 08:38:46 +08:00
ZhouYongyou
8ca2071557 fix: 修復首次運行時數據庫初始化失敗問題
問題:
- 用戶首次運行報錯:unable to open database file: is a directory
- 原因:Docker volume 掛載時,如果 config.db 不存在,會創建目錄而非文件
- 影響:新用戶無法正常啟動系統

修復:
- 在 start.sh 啟動前檢查 config.db 是否存在
- 如不存在則創建空文件(touch config.db)
- 確保 Docker 掛載為文件而非目錄

測試:
- 首次運行:./start.sh start → 正常初始化 ✓
- 現有用戶:無影響,向後兼容 ✓
2025-11-02 08:24:09 +08:00
ZhouYongyou
2d4b14e086 fix: 修復初始余額顯示錯誤(使用當前淨值而非配置值)
問題:
- 圖表顯示「初始余額 693.15 USDT」(實際應該是 600)
- 原因:使用 validHistory[0].total_equity(當前淨值)
- 導致初始余額隨著盈虧變化,數學邏輯錯誤

修復:
- 優先從 account.initial_balance 讀取真實配置值
- 備選方案:從歷史數據反推(淨值 - 盈虧)
- 默認值使用 1000(與創建交易員時的默認配置一致)

測試:
- 初始余額:600 USDT(固定)
- 當前淨值:693.15 USDT
- 盈虧:+93.15 USDT (+15.52%) ✓
2025-11-02 07:55:43 +08:00
ZhouYongyou
e76792c7db fix: 修復 Hyperliquid CancelStopOrders 編譯錯誤
問題:order.TriggerPx 字段不存在
原因:Hyperliquid SDK 的 OpenOrder 結構不暴露 trigger 相關字段

解決方案:
- 簡化 CancelStopOrders 實現
- 取消該幣種所有掛單(包括止盈止損單)
- 這是安全的,因為在設置新止盈止損前應清理舊訂單

影響:
-  編譯通過
-  功能正常(取消訂單邏輯更簡單但有效)
-  與 Binance/Aster 實現一致(都是取消相關訂單)
2025-11-02 07:40:33 +08:00
ZhouYongyou
37df286a31 fix: 恢復 adaptive.txt 中被誤刪的動態止盈止損說明
問題:merge dev 時,dev 分支的刪減版覆蓋了 feature 的完整版
原因:dev 分支為避免生產錯誤暫時刪除了這些說明
解決:feature 分支已實現完整功能,應恢復這些說明

恢復內容:
- 策略 A(震盪市):追蹤止損指導 + 動態調整示例
- 策略 B(趨勢市):分批止盈邏輯 + 追蹤止損指導 + 動態調整示例

功能支持:
- update_stop_loss ✓
- update_take_profit ✓
- partial_close ✓
2025-11-02 07:35:56 +08:00
ZhouYongyou
adb7e55f90 Merge branch 'dev' into feature/partial-close-dynamic-tpsl 2025-11-02 07:27:01 +08:00
ZhouYongyou
dc3bd5fb22 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-02 07:26:11 +08:00
ZhouYongyou
ab3cab9a93 fix: 統一 handleTraderList 返回完整 AI model ID(保持與 handleGetTraderConfig 一致)
問題:
- handleTraderList 仍在截斷 AI model ID (admin_deepseek → deepseek)
- 與 handleGetTraderConfig 返回的完整 ID 不一致
- 導致前端 isModelInUse 檢查失效

修復:
- 移除 handleTraderList 中的截斷邏輯
- 返回完整 AIModelID (admin_deepseek)
- 與其他 API 端點保持一致

測試:
- GET /api/traders → ai_model: admin_deepseek ✓
- GET /api/traders/:id → ai_model: admin_deepseek ✓
- 模型使用檢查邏輯正確 ✓
2025-11-02 07:11:57 +08:00
Luna Martinez
500ad4412f Merge pull request #219 from hzb1115/dev
feat: PR validation
2025-11-01 18:37:50 -04:00
Luna Martinez
487a0cbe9e Merge pull request #1 from hzb1115/dev_pr_check
feat: pr validation
2025-11-01 18:29:56 -04:00
zbhan
9a604f9b27 feat: pr validation 2025-11-01 18:25:44 -04:00
ZhouYongyou
ed34201c2d 修復關鍵缺陷:添加 CancelStopOrders 方法避免多個止損單共存
問題:
- 調整止損/止盈時,直接調用 SetStopLoss/SetTakeProfit 會創建新訂單
- 但舊的止損/止盈單仍然存在,導致多個訂單共存
- 可能造成意外觸發或訂單衝突

解決方案(參考 PR #197):
1. 在 Trader 接口添加 CancelStopOrders 方法
2. 為三個交易所實現:
   - binance_futures.go: 過濾 STOP_MARKET/TAKE_PROFIT_MARKET 類型
   - aster_trader.go: 同樣邏輯
   - hyperliquid_trader.go: 過濾 trigger 訂單(有 triggerPx)
3. 在 executeUpdateStopLossWithRecord 和 executeUpdateTakeProfitWithRecord 中:
   - 先調用 CancelStopOrders 取消舊單
   - 然後設置新止損/止盈
   - 取消失敗不中斷執行(記錄警告)

優勢:
-  避免多個止損單同時存在
-  保留我們的價格驗證邏輯
-  保留執行價格記錄
-  詳細錯誤信息
-  取消失敗時繼續執行(更健壯)

測試建議:
- 開倉後調整止損,檢查舊止損單是否被取消
- 連續調整兩次,確認只有最新止損單存在

致謝:參考 PR #197 的實現思路
2025-11-02 06:23:02 +08:00
ZhouYongyou
ed8bb94dea 更新 logger:支持新增的三個動作類型
更新內容:
1. DecisionAction 註釋:添加 update_stop_loss, update_take_profit, partial_close
2. GetStatistics:partial_close 計入 TotalClosePositions
3. AnalyzePerformance 預填充邏輯:處理 partial_close(不刪除持倉記錄)
4. AnalyzePerformance 分析邏輯:
   - partial_close 正確判斷持倉方向
   - 記錄部分平倉的盈虧統計
   - 保留持倉記錄(因為還有剩餘倉位)

說明:partial_close 會記錄盈虧,但不刪除 openPositions,
      因為還有剩餘倉位可能繼續交易
2025-11-02 06:11:12 +08:00
ZhouYongyou
498cec0b92 修復關鍵 BUG:validActions 缺少新動作導致驗證失敗
問題根因:
- auto_trader.go 已實現 update_stop_loss/update_take_profit/partial_close 處理
- adaptive.txt 已描述這些功能
- 但 validateDecision 的 validActions map 缺少這三個動作
- 導致 AI 生成的決策在驗證階段被拒絕:「无效的action:update_stop_loss」

修復內容:
1. validActions 添加三個新動作
2. 為每個新動作添加參數驗證:
   - update_stop_loss: 驗證 NewStopLoss > 0
   - update_take_profit: 驗證 NewTakeProfit > 0
   - partial_close: 驗證 ClosePercentage 在 0-100 之間
3. 修正註釋:adjust_* → update_*

測試狀態:feature 分支,等待測試確認
2025-11-02 06:06:55 +08:00
ZhouYongyou
f15d82b13a 修復生產錯誤:刪除 adaptive.txt 中不支持的動態調整功能描述
問題:AI 生成 update_stop_loss 決策但被拒絕為無效動作
原因:adaptive.txt 描述了動態止損功能,但 dev 分支代碼未實現

刪除內容:
- 震盪策略:追蹤止損(持倉中動態調整)段落
- 趨勢策略:分批止盈、追蹤止損段落
- 策略選擇:追蹤止損計劃
- 持倉動態調整範例

結果:提示詞與代碼功能完全匹配,避免 AI 生成無效決策

相關 issue:生產環境報錯 '无效的action:update_stop_loss'
後續計劃:在 feature/partial-close-dynamic-tpsl 測試完成後再合併動態功能
2025-11-02 06:03:56 +08:00
ZhouYongyou
b145471895 docs(adaptive): 添加數據解釋和參考示例,採用"解釋+參考"方式
改動說明:
- 新增「數據框架說明」章節:詳細說明 4 個時間框架的覆蓋時間和用途
  * 3分鐘序列(30分鐘):實時價格、放量檢測、買賣壓力
  * 15分鐘序列(2.5小時):震盪區間識別
  * 1小時序列(10小時):中期趨勢確認
  * 4小時序列(40小時):大趨勢判斷

- 新增「關鍵數據解讀」章節:
  * BuySellRatio 含義和參考範圍(0.6-0.7 強買壓,0.3-0.4 強賣壓)
  * 成交量分析:放量檢測標準(1.5-2 倍平均)
  * RSI 參考範圍:根據市場波動性調整(震盪市 30-40/60-70)

- 新增「入場信號參考示例」章節:
  * 震盪策略入場信號(區間下沿做多、上沿做空)
  * 趨勢策略入場信號(趨勢突破參考)

- 補充「避免低質量信號」:
  * 新增:震盪市在區間中部交易(應等待區間邊界)
  * 新增:缺乏買賣壓力確認(BuySellRatio 中性時謹慎)

設計哲學:
- 採用「解釋 + 參考示例」方式,而非硬編碼固定規則
- 所有參考數值都明確標註「你可以根據市場狀態自主調整」
- 強調根據市場波動性、趨勢強度自主判斷
- 激發 AI 的判斷能力,而非限制其靈活性
- 通過夏普比率反饋實現自我進化

改動統計:
- 原文件:259 行
- 新文件:366 行(+107 行)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:53:01 +08:00
ZhouYongyou
7f741c4a7d docs(adaptive): 添加數據解釋和參考示例,採用"解釋+參考"方式
改動說明:
- 新增「數據框架說明」章節:詳細說明 4 個時間框架的覆蓋時間和用途
- 新增「關鍵數據解讀」章節:
  * BuySellRatio 含義和參考範圍(0.6-0.7 強買壓,0.3-0.4 強賣壓)
  * 成交量分析:放量檢測標準(1.5-2 倍平均)
  * RSI 參考範圍:根據市場波動性調整(震盪市 30-40/60-70)
- 新增「入場信號參考示例」章節:
  * 震盪策略入場信號(區間下沿做多、上沿做空)
  * 趨勢策略入場信號(趨勢突破參考)
- 補充「避免低質量信號」:
  * 新增:震盪市在區間中部交易(應等待區間邊界)
  * 新增:缺乏買賣壓力確認(BuySellRatio 中性時謹慎)

設計哲學:
- 採用「解釋 + 參考示例」方式,而非硬編碼固定規則
- 所有參考數值都明確標註「你可以根據市場狀態自主調整」
- 強調根據市場波動性、趨勢強度自主判斷
- 激發 AI 的判斷能力,而非限制其靈活性
- 通過夏普比率反饋實現自我進化

改動統計:+111 行(增加詳細解釋和示例)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:48:28 +08:00
ZhouYongyou
82660b12c5 feat: 添加部分平仓和动态止盈止损功能
新增功能:
- update_stop_loss: 调整止损价格(追踪止损)
- update_take_profit: 调整止盈价格(技术位优化)
- partial_close: 部分平仓(分批止盈)

实现细节:
- Decision struct 新增字段:NewStopLoss, NewTakeProfit, ClosePercentage
- 新增执行函数:executeUpdateStopLossWithRecord, executeUpdateTakeProfitWithRecord, executePartialCloseWithRecord
- 修复持仓字段获取 bug(使用 "side" 并转大写)
- 更新 adaptive.txt 文档,包含详细使用示例和策略建议
- 优先级排序:平仓 > 调整止盈止损 > 开仓

命名统一:
- 与社区 PR #197 保持一致,使用 update_* 而非 adjust_*
- 独有功能:partial_close(部分平仓)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 05:32:23 +08:00
ZhouYongyou
093d521394 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-02 04:54:09 +08:00
ZhouYongyou
04419b47e6 fix: 修复编辑交易员时「AI模型配置不存在或未启用」错误
问题:
- 编辑交易员并修改系统提示词模板时,保存失败
- 错误提示:AI模型配置不存在或未启用

根本原因:
1. 后端 API 返回的 ai_model 被截断(admin_deepseek → deepseek)
2. 前端验证时找不到对应的模型 ID(enabledModels 存的是完整 ID)
3. API 缺少 system_prompt_template 字段

修复内容:
- api/server.go: 移除 AI model ID 截断逻辑,返回完整 ID
- api/server.go: 在 handleGetTraderConfig 中添加 system_prompt_template 字段
- web/src/types.ts: TraderConfigData 接口添加 system_prompt_template 字段
- web/src/components/AITradersPage.tsx: 添加 fallback 机制和详细日志

测试:
- 编辑交易员 → 修改系统提示词模板 → 保存成功
- Console 输出验证日志,不再报错
2025-11-02 04:51:30 +08:00
原始
d7567b2e0e Merge branch 'tinkle-community:dev' into dev 2025-11-02 04:09:26 +08:00
Luna Martinez
935c3d094e Merge pull request #216 from tinkle-community/shui_dev
Feat: Update docs
2025-11-01 15:13:29 -04:00
zbhan
18820fc319 Feat: Update docs
- 重构文档结构
- 更新文档内容
- 制定roadmap
- 提供中/EN 双语文档
2025-11-01 15:05:24 -04:00
原始
30445656b9 Merge branch 'tinkle-community:dev' into dev 2025-11-02 03:00:32 +08:00
tinkle-community
9b9b269dca Merge pull request #215 from zhoujunhehe/landing-page-pr 2025-11-02 02:16:17 +08:00