From afd8e73afb77a1b5ee87a196e4d13117b9184ab5 Mon Sep 17 00:00:00 2001 From: karuo Date: Wed, 25 Feb 2026 12:09:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20=E5=8D=A1=E8=8B=A5AI=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=202026-02-25=2012:09=20|=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=EF=BC=9A=E8=BF=90=E8=90=A5=E4=B8=AD=E6=9E=A2=E3=80=81=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E4=B8=AD=E6=9E=A2=E5=B7=A5=E4=BD=9C=E5=8F=B0=20|=20?= =?UTF-8?q?=E6=8E=92=E9=99=A4=20>20MB:=2013=20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 运营中枢/scripts/karuo_ai_gateway/main.py | 38 +++++++++++++++++++++-- 运营中枢/工作台/gitea_push_log.md | 1 + 运营中枢/工作台/代码管理.md | 1 + 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/运营中枢/scripts/karuo_ai_gateway/main.py b/运营中枢/scripts/karuo_ai_gateway/main.py index 1f4d9eaf..d6048828 100644 --- a/运营中枢/scripts/karuo_ai_gateway/main.py +++ b/运营中枢/scripts/karuo_ai_gateway/main.py @@ -252,6 +252,24 @@ def _build_provider_queue(llm_cfg: Dict[str, Any]) -> List[Dict[str, str]]: return providers +def _is_unusable_llm_reply(text: str) -> bool: + s = (text or "").strip().lower() + if not s: + return True + refusal_signals = [ + "i'm sorry", + "i am sorry", + "not able to assist", + "can't assist", + "cannot assist", + "无法协助", + "不能协助", + ] + if any(sig in s for sig in refusal_signals) and len(s) <= 160: + return True + return False + + def _send_provider_alert(cfg: Dict[str, Any], errors: List[str], prompt: str, matched_skill: str, skill_path: str) -> None: """ 当所有 LLM 接口都失败时,发邮件告警(支持 QQ SMTP)。 @@ -302,7 +320,19 @@ def _send_provider_alert(cfg: Dict[str, Any], errors: List[str], prompt: str, ma ) msg.set_content(body) - with smtplib.SMTP_SSL(smtp_host, smtp_port, timeout=15) as s: + # 先走 SSL(465),失败再尝试 STARTTLS(587) + try: + with smtplib.SMTP_SSL(smtp_host, smtp_port, timeout=15) as s: + s.login(smtp_user, smtp_pass) + s.send_message(msg) + return + except Exception: + pass + + with smtplib.SMTP(smtp_host, 587, timeout=15) as s: + s.ehlo() + s.starttls() + s.ehlo() s.login(smtp_user, smtp_pass) s.send_message(msg) @@ -335,7 +365,11 @@ def build_reply_with_llm(prompt: str, cfg: Dict[str, Any], matched_skill: str, s ) if r.status_code == 200: data = r.json() - return data["choices"][0]["message"]["content"] + reply = data["choices"][0]["message"]["content"] + if _is_unusable_llm_reply(reply): + errors.append(f"provider#{idx} unusable_reply={reply[:120]}") + continue + return reply errors.append(f"provider#{idx} status={r.status_code} body={r.text[:120]}") except Exception as e: errors.append(f"provider#{idx} exception={type(e).__name__}: {str(e)[:160]}") diff --git a/运营中枢/工作台/gitea_push_log.md b/运营中枢/工作台/gitea_push_log.md index c652768b..8e94d0ae 100644 --- a/运营中枢/工作台/gitea_push_log.md +++ b/运营中枢/工作台/gitea_push_log.md @@ -140,3 +140,4 @@ | 2026-02-25 10:26:04 | 🔄 卡若AI 同步 2026-02-25 10:26 | 更新:水桥平台对接、水溪整理归档 | 排除 >20MB: 13 个 | | 2026-02-25 11:03:16 | 🔄 卡若AI 同步 2026-02-25 11:03 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | | 2026-02-25 11:52:39 | 🔄 卡若AI 同步 2026-02-25 11:52 | 更新:水溪整理归档、运营中枢、运营中枢工作台 | 排除 >20MB: 13 个 | +| 2026-02-25 12:07:57 | 🔄 卡若AI 同步 2026-02-25 12:07 | 更新:Cursor规则、水桥平台对接、运营中枢、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 13 个 | diff --git a/运营中枢/工作台/代码管理.md b/运营中枢/工作台/代码管理.md index 3f5ae58d..466051be 100644 --- a/运营中枢/工作台/代码管理.md +++ b/运营中枢/工作台/代码管理.md @@ -143,3 +143,4 @@ | 2026-02-25 10:26:04 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 10:26 | 更新:水桥平台对接、水溪整理归档 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-25 11:03:16 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 11:03 | 更新:水桥平台对接、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | | 2026-02-25 11:52:39 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 11:52 | 更新:水溪整理归档、运营中枢、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) | +| 2026-02-25 12:07:57 | 成功 | 成功 | 🔄 卡若AI 同步 2026-02-25 12:07 | 更新:Cursor规则、水桥平台对接、运营中枢、运营中枢参考资料、运营中枢工作台 | 排除 >20MB: 13 个 | [仓库](http://open.quwanzhi.com:3000/fnvtk/karuo-ai) [百科](http://open.quwanzhi.com:3000/fnvtk/karuo-ai/wiki) |