From 646c64396272fe85c08ac6bd11fe715222371394 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Mar 2026 04:18:54 +0000 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E7=95=AB?= =?UTF-8?q?=E5=B8=83=E5=84=B2=E5=AD=98=E3=80=81=E7=AF=84=E4=BE=8B=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=E3=80=81=E9=87=8D=E8=A8=AD=E8=88=87=E6=B8=85=E7=A9=BA?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 自動將畫布狀態儲存至 localStorage,重新載入後保留 - 新增初始範例流程(開始→知識庫/模板→LLM→條件判斷→結束/HTTP) - 首次開啟時自動載入範例流程 - 工具列新增「範例」按鈕,可重設畫布到範例流程 - 工具列新增「清空」按鈕,清除所有節點只保留開始節點 https://claude.ai/code/session_0175xLAEKifqXsG4KxS1wXP4 --- src/App.css | 20 ++++ src/components/panels/Toolbar.tsx | 29 ++++- src/store/workflowStore.ts | 181 +++++++++++++++++++++++++++++- 3 files changed, 224 insertions(+), 6 deletions(-) diff --git a/src/App.css b/src/App.css index 7de163d..cd67fef 100644 --- a/src/App.css +++ b/src/App.css @@ -589,6 +589,26 @@ background: #fef2f2 !important; } +.reset-example-btn { + font-size: 12px; + font-weight: 500; +} + +.reset-example-btn:hover { + color: #6366f1 !important; + background: #f5f3ff !important; +} + +.clear-canvas-btn { + font-size: 12px; + font-weight: 500; +} + +.clear-canvas-btn:hover { + color: #ef4444 !important; + background: #fef2f2 !important; +} + /* ====== React Flow Overrides ====== */ .react-flow__panel { margin: 0 !important; diff --git a/src/components/panels/Toolbar.tsx b/src/components/panels/Toolbar.tsx index 8c548f6..01fba67 100644 --- a/src/components/panels/Toolbar.tsx +++ b/src/components/panels/Toolbar.tsx @@ -1,13 +1,27 @@ import { useReactFlow } from '@xyflow/react'; -import { ZoomIn, ZoomOut, Maximize, Undo2, Redo2, PlayCircle, Loader2, RotateCcw } from 'lucide-react'; +import { ZoomIn, ZoomOut, Maximize, Undo2, Redo2, PlayCircle, Loader2, RotateCcw, BookOpen, Trash2 } from 'lucide-react'; import { useWorkflowStore } from '../../store/workflowStore'; export default function Toolbar() { const { zoomIn, zoomOut, fitView } = useReactFlow(); - const { startExecution, clearExecution, execution, undo, redo, canUndo, canRedo } = useWorkflowStore(); + const { startExecution, clearExecution, execution, undo, redo, canUndo, canRedo, resetToExample, clearCanvas } = useWorkflowStore(); const isRunning = execution?.isRunning ?? false; const hasResults = execution !== null && !execution.isRunning; + const handleReset = () => { + if (confirm('確定要重設為範例流程嗎?目前的畫布內容將會被覆蓋。')) { + resetToExample(); + setTimeout(() => fitView({ padding: 0.2 }), 50); + } + }; + + const handleClear = () => { + if (confirm('確定要清空畫布嗎?將只保留開始節點。')) { + clearCanvas(); + setTimeout(() => fitView({ padding: 0.2 }), 50); + } + }; + return (
@@ -31,6 +45,17 @@ export default function Toolbar() {
+
+ + +
+
+
diff --git a/src/components/panels/Toolbar.tsx b/src/components/panels/Toolbar.tsx index 01fba67..8c548f6 100644 --- a/src/components/panels/Toolbar.tsx +++ b/src/components/panels/Toolbar.tsx @@ -1,27 +1,13 @@ import { useReactFlow } from '@xyflow/react'; -import { ZoomIn, ZoomOut, Maximize, Undo2, Redo2, PlayCircle, Loader2, RotateCcw, BookOpen, Trash2 } from 'lucide-react'; +import { ZoomIn, ZoomOut, Maximize, Undo2, Redo2, PlayCircle, Loader2, RotateCcw } from 'lucide-react'; import { useWorkflowStore } from '../../store/workflowStore'; export default function Toolbar() { const { zoomIn, zoomOut, fitView } = useReactFlow(); - const { startExecution, clearExecution, execution, undo, redo, canUndo, canRedo, resetToExample, clearCanvas } = useWorkflowStore(); + const { startExecution, clearExecution, execution, undo, redo, canUndo, canRedo } = useWorkflowStore(); const isRunning = execution?.isRunning ?? false; const hasResults = execution !== null && !execution.isRunning; - const handleReset = () => { - if (confirm('確定要重設為範例流程嗎?目前的畫布內容將會被覆蓋。')) { - resetToExample(); - setTimeout(() => fitView({ padding: 0.2 }), 50); - } - }; - - const handleClear = () => { - if (confirm('確定要清空畫布嗎?將只保留開始節點。')) { - clearCanvas(); - setTimeout(() => fitView({ padding: 0.2 }), 50); - } - }; - return (
@@ -45,17 +31,6 @@ export default function Toolbar() {
-
- - -
-
- - -
From 2b9d2cfdf6f04f8e6273838442f443fd2820e82d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Mar 2026 05:57:25 +0000 Subject: [PATCH 4/4] =?UTF-8?q?style:=20=E7=A7=BB=E9=99=A4=E7=AF=84?= =?UTF-8?q?=E4=BE=8B=E8=88=87=E6=B8=85=E7=A9=BA=E6=8C=89=E9=88=95=E7=9A=84?= =?UTF-8?q?=20icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://claude.ai/code/session_0175xLAEKifqXsG4KxS1wXP4 --- src/App.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 759f4e0..c8a5d18 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,4 @@ import { ReactFlowProvider } from '@xyflow/react'; -import { BookOpen, Trash2 } from 'lucide-react'; import WorkflowCanvas from './components/WorkflowCanvas'; import { useWorkflowStore } from './store/workflowStore'; import './App.css'; @@ -27,14 +26,8 @@ function App() {

Workflow Builder

- - + +