This commit is contained in:
zyp
2026-11-27 21:27:14 +08:00
parent b18c6efe92
commit 5f204764c9
12 changed files with 563 additions and 28 deletions
+12
View File
@@ -19,6 +19,18 @@ def needs_scope_check(message: str) -> bool:
return bool(re.search(r"权限|账号|可见|能看|看到|有权|\b(?:visible|accessible|permission|account)\b", message, re.I))
def request_only_first_person(message: str) -> bool:
"""The beneficiary of 'help me look up' is not the record's business owner.
Only strips a leading speech act. '帮我查我的任务' still contains a real
first-person subject; follow-up ownership is inherited by the compiler.
"""
remainder, count = re.subn(
r'^\s*(?:(?:请|麻烦|能不能|可以)?(?:你)?(?:帮我|替我|给我)(?:查一下|查询|查看|核对|统计|看看|看一下|查|看|列出)?|我想(?:知道|了解|查询|看看|查一下))\s*',
'', message, count=1)
return count > 0 and not re.search(r'我|本人|自己|本人的', remainder)
def check_scope(message, previous_spec, invoke_model, timeout_seconds):
raw=invoke_model(
"只判断用户查询的业务主体,不查数据、不授予权限。账号有权查看的范围与本人参与的记录是两个维度。"