feat:意图识别优化

This commit is contained in:
2026-09-30 08:57:39 -07:00
parent 4d7c91cc41
commit 3e88b339a0
21 changed files with 443 additions and 88 deletions
+10
View File
@@ -18,6 +18,9 @@ PLAN_ADJUST_OPERATIONS: tuple[str, ...] = (
"layout",
)
# 只能通过规划完成的操作:新增要从物料目录选型并安排位置,重排要整体布局
PLAN_ONLY_OPERATIONS: tuple[str, ...] = ("add", "reflow", "layout")
# 写进协议描述和提示词的操作说明,词表变化时自动同步
OPERATION_GUIDE = (
f"修改已有组件用 {'、'.join(NODE_OPERATIONS)},"
@@ -40,6 +43,13 @@ def is_direct_operation(target_scope: str, operation: str) -> bool:
return False
def requires_planning(target_scope: str, operation: str) -> bool:
"""判断是否必须先规划;未登记的操作不在此列,由能力检查判为不支持"""
return not is_direct_operation(target_scope, operation) and (
operation in PLAN_ONLY_OPERATIONS
)
def is_canvas_operation(target_scope: str, operation: str) -> bool:
"""判断是否为画布属性修改"""
return target_scope == "canvas" and operation in CANVAS_OPERATIONS