feat: 接入新动作 update_canvas
This commit is contained in:
@@ -20,7 +20,7 @@ input_context 提供当前大屏快照、用户原文及编辑上下文
|
||||
"""
|
||||
|
||||
SIMPLE_TASK_PROMPT = """# 当前任务:直接修改
|
||||
将 requirement.changes 转换成对应动作,只修改其中指定的已有组件和属性
|
||||
将 requirement.changes 转换成对应动作,只修改其中指定的组件或画布属性
|
||||
"""
|
||||
|
||||
PLAN_TASK_PROMPT = """# 当前任务:按规划生成
|
||||
@@ -52,7 +52,10 @@ def build_action_prompt(
|
||||
sections = [ACTION_SYSTEM_PROMPT]
|
||||
if screen_plan is None:
|
||||
sections.append(SIMPLE_TASK_PROMPT)
|
||||
action_types = {change.operation for change in requirement.changes}
|
||||
action_types = {
|
||||
"update_canvas" if change.target_scope == "canvas" else change.operation
|
||||
for change in requirement.changes
|
||||
}
|
||||
else:
|
||||
sections.append(PLAN_TASK_PROMPT)
|
||||
action_types = set()
|
||||
|
||||
@@ -2,6 +2,11 @@
|
||||
|
||||
# 新增动作时在这里补充模型需要理解的执行语义
|
||||
ACTION_RULES: dict[str, str] = {
|
||||
"update_canvas": """## update_canvas:更新画布属性
|
||||
将 canvas 范围的 update、resize 或 update_canvas 需求转换为此动作,不填写 target_id
|
||||
properties 只包含需要修改的画布顶层字段,宽高为最终绝对值,相对变化依据当前画布换算
|
||||
顶层字段整体替换,未提供的字段保持不变;改变画布尺寸不会自动缩放或移动组件
|
||||
""",
|
||||
"delete": """## delete:删除已有组件
|
||||
使用真实 target_id,只删除需求明确指定的组件;规划中的 remove 对应 delete
|
||||
每个目标仅删除一次,删除后不能再移动、调整尺寸或更新该目标
|
||||
|
||||
Reference in New Issue
Block a user