mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-07 13:00:59 +08:00
feat: 添加候选币种为0时的前端警告提示 (#515)
* 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类型定义更新 Co-Authored-By: tinkle-community <tinklefund@gmail.com> * fix: import AlertTriangle from lucide-react in App.tsx 修复TypeScript编译错误:Cannot find name 'AlertTriangle' Co-Authored-By: tinkle-community <tinklefund@gmail.com> --------- Co-authored-by: tinkle-community <tinklefund@gmail.com>
This commit is contained in:
@@ -659,6 +659,53 @@ export function AITradersPage({ onTraderSelect }: AITradersPageProps) {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 信号源配置警告 */}
|
||||
{traders && traders.some(t => (t.use_coin_pool || t.use_oi_top)) &&
|
||||
(!userSignalSource.coinPoolUrl && !userSignalSource.oiTopUrl) && (
|
||||
<div
|
||||
className="rounded-lg px-4 py-3 flex items-start gap-3 animate-slide-in"
|
||||
style={{
|
||||
background: 'rgba(246, 70, 93, 0.1)',
|
||||
border: '1px solid rgba(246, 70, 93, 0.3)',
|
||||
}}
|
||||
>
|
||||
<AlertTriangle
|
||||
size={20}
|
||||
className="flex-shrink-0 mt-0.5"
|
||||
style={{ color: '#F6465D' }}
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<div className="font-semibold mb-1" style={{ color: '#F6465D' }}>
|
||||
⚠️ 信号源未配置
|
||||
</div>
|
||||
<div className="text-sm" style={{ color: '#848E9C' }}>
|
||||
<p className="mb-2">
|
||||
您有交易员启用了"使用币种池"或"使用OI Top",但尚未配置信号源API地址。
|
||||
这将导致<strong style={{ color: '#F6465D' }}>候选币种数量为0</strong>,交易员无法正常工作。
|
||||
</p>
|
||||
<p>
|
||||
<strong>解决方案:</strong>
|
||||
</p>
|
||||
<ul className="list-disc list-inside space-y-1 ml-2 mt-1">
|
||||
<li>点击"📡 信号源"按钮配置API地址</li>
|
||||
<li>或在交易员配置中禁用"使用币种池"和"使用OI Top"</li>
|
||||
<li>或在交易员配置中设置自定义币种列表</li>
|
||||
</ul>
|
||||
</div>
|
||||
<button
|
||||
onClick={() => setShowSignalSourceModal(true)}
|
||||
className="mt-3 px-3 py-1.5 rounded text-sm font-semibold transition-all hover:scale-105"
|
||||
style={{
|
||||
background: '#F0B90B',
|
||||
color: '#000',
|
||||
}}
|
||||
>
|
||||
立即配置信号源
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Configuration Status */}
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 md:gap-6">
|
||||
{/* AI Models */}
|
||||
|
||||
Reference in New Issue
Block a user