Commit Graph

102 Commits

Author SHA1 Message Date
MarkLo127 9c0a9819e6 Implement Plan A1: Fast Mode Analysis
Features:
- Add analysis_mode parameter (fast/deep) to AnalysisRequest
- Fast mode (15-25 min): Disables investment and risk debates (max_debate_rounds=0)
- Deep mode (60 min): Default mode with debates enabled
- Update backend TradingService to handle analysis_mode
- Add analysis_mode form field to frontend with dropdown selector
- Update TypeScript interfaces to include analysis_mode

Changes:
- backend/app/models/schemas.py: Add analysis_mode field to AnalysisRequest
- backend/app/services/trading_service.py: Handle analysis_mode in create_config()
- backend/app/api/routes.py: Pass analysis_mode parameter to run_analysis()
- frontend/components/analysis/AnalysisForm.tsx: Add analysis_mode dropdown (fast/deep)
- frontend/lib/types.ts: Add analysis_mode to AnalysisRequest interface

When users select "fast mode", the system will:
1. Skip investment debate (max_debate_rounds = 0)
2. Skip risk debate (max_risk_discuss_rounds = 0)
3. Reduce analysis time from ~60 minutes to ~15-25 minutes
4. Still run all analyst reports with proper 500-1000 word counts
5. Provide initial decision without debate refinement

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 21:33:23 +08:00
MarkLo127 a019896a9e Merge optimization changes into main
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 18:50:01 +08:00
MarkLo127 b2fc38671b Optimize analysis speed and stability: Redis TTL, word count limits, and reporting
Changes:
- C1: Increase Redis TTL from 1 hour to 4 hours for completed tasks (prevents report deletion)
- Word count: Change all analyst prompts from 800-1500 to 500-1000 words
- Output filter: Update word count validation to 500-1000 range, hide specific word counts in warnings
- Remove character counts from output to improve clarity

These changes address:
1. Reports being deleted after 1 hour (now 4 hours)
2. Inconsistent word counts causing reruns (now strict 500-1000)
3. Output showing specific word counts (now just pass/warning)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 18:49:48 +08:00
MarkLo127 3545e1574d Merge dazzling-leakey into main: GraphRecursionError fix and stock data validation
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 17:19:58 +08:00
MarkLo127 4f219bd74e Fix: Resolve GraphRecursionError by passing config params to agents and increasing recursion_limit to 200
- Pass max_debate_rounds and max_risk_discuss_rounds from config to ConditionalLogic
- Pass max_recur_limit from config to Propagator
- Increase default recursion_limit from 100 to 200 in default_config.py
- Increase Propagator default max_recur_limit from 100 to 200

