Commit Graph

398 Commits

Author SHA1 Message Date
Liu Xiang Qian f8edc0ec11 fix: add AI_MAX_TOKENS environment variable to prevent response truncation
## Problem
AI responses were being truncated due to a hardcoded max_tokens limit of 2000,
causing JSON parsing failures. The error occurred when:
1. AI's thought process analysis was cut off mid-response
2. extractDecisions() incorrectly extracted MACD data arrays from the input prompt
3. Go failed to unmarshal numbers into Decision struct
Error message:
```
json: cannot unmarshal number into Go value of type decision.Decision
JSON内容: [-867.759, -937.406, -1020.435, ...]
```
## Solution
- Add MaxTokens field to mcp.Client struct
- Read AI_MAX_TOKENS from environment variable (default: 2000)
- Set AI_MAX_TOKENS=4000 in docker-compose.yml for production use
- This provides enough tokens for complete analysis with the 800-line trading strategy prompt
## Testing
- Verify environment variable is read correctly
- Confirm AI responses are no longer truncated
- Check decision logs for complete JSON output
2025-11-05 09:31:58 +08:00
Shui 54f5637e34 Merge pull request #476 from hzb1115/dev
fix(workflow): simplify PR template
2025-11-04 20:18:35 -05:00
Shui 4ff618e424 Merge pull request #3 from hzb1115/feature/pr-template-automation
feat(templates): add intelligent PR template selection system
2025-11-04 16:05:50 -05:00
zbhan 97935a8e07 Fix PR tpl 2025-11-04 16:05:29 -05:00
zbhan caa42ec1a1 feat(templates): add intelligent PR template selection system
- Created specialized PR templates for different change types:
  - Backend template for Go/API changes
  - Frontend template for UI/UX changes
  - Documentation template for docs updates
  - General template for mixed changes
