From fcc5fd66f8df587bbdb34325096e7890bd3d4ae8 Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Tue, 31 Mar 2026 11:39:42 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=EF=BC=9A=20=E5=88=A0=E9=99=A4sketch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lang/en.ts | 28 ++++++++++++++------- src/lang/zh-cn.ts | 26 +++++++++++++------ src/views/home/agent/components/Preview.vue | 24 +++++++++++------- src/views/home/agent/index.vue | 18 +++++++------ 4 files changed, 62 insertions(+), 34 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index 3c53f63..38fc16d 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -164,7 +164,11 @@ export default { delete: 'Delete', edit: 'Edit', generatingReport: - 'We are generating your report. This may take a few minutes, but you can continue with other tasks while it’s being generated.' + 'We are generating your report. This may take a few minutes, but you can continue with other tasks while it’s being generated.', + deleteSketchTip: + 'Are you sure you want to delete this sketch? This action cannot be undone.', + confirm: 'Confirm', + cancel: 'Cancel' }, // Version Tree @@ -195,14 +199,20 @@ export default { cannotFindSuperiorImage: 'Cannot find the superior image', deleteSubordinateCard: 'After deletion, all the function cards will also be deleted.', initialNodeProhibited: 'Initial node is prohibited from being deleted.', - toRealStyleDesignAssistant: "🎨 This is one of my favorite parts — just bring in your sketch and I'll take care of the lighting, materials, and rendering to give you a photorealistic result. If the first one doesn't feel quite right, let me try a few more times — I'll give you something a little different each time.", - surfaceEditCanvasDesignAssistant: "🪡 If you have something specific in mind for the materials, this is the mode for that. I can help you swap to fabric, leather, wood, or whatever fits your vision — and if you have your own print, you can upload it directly. This mode gives you full manual control so you can fine-tune exactly what you want. If you'd rather move faster, just switch over and I'll handle it with AI Smart Mapping.", - surfaceEditAIDesignAssistant: "🪡 Want to see how a different material looks without the extra steps? Tell me what you're going for and I'll apply it using AI Smart Mapping — quick and automatic. If you want to dial in the details afterward, just switch to Canvas Mode and we can keep refining.", - colorPaletteDesignAssistant: "🎨 Let me handle the color combinations for you — just pick a few colors you like, and I'll mix and apply them to your product automatically. I can generate several options at once so you can compare and go with the one that feels right.", - sceneCompositionDesignAssistant: "🛋️ I'll place your product into a real interior scene and match the lighting automatically so everything looks like it belongs together. My suggestion: let me make one clean hero shot with a simple background first, then one lifestyle image with more atmosphere — the two together tend to work really well for presentations.", - threeModelDesignAssistant: "🔄 I'll turn your render into a 3D model you can rotate and look at from any angle. I'd recommend paying close attention to the corner joints, leg proportions, and seat depth — these are the spots that are easy to miss in a sketch but tend to cause the most trouble during prototyping. Better to catch them now while it's easy to fix.", - to3DViewDesignAssistant: "📐 We're at the final step! I'll export your 3D model as front, side, and top view!", - + toRealStyleDesignAssistant: + "🎨 This is one of my favorite parts — just bring in your sketch and I'll take care of the lighting, materials, and rendering to give you a photorealistic result. If the first one doesn't feel quite right, let me try a few more times — I'll give you something a little different each time.", + surfaceEditCanvasDesignAssistant: + "🪡 If you have something specific in mind for the materials, this is the mode for that. I can help you swap to fabric, leather, wood, or whatever fits your vision — and if you have your own print, you can upload it directly. This mode gives you full manual control so you can fine-tune exactly what you want. If you'd rather move faster, just switch over and I'll handle it with AI Smart Mapping.", + surfaceEditAIDesignAssistant: + "🪡 Want to see how a different material looks without the extra steps? Tell me what you're going for and I'll apply it using AI Smart Mapping — quick and automatic. If you want to dial in the details afterward, just switch to Canvas Mode and we can keep refining.", + colorPaletteDesignAssistant: + "🎨 Let me handle the color combinations for you — just pick a few colors you like, and I'll mix and apply them to your product automatically. I can generate several options at once so you can compare and go with the one that feels right.", + sceneCompositionDesignAssistant: + "🛋️ I'll place your product into a real interior scene and match the lighting automatically so everything looks like it belongs together. My suggestion: let me make one clean hero shot with a simple background first, then one lifestyle image with more atmosphere — the two together tend to work really well for presentations.", + threeModelDesignAssistant: + "🔄 I'll turn your render into a 3D model you can rotate and look at from any angle. I'd recommend paying close attention to the corner joints, leg proportions, and seat depth — these are the spots that are easy to miss in a sketch but tend to cause the most trouble during prototyping. Better to catch them now while it's easy to fix.", + to3DViewDesignAssistant: + "📐 We're at the final step! I'll export your 3D model as front, side, and top view!" }, assistant: { inputPlaceholder: 'Ask anything' diff --git a/src/lang/zh-cn.ts b/src/lang/zh-cn.ts index 755f3f2..0498dda 100644 --- a/src/lang/zh-cn.ts +++ b/src/lang/zh-cn.ts @@ -155,7 +155,10 @@ export default { quote: '引用', delete: '删除', edit: '编辑', - generatingReport: '正在为您生成报告,可能需要几分钟时间,生成期间你可以继续进行其他任务' + generatingReport: '正在为您生成报告,可能需要几分钟时间,生成期间你可以继续进行其他任务', + deleteSketchTip: '确定要删除这个草图吗?此操作无法撤销。', + confirm: '确认', + cancel: '取消' }, // Version Tree @@ -191,13 +194,20 @@ export default { confirmLeave: '您可能有未保存的更改,确定要离开吗?', cannotFindSuperiorImage: '找不到上级图片', initialNodeProhibited: '初始节点不能删除', - toRealStyleDesignAssistant: "🎨 这个功能我很喜欢——你只需要把草图丢进来,我来帮你把光影和材质都处理好,直接生成真实感效果图。出来不满意的话就多试几次,每次我都会给你不一样的结果。", - surfaceEditCanvasDesignAssistant: "🪡 如果你对材质有具体想法,可以用这个模式来做。布艺、皮革、木材这些都可以换,也可以把你自己的印花上传进来。这个模式支持你手动精细编辑,想细调哪里都可以——当然如果想快一点,也可以切换到 AI 智能贴图帮你完成。", - surfaceEditAIDesignAssistant: "🪡 想快速看看换材质之后的效果?用这个模式,把你想要的材质或印花告诉我,AI 智能贴图帮你一步到位。如果觉得还想再调整细节,随时可以切换到 Canvas 模式继续编辑。", - colorPaletteDesignAssistant: "🎨 配色交给我来帮你——你选几种喜欢的颜色,我来帮你搭配应用到产品上。我可以一次给你生成好几个方案,你对比着挑就好。", - sceneCompositionDesignAssistant: "🛋️ 我来帮你把产品放进一个真实的空间场景里,光影我会自动帮你匹配。我的建议是先出一张背景干净的主图,再出一张有生活感的氛围图,两张配合着用,展示效果会好很多。", - threeModelDesignAssistant: "🔄 我把你的效果图变成可以转着看的立体模型,你可以从各个角度检查一下结构。我建议重点看看转角、腿脚比例和座面厚度——这几个地方在草图里不容易发现问题,但打样的时候最容易出偏差,现在发现比较好改。", - to3DViewDesignAssistant: "📐 我们到最后一步了!我来帮你把 3D 模型导出为前视图、侧视图和俯视图!", + toRealStyleDesignAssistant: + '🎨 这个功能我很喜欢——你只需要把草图丢进来,我来帮你把光影和材质都处理好,直接生成真实感效果图。出来不满意的话就多试几次,每次我都会给你不一样的结果。', + surfaceEditCanvasDesignAssistant: + '🪡 如果你对材质有具体想法,可以用这个模式来做。布艺、皮革、木材这些都可以换,也可以把你自己的印花上传进来。这个模式支持你手动精细编辑,想细调哪里都可以——当然如果想快一点,也可以切换到 AI 智能贴图帮你完成。', + surfaceEditAIDesignAssistant: + '🪡 想快速看看换材质之后的效果?用这个模式,把你想要的材质或印花告诉我,AI 智能贴图帮你一步到位。如果觉得还想再调整细节,随时可以切换到 Canvas 模式继续编辑。', + colorPaletteDesignAssistant: + '🎨 配色交给我来帮你——你选几种喜欢的颜色,我来帮你搭配应用到产品上。我可以一次给你生成好几个方案,你对比着挑就好。', + sceneCompositionDesignAssistant: + '🛋️ 我来帮你把产品放进一个真实的空间场景里,光影我会自动帮你匹配。我的建议是先出一张背景干净的主图,再出一张有生活感的氛围图,两张配合着用,展示效果会好很多。', + threeModelDesignAssistant: + '🔄 我把你的效果图变成可以转着看的立体模型,你可以从各个角度检查一下结构。我建议重点看看转角、腿脚比例和座面厚度——这几个地方在草图里不容易发现问题,但打样的时候最容易出偏差,现在发现比较好改。', + to3DViewDesignAssistant: + '📐 我们到最后一步了!我来帮你把 3D 模型导出为前视图、侧视图和俯视图!' }, assistant: { inputPlaceholder: '请输入' diff --git a/src/views/home/agent/components/Preview.vue b/src/views/home/agent/components/Preview.vue index 020bfc1..8a25baf 100644 --- a/src/views/home/agent/components/Preview.vue +++ b/src/views/home/agent/components/Preview.vue @@ -236,15 +236,21 @@ MyEvent.emit('quote', url) } - const handleClickDelete = (item: string | Object) => { - deleteSketchFlowCanvas({ - id: Object.keys(item)[0], - versionNodeId: projectStore.state.nodeId - }).then((res) => { - if (res) { - ElMessage.success(t('agent.deleteSuccess')) - emits('deleteSketch', Object.keys(item)[0]) - } + const handleClickDelete = (item: { id: string; url: string }) => { + ElMessageBox.confirm(t('agent.deleteSketchTip'), t('agent.confirm'), { + confirmButtonText: t('agent.confirm'), + cancelButtonText: t('agent.cancel'), + type: 'warning' + }).then(() => { + deleteSketchFlowCanvas({ + id: item.id, + versionNodeId: projectStore.state.nodeId + }).then((res) => { + if (res) { + ElMessage.success(t('agent.deleteSuccess')) + emits('deleteSketch', item.id) + } + }) }) } diff --git a/src/views/home/agent/index.vue b/src/views/home/agent/index.vue index b18f40a..d1c5687 100644 --- a/src/views/home/agent/index.vue +++ b/src/views/home/agent/index.vue @@ -57,13 +57,15 @@ // VersionTreeIndexRef.value.getVersionTree() } - const handleDeleteSketch = (deletedId: string) => { - sketchList.value = sketchList.value.filter((item) => { - if (typeof item === 'object') { - return Object.keys(item)[0] !== deletedId - } - return true - }) + const handleDeleteSketch = (id) => { + sketchList.value = sketchList.value + .map((sketchItem) => { + if (sketchItem.hasOwnProperty(id)) { + delete sketchItem[id] + } + return sketchItem + }) + .filter((sketchItem) => Object.keys(sketchItem).length > 0) } const handleSetTitle = (title: string) => { @@ -93,7 +95,7 @@ const handleGetProjectInfoAndHistory = () => { handleOpenSketch() getProjectInfo({ id: route.params.id }).then((res) => { - if(!res) { + if (!res) { router.push({ name: 'mainInput' }) ElMessage.warning(t('Home.notFound')) return