Also includes earlier fixes:
- Add 365-day minimum date range validation to get_stock_data tool
- Update market analyst prompt to specify 1-year data requirement
- Initialize all debate state fields (bull_history, bear_history, judge_decision, etc.)
- Add report completeness logging in trading_service.py
- Add debug logging in frontend results page

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-12 17:17:23 +08:00
MarkLo127 d887c3be91 2026-03-12 12:02:36 +08:00
MarkLo127 69eba15bbb 2026-03-12 09:30:42 +08:00
MarkLo127 62b82788b8 2026-03-11 20:26:37 +08:00
MarkLo127 199315327b 2026-03-11 19:40:54 +08:00
MarkLo127 6802731507 2026-03-11 19:15:24 +08:00
MarkLo127 c305ea5d3b 2026-03-11 18:38:42 +08:00
MarkLo127 a45bd56ad0 2026-03-11 17:46:07 +08:00
MarkLo127 2061fa27dd 2026-03-10 18:35:55 +08:00
MarkLo127 83e8068e8d 2026-03-10 18:14:41 +08:00
MarkLo127 92c2a84b83 2026-03-10 17:00:32 +08:00
MarkLo127 f3cfe21230 2026-03-10 09:05:46 +08:00
MarkLo127 9efb5fe8a1 2026-03-09 16:43:54 +08:00
MarkLo127 d95af6a64c 刪除claude被棄用的模型 2026-03-05 23:42:58 +08:00
MarkLo127 0bdb3fb774 2026-01-16 00:56:14 +08:00
MarkLo 3145d08c30 2025-12-28 01:22:45 +08:00
MarkLo 16e513a921 新增英文語系支援 2025-12-24 01:20:33 +08:00
MarkLo c4fc8904eb 2025-12-20 07:41:05 +08:00
MarkLo 4bbeaa8e18 2025-12-17 05:41:30 +08:00
MarkLo 803885305a 2025-12-16 19:03:58 +08:00
MarkLo 5b46904a98 2025-12-16 02:55:58 +08:00
MarkLo 83680dba26 2025-12-16 02:33:22 +08:00
MarkLo 8bd7bcee59 2025-12-16 02:19:25 +08:00
MarkLo ce584183ff 2025-12-16 02:06:07 +08:00
MarkLo 8fcc3d6256 2025-12-16 01:57:40 +08:00
MarkLo dbee0c4817 2025-12-16 01:42:30 +08:00
MarkLo 4234a181e5 2025-12-16 01:19:21 +08:00
MarkLo 69ca5b75c1 2025-12-16 00:54:15 +08:00
MarkLo 7d5155052b 2025-12-16 00:18:15 +08:00
MarkLo 07f76294d8 2025-12-14 03:48:26 +08:00
MarkLo cf4aaa09b1 feat: auto-save reports + fix PDF download from history
1. Auto-save reports when page closes:
   - Added beforeunload handler to auto-save analysis to history
   - Saves to local IndexedDB and cloud (if authenticated)
   - Prevents data loss if user accidentally closes the page

2. Fix PDF download from history page:
   - Made taskId optional in DownloadReports component
   - Added direct mode: can pass reports data directly
   - Updated backend to support both task-based and direct-data modes
   - History reports now have download PDF option available
2025-12-14 03:21:59 +08:00
MarkLo 3f13475485 feat: add Heikin Ashi candlestick and volume charts to PDF reports
- Add matplotlib for chart generation
- Implement _calculate_heikin_ashi() for HA OHLC calculation
- Implement _generate_price_chart() to create candlestick + volume charts
- Charts are generated as PNG images and embedded in PDF
- Fallback to text summary if chart generation fails
- First page now shows visual charts like the web interface
2025-12-14 03:11:47 +08:00
MarkLo 9ceff4cf9b feat: add price information cover page to analyst PDF reports
- Page 1 now shows price statistics (growth rate, duration, start/end prices)
- Page 1 also includes last 5 trading days data
- Page 2+ contains the original analyst insights
- Updates pdf_generator.py, download_service.py, and routes.py
2025-12-14 02:45:14 +08:00
MarkLo 0bddce0cdc 2025-12-13 16:48:12 +08:00
MarkLo 8b2dbe9437 2025-12-13 06:50:03 +08:00
MarkLo 7926eb74b4 2025-12-13 06:42:20 +08:00
MarkLo 2a65c7f44d 2025-12-13 06:34:48 +08:00
MarkLo 5d3751602e 2025-12-13 06:00:19 +08:00
MarkLo 95f6b25333 2025-12-13 02:26:49 +08:00
MarkLo 8204aff28b 2025-12-13 01:54:47 +08:00
MarkLo da7d05ecc9 2025-12-12 05:30:04 +08:00
MarkLo 482d8fa6aa 2025-12-11 15:00:30 +08:00
MarkLo 20e0c6a2d9 2025-12-11 13:46:33 +08:00
MarkLo 71fb9844ee 2025-12-11 01:18:46 +08:00
MarkLo a51b31dc21 2025-12-11 00:37:19 +08:00
MarkLo 886694b62f 2025-12-10 23:51:07 +08:00