fix: keep background removal out of canvas deletion
This commit is contained in:
parent
d4936a8ca4
commit
9151058d79
@ -140,6 +140,11 @@ function getDecisionNodeIds(params: {
|
||||
|
||||
function inferHighRiskOperation(userText: string) {
|
||||
const text = userText.toLowerCase();
|
||||
if (
|
||||
/删除背景|删掉背景|去掉背景|去背景|移除背景|抠图|去背/.test(text)
|
||||
) {
|
||||
return "";
|
||||
}
|
||||
if (
|
||||
/删除|删掉|删了|删去|移除/.test(text) ||
|
||||
/清空(?:画布|选中|当前|节点|对象|元素|这些|全部)/.test(text) ||
|
||||
|
||||
@ -696,6 +696,12 @@ test.describe("canvas chat pure helpers", () => {
|
||||
context: plannerContext,
|
||||
})
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldConsiderCanvasAgentModelPlanner({
|
||||
userText: "删除背景,结果放右边",
|
||||
context: plannerContext,
|
||||
})
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldConsiderCanvasAgentModelPlanner({
|
||||
userText: "新建一个视频槽位",
|
||||
@ -1731,6 +1737,22 @@ test.describe("canvas chat pure helpers", () => {
|
||||
riskOperation: "delete_nodes",
|
||||
targetNodeIds: ["image-1", "text-1"],
|
||||
});
|
||||
|
||||
const removeBackgroundOutcome = normalizeCanvasAgentModelPlannerDecision({
|
||||
decision: {
|
||||
action: "none",
|
||||
},
|
||||
context: plannerContext,
|
||||
projectId: plannerContext.projectId || "",
|
||||
messageId: "message-1",
|
||||
chatId: "chat-1",
|
||||
userText: "删除背景,结果放右边",
|
||||
});
|
||||
|
||||
expect(removeBackgroundOutcome).toEqual({
|
||||
kind: "none",
|
||||
reason: undefined,
|
||||
});
|
||||
});
|
||||
|
||||
test("builds pending move-node operation from model-planned high-risk layout", () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user