From 2ff909cd36d8125637acaebe0c303ebf4b0bed28 Mon Sep 17 00:00:00 2001 From: shy3130 <415333856@qq.com> Date: Sat, 5 Sep 2026 17:16:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(notifications):=20#244=20=E7=BB=B4=E6=8A=A4?= =?UTF-8?q?=E8=80=85=E8=A1=A5=E4=B8=81=20=E2=80=94=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E9=A2=84=E5=9F=8B=E7=B1=BB=E5=9E=8B=E5=B9=B6=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E5=85=A8=E8=A7=92=E6=A0=87=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 api.ts 中与通知无关的 MainCostEstimate/StockLevels.main_cost 类型(对应后端字段在本仓库不存在, 属跨 PR 预埋, 全仓库零引用) - settings.py 5 处 PR 新增字符串的全角逗号改半角, RUF001 恢复到 main 基线(28 ≤ 29) - 验证: 通知测试 48 passed, 前端 build 通过 --- backend/app/api/settings.py | 10 +++++----- frontend/src/lib/api.ts | 14 -------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/backend/app/api/settings.py b/backend/app/api/settings.py index 4831dc9..ab88012 100644 --- a/backend/app/api/settings.py +++ b/backend/app/api/settings.py @@ -1292,7 +1292,7 @@ def update_email_smtp(req: EmailSmtpPrefsIn) -> dict: else req.password ) if username and not effective_password: - raise HTTPException(status_code=400, detail="已填写 SMTP 登录用户名,请同时填写密码或授权码") + raise HTTPException(status_code=400, detail="已填写 SMTP 登录用户名, 请同时填写密码或授权码") else: username = "" from_address = "" @@ -1353,9 +1353,9 @@ def test_webhook(req: WebhookTestIn) -> dict: elif req.channel == "custom": url = preferences.get_custom_webhook_url() if not url: - return {"ok": False, "detail": "尚未配置第三方 Webhook,请先保存"} + return {"ok": False, "detail": "尚未配置第三方 Webhook, 请先保存"} if not webhook_adapter.is_valid_custom_url(url): - return {"ok": False, "detail": "已保存的第三方 Webhook 地址非法,请重新保存"} + return {"ok": False, "detail": "已保存的第三方 Webhook 地址非法, 请重新保存"} ok = webhook_adapter.send_custom( url, title, @@ -1369,7 +1369,7 @@ def test_webhook(req: WebhookTestIn) -> dict: config = preferences.get_email_smtp_config() if not email_adapter.is_configured(config): - return {"ok": False, "detail": "尚未完整配置邮件 SMTP,请先保存"} + return {"ok": False, "detail": "尚未完整配置邮件 SMTP, 请先保存"} ok = email_adapter.send_email( config, secrets_store.get_email_smtp_password(), @@ -1379,7 +1379,7 @@ def test_webhook(req: WebhookTestIn) -> dict: ) if ok: - return {"ok": True, "detail": "测试消息已发送,请检查对应接收端"} + return {"ok": True, "detail": "测试消息已发送, 请检查对应接收端"} return {"ok": False, "detail": "推送失败:网络不可达或地址/密钥不正确,详情见后端日志"} diff --git a/frontend/src/lib/api.ts b/frontend/src/lib/api.ts index ee261f8..a0f2938 100644 --- a/frontend/src/lib/api.ts +++ b/frontend/src/lib/api.ts @@ -177,18 +177,6 @@ export interface LevelSeries { atr?: { stop_loss: (number | null)[]; take_profit: (number | null)[] } } -export interface MainCostEstimate { - estimated_main_cost: number | null - main_cost_peak: number | null - main_core_cost_low: number | null - main_core_cost_high: number | null - /** 小数制:0.10 表示估算浮盈 10% */ - main_profit_rate: number | null - main_net_amount: number - /** 0~1,表示输入数据完整度,不是结果真实准确率 */ - confidence: number -} - export interface StockLevels { levels: Record close: number | null @@ -197,8 +185,6 @@ export interface StockLevels { /** dates 与 series 对齐;前端按自身 rows 的日期映射,缺失填 null */ dates?: string[] series?: LevelSeries - /** 疑似主力成本统计估算;旧后端响应可能不存在该字段 */ - main_cost?: MainCostEstimate } export interface AiStockReport {