feat: 接入canvas_changes,优化部分代码

This commit is contained in:
2026-09-27 20:29:13 +08:00
parent eda1db1f88
commit 3ce1c1ae61
5 changed files with 156 additions and 71 deletions
+5
View File
@@ -59,6 +59,11 @@ def build_action_prompt(
else:
sections.append(PLAN_TASK_PROMPT)
action_types = set()
if screen_plan.canvas_changes:
sections.append(
"## 调整画布\n将 canvas_changes 中的最终属性值转换为 update_canvas,完整覆盖且不添加其他画布字段"
)
action_types.add("update_canvas")
if any(item.disposition == "add" for item in screen_plan.components):
action_types.add("add")
if any(item.disposition == "remove" for item in screen_plan.components):
+1
View File
@@ -8,6 +8,7 @@ PLANNER_SYSTEM_PROMPT = """## 任务
覆盖本次全部变更,保留约束,不重新判断意图或扩大修改范围
## 组件与布局
canvas_changes 只填写需求范围内要修改的画布顶层字段及最终值,不填写相对变化或设计描述
已有组件使用真实 target_id;无需改动的组件可保留或省略,省略不代表删除
remove 仅用于需求明确指定的删除目标,不能因为重新布局而擅自移除组件
布局未确定时写清排列关系;提供 layout 时表示最终的画布绝对坐标和尺寸,单位 px