From 2299a0e34fa31562d49cab76b811be5727fac981 Mon Sep 17 00:00:00 2001 From: CoderMageFox Date: Wed, 5 Nov 2025 17:11:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=80=99=E9=80=89?= =?UTF-8?q?=E5=B8=81=E7=A7=8D=E4=B8=BA0=E6=97=B6=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E8=AD=A6=E5=91=8A=E6=8F=90=E7=A4=BA=20(#515)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add frontend warnings for zero candidate coins 当候选币种数量为0时,在前端添加详细的错误提示和诊断信息 主要改动: 1. 决策日志中显示候选币种数量,为0时标红警告 2. 候选币种为0时显示详细警告卡片,包含可能原因和解决方案 3. 交易员列表页面添加信号源未配置的全局警告 4. 更新TraderInfo类型定义,添加use_coin_pool和use_oi_top字段 详细说明: - 在App.tsx的账户状态摘要中添加候选币种显示 - 当候选币种为0时,显示详细的警告卡片,列出: * 可能原因(API未配置、连接超时、数据为空等) * 解决方案(配置自定义币种、配置API、禁用选项等) - 在AITradersPage中添加信号源配置检查 * 当交易员启用了币种池但未配置API时显示全局警告 * 提供"立即配置信号源"快捷按钮 - 不改变任何后端逻辑,纯UI层面的用户提示改进 影响范围: - web/src/App.tsx: 决策记录卡片中的警告显示 - web/src/components/AITradersPage.tsx: 交易员列表页警告 - web/src/types.ts: TraderInfo类型定义更新 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude * fix: import AlertTriangle from lucide-react in App.tsx 修复TypeScript编译错误:Cannot find name 'AlertTriangle' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --------- Co-authored-by: Claude --- web/src/App.tsx | 41 ++++++++++++++++++++++++ web/src/components/AITradersPage.tsx | 47 ++++++++++++++++++++++++++++ web/src/types.ts | 2 ++ 3 files changed, 90 insertions(+) diff --git a/web/src/App.tsx b/web/src/App.tsx index 24166314..6ec4569d 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -13,6 +13,7 @@ import { LanguageProvider, useLanguage } from './contexts/LanguageContext' import { AuthProvider, useAuth } from './contexts/AuthContext' import { t, type Language } from './i18n/translations' import { useSystemConfig } from './hooks/useSystemConfig' +import { AlertTriangle } from 'lucide-react' import type { SystemStatus, AccountInfo, @@ -1038,6 +1039,46 @@ function DecisionCard({ 保证金率: {decision.account_state.margin_used_pct.toFixed(1)}% 持仓: {decision.account_state.position_count} + + 候选币种: {decision.candidate_coins?.length || 0} + + + )} + + {/* 候选币种为0的警告提示 */} + {decision.candidate_coins && decision.candidate_coins.length === 0 && ( +
+ +
+
⚠️ 候选币种数量为 0
+
+
可能原因:
+
    +
  • 币种池API未配置或无法访问(请检查信号源设置)
  • +
  • API连接超时或返回数据为空
  • +
  • 未配置自定义币种且API获取失败
  • +
+
+ 解决方案: +
+
    +
  • 在交易员配置中设置自定义币种列表
  • +
  • 或者配置正确的币种池API地址
  • +
  • 或者禁用"使用币种池"和"使用OI Top"选项
  • +
+
+
)} diff --git a/web/src/components/AITradersPage.tsx b/web/src/components/AITradersPage.tsx index 92091d87..f9ddce76 100644 --- a/web/src/components/AITradersPage.tsx +++ b/web/src/components/AITradersPage.tsx @@ -659,6 +659,53 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) { + {/* 信号源配置警告 */} + {traders && traders.some(t => (t.use_coin_pool || t.use_oi_top)) && + (!userSignalSource.coinPoolUrl && !userSignalSource.oiTopUrl) && ( +
+ +
+
+ ⚠️ 信号源未配置 +
+
+

+ 您有交易员启用了"使用币种池"或"使用OI Top",但尚未配置信号源API地址。 + 这将导致候选币种数量为0,交易员无法正常工作。 +

+

+ 解决方案: +

+
    +
  • 点击"📡 信号源"按钮配置API地址
  • +
  • 或在交易员配置中禁用"使用币种池"和"使用OI Top"
  • +
  • 或在交易员配置中设置自定义币种列表
  • +
+
+ +
+
+ )} + {/* Configuration Status */}
{/* AI Models */} diff --git a/web/src/types.ts b/web/src/types.ts index af3ea8c3..d1368c01 100644 --- a/web/src/types.ts +++ b/web/src/types.ts @@ -92,6 +92,8 @@ export interface TraderInfo { exchange_id?: string is_running?: boolean custom_prompt?: string + use_coin_pool?: boolean + use_oi_top?: boolean } export interface AIModel {