mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 04:40:45 +08:00
扩展 Missing API key 提示的匹配规则以覆盖引号与文案变体,确保 wechat/weixin 侧不再回传该错误,并新增单元测试锁定该行为。 Made-with: Cursor
15 lines
751 B
Python
15 lines
751 B
Python
from __future__ import annotations
|
|
|
|
from oclaw.runtime.application.gateway.inbound_service import _should_suppress_channel_reply
|
|
|
|
|
|
def test_should_suppress_weixin_openai_missing_api_key_message() -> None:
|
|
text = '⚠️ Missing API key for provider "openai". Configure the gateway auth for that provider, then try again.'
|
|
assert _should_suppress_channel_reply(channel="wechat", text=text) is True
|
|
assert _should_suppress_channel_reply(channel="weixin", text=text) is True
|
|
|
|
|
|
def test_should_not_suppress_non_weixin_channel() -> None:
|
|
text = '⚠️ Missing API key for provider "openai". Configure the gateway auth for that provider, then try again.'
|
|
assert _should_suppress_channel_reply(channel="admin_chat", text=text) is False
|
|
|