This commit is contained in:
eric
2026-04-02 05:30:18 -05:00
parent a59592bed5
commit a34217b182

View File

@@ -154,11 +154,10 @@ def shared_build_h5_keyword_message(query: str, user_id: str, profile_key: str)
"""关键词命中时返回文档约定的 H5 msg再经 _normalize 输出)。 """关键词命中时返回文档约定的 H5 msg再经 _normalize 输出)。
命中规则:对用户 Query 首尾 trim 后,**包含**配置词作为连续子串即命中(子串匹配), 命中规则:对用户 Query 首尾 trim 后,**包含**配置词作为连续子串即命中(子串匹配),
不要求用户整句与关键词全等。异度(/hackrobot) 群卡片仅认「群」Eric(/chatbot) 另认「加群」 不要求用户整句与关键词全等。群卡片统一按「群」子串命中
""" """
q = (query or "").strip() q = (query or "").strip()
uid = (user_id or "").strip() uid = (user_id or "").strip()
prof = _resolve_profile_key(profile_key)
if "电子书" in q: if "电子书" in q:
return { return {
"news": { "news": {
@@ -173,11 +172,7 @@ def shared_build_h5_keyword_message(query: str, user_id: str, profile_key: str)
] ]
} }
} }
if prof == HACKROBOT_PROFILE: group_hit = "" in q
# 「加群」含「群」子串,异度仅按「群」触发时需排除「加群」整词
group_hit = ("" in q) and ("加群" not in q)
else:
group_hit = ("" in q) or ("加群" in q)
if group_hit: if group_hit:
return { return {
"news": { "news": {