- Simplified default template from 270 to 115 lines
- Added GitHub Action for automatic template suggestion based on file types
- Auto-labels PRs with appropriate categories (backend/frontend/documentation)
- Provides friendly suggestions when default template is used
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 15:52:01 -05:00
Icyoung 3e91aa8176 Merge pull request #466 from zhouyongyou/fix/websocket-crash
fix(market): prevent program crash on WebSocket failure
2025-11-05 02:14:23 +08:00
ZhouYongyou bb2a4c720e fix(market): prevent program crash on WebSocket failure
## Problem
- Program crashes with log.Fatalf when WebSocket connection fails
- Triggered by WebSocket hijacking issue (157.240.12.50)
- Introduced in commit 3b1db6f (K-line WebSocket migration)
## Solution
- Replace 4x log.Fatalf with log.Printf in monitor.go
- Lines 177, 183, 189, 215
- Program now logs error and continues running
## Changes
1. Initialize failure: Fatalf → Printf (line 177)
2. Connection failure: Fatalf → Printf (line 183)
3. Subscribe failure: Fatalf → Printf (line 189)
4. K-line subscribe: Fatalf → Printf + dynamic period (line 215)
## Fallback
- System automatically uses API when WebSocket cache is empty
- GetCurrentKlines() has built-in degradation mechanism
- No data loss, slightly slower API calls as fallback
## Impact
-  Program stability: Won't crash on network issues
-  Error visibility: Clear error messages in logs
-  Data integrity: API fallback ensures K-line availability
Related: websocket-hijack-fix.md, auto-stop-bug-analysis.md
2025-11-05 02:06:54 +08:00
SkywalkerJi 476e91bc52 Merge pull request #464 from SkywalkerJi/dev
fix: Fix code formatting to avoid PR Checks / Backend Code Quality (Go) checks reporting errors.
2025-11-05 03:03:09 +09:00
SkywalkerJi 77a217e8ec Fixed go fmt code formatting issues. 2025-11-05 01:42:36 +08:00
SkywalkerJi 35ea18e927 log.Printf mandates that its first argument must be a compile-time constant string. 2025-11-05 01:36:44 +08:00
SkywalkerJi 735db88ae5 Merge pull request #425 from zhouyongyou/fix/prompts-action-names-minimal
fix(prompts): rename actions to match backend implementation
提示词对齐
2025-11-04 21:27:50 +09:00
ZhouYongyou f99052e780 fix(prompts): rename actions to match backend implementation
## Problem
Backend code expects these action names:
- `open_long`, `open_short`, `close_long`, `close_short`
But prompts use outdated names:
- `buy_to_enter`, `sell_to_enter`, `close`
This causes all trading decisions to fail with unknown action errors.
## Solution
Minimal changes to fix action name compatibility:
### prompts/nof1.txt
-  `buy_to_enter` → `open_long`
-  `sell_to_enter` → `open_short`
-  `close` → `close_long` / `close_short`
-  Explicitly list `wait` action
- +18 lines, -6 lines (only action definitions section)
### prompts/adaptive.txt
-  `buy_to_enter` → `open_long`
-  `sell_to_enter` → `open_short`
-  `close` → `close_long` / `close_short`
- +15 lines, -6 lines (only action definitions section)
## Impact
-  Trading decisions now execute successfully
-  Maintains all existing functionality
-  No new features added (minimal diff)
## Verification
```bash
# Backend expects these actions:
grep 'Action string' decision/engine.go
# "open_long", "open_short", "close_long", "close_short", ...
# Old names removed:
grep -r "buy_to_enter\|sell_to_enter" prompts/
# (no results)
```
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 19:41:23 +08:00
tinkle-community 4f7d21c581 Merge pull request #404 from 0xEmberZz/feature/binance-guide
feat: Add Binance setup guide with tutorial modal
2025-11-04 15:35:19 +08:00
Ember 76abf1ee6e feat: Add Binance setup guide with tutorial modal
- Add Binance configuration tutorial image (guide.png)
- Implement "View Guide" button in exchange configuration modal
- Add tutorial display modal with image viewer
- Add i18n support for guide-related text (EN/ZH)
- Button only appears when configuring Binance exchange
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 14:50:38 +08:00
SkywalkerJi 272e830707 fix the main branch history issue from November 3rd.
Merge pull request #395 from NoFxAiOS/beta
fix:fix the main branch history issue from November 3rd.
2025-11-04 13:00:05 +09:00
tinkle-community 21f263990d Merge pull request #389 from NoFxAiOS/beta
Fix:fix the main branch history issue from November 3rd.
2025-11-04 11:22:10 +08:00
Shui 3972868ff1 Merge pull request #354 from zhouyongyou/fix/trader-config-missing-fields
fix(database): GetTraderConfig missing critical fields causes edit to fail
2025-11-03 21:57:48 -05:00
Shui a0d2650a4f Merge pull request #373 from hzb1115/dev
fix(readme): update readme and pr reviewer
2025-11-03 21:07:31 -05:00
zbhan 8b004bf4dc Fix owner 2025-11-03 21:06:25 -05:00
zbhan fb88cc8926 fix owner 2025-11-03 20:56:16 -05:00
zbhan 52295c69ad fix(readme): update readme and pr reviewer 2025-11-03 20:50:56 -05:00
Luna Martinez 68bbd37810 Merge pull request #362 from hzb1115/dev
Fix(workflow): add title and size validation comments
2025-11-03 13:20:02 -05:00
Luna Martinez 35b328bee7 Merge branch 'NoFxAiOS:dev' into dev 2025-11-03 13:16:11 -05:00
Icyoung 2affa0ae62 Merge pull request #361 from Icyoung/beta
Beta bugfix
2025-11-04 02:14:54 +08:00
zbhan fd95021c25 Fix PR check 2025-11-03 13:12:47 -05:00
icy 4c74465075 Add NOFX watermarks to charts and fix empty state internationalization
- 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: tinkle-community <tinklefund@gmail.com>
2025-11-04 02:08:38 +08:00
icy da1ac71828 Fix ComparisonChart data display issue
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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:54:21 +08:00
Icyoung ea374d2311 Merge pull request #359 from Icyoung/beta
Beta Merge dev、Bug fix
2025-11-04 01:50:34 +08:00
icy c28ca79d7a Merge branch 'dev' into beta 2025-11-04 01:45:21 +08:00
icy 3a38c1bf56 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-04 01:45:15 +08:00
icy c264775809 Remove all test dependencies and configurations
- 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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:44:40 +08:00
icy c941c078ca Remove unused test files
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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:43:02 +08:00
Luna Martinez e07dc1d2fa Merge pull request #323 from zhouyongyou/fix/go-vet-warnings
fix: resolve go vet warnings for non-constant format strings
2025-11-03 12:42:46 -05:00
icy 6d1efcf54a Fix TypeScript build error
Removed unused 'Zap' import from App.tsx that was causing build failure.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:42:25 +08:00
Luna Martinez 18ca6fd213 Merge pull request #329 from zhouyongyou/chore/peer-dependency-markers
chore(web): add peer dependency markers to package-lock.json
2025-11-03 12:39:24 -05:00
icy 8e76be5a29 Resolve merge conflicts with dev branch
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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:36:54 +08:00
icy 5378e3469e Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev
# Conflicts:
#	api/server.go
2025-11-04 01:34:14 +08:00
icy c912efc882 Fix: Add proper top padding to prevent HeaderBar overlap on all main 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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:29:39 +08:00
hzb1115 62ebd58a1f style(backend): go fmt code 2025-11-03 17:22:11 +00:00
Luna Martinez b0ad7e774e Merge pull request #356 from xqliu/revert-pr-229-ut-infrastructure
Revert PR #229: Remove UT infrastructure
2025-11-03 12:13:16 -05:00
icy 5bc14b7006 Fix: Unify all pages to use HeaderBar component consistently
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: tinkle-community <tinklefund@gmail.com>
2025-11-04 01:04:16 +08:00
Liu Xiang Qian 2eb5801e3d Revert "Merge pull request #229 from xqliu/test/add-ut-infrastructure"
This reverts commit 683e77b92f7608c31a7c25c91bb938c4d657f6e4, reversing
changes made to 791cecd2ffff0ebc3ea88c04fb91ddbe0c001422.
2025-11-04 00:58:12 +08:00
Icyoung d1a21b829d Merge pull request #355 from Icyoung/beta
Beta Competition kline count change to 5
2025-11-04 00:23:40 +08:00
icy 06b7f8b9cb Merge branch 'beta' of github.com:Icyoung/nofx into beta 2025-11-04 00:18:34 +08:00
icy 945625049b Merge branch 'dev' into beta 2025-11-04 00:17:50 +08:00
icy a5198b9a5b Limit performance comparison chart to top 5 traders
Frontend changes to ensure equity-history-batch API only requests data for top 5 performers:
- Modify CompetitionPage to pass only top 5 traders to ComparisonChart component
- Update API comments to reflect the change from top 10 to top 5
- Optimize chart performance by reducing data volume and API calls
This ensures the performance comparison chart shows only the most relevant traders while improving load times.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 00:16:14 +08:00
ZhouYongyou b61fbe6ea3 fix: GetTraderConfig missing critical fields in SELECT/Scan
**Problem**:
- GetTraderConfig was missing 9 critical fields in SELECT statement
- Missing corresponding Scan variables
- Caused trader edit UI to show 0 for leverage and empty trading_symbols
**Root Cause**:
Database query only selected basic fields (id, name, balance, etc.)
but missed leverage, trading_symbols, prompts, and all custom configs
**Fix**:
- Added missing fields to SELECT:
  * btc_eth_leverage, altcoin_leverage
  * trading_symbols
  * use_coin_pool, use_oi_top
  * custom_prompt, override_base_prompt
  * system_prompt_template
  * is_cross_margin
  * AI model custom_api_url, custom_model_name
- Added corresponding Scan variables to match SELECT order
**Impact**:
 Trader edit modal now displays correct leverage values
 Trading symbols list properly populated
 All custom configurations preserved and displayed
 API endpoint /traders/:id/config returns complete data
**Testing**:
-  Go compilation successful
-  All fields aligned (31 SELECT = 31 Scan)
-  API layer verified (api/server.go:887-904)
Reported by: 寒江孤影
Issue: Trader config edit modal showing 0 leverage and empty symbols
Co-Authored-By: tinkle-community <tinklefund@gmail.com>
2025-11-04 00:00:05 +08:00
Icyoung 69dc7ddac8 Merge pull request #353 from Icyoung/beta
Beta Fix Competition、Rank api cache、Dev merge
2025-11-03 23:57:43 +08:00
icy d6998ac8fa Merge branch 'dev' into beta 2025-11-03 23:46:59 +08:00
icy 3f35f6a870 Merge branch 'dev' of https://github.com/tinkle-community/nofx into dev 2025-11-03 23:46:54 +08:00