From 9fd850b449f81f5dee37a8678e30ac157ec9356a Mon Sep 17 00:00:00 2001 From: JzoNg Date: Fri, 30 May 2025 16:48:28 +0800 Subject: [PATCH] support reset conversation variable value --- .../components/workflow/variable-inspect/right.tsx | 14 ++++++++++++++ web/i18n/en-US/workflow.ts | 2 +- web/i18n/zh-Hans/workflow.ts | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/right.tsx b/web/app/components/workflow/variable-inspect/right.tsx index 3b0920c6fa..8bc9d9d2e2 100644 --- a/web/app/components/workflow/variable-inspect/right.tsx +++ b/web/app/components/workflow/variable-inspect/right.tsx @@ -2,6 +2,7 @@ import { useTranslation } from 'react-i18next' import { RiArrowGoBackLine, RiCloseLine, + RiDeleteBinLine, RiMenuLine, } from '@remixicon/react' import { useStore } from '../store' @@ -38,6 +39,7 @@ const Right = ({ const setCurrentFocusNodeId = useStore(s => s.setCurrentFocusNodeId) const { + resetConversationVar, resetToLastRunVar, editInspectVarValue, } = useCurrentVars() @@ -57,6 +59,11 @@ const Right = ({ setCurrentFocusNodeId('') } + const handleClear = () => { + if (!currentNodeVar) return + resetConversationVar(currentNodeVar.var.id) + } + return (
{/* header */} @@ -110,6 +117,13 @@ const Right = ({ )} + {currentNodeVar.var.type === VarInInspectType.conversation && ( + + + + + + )} {currentNodeVar.var.value_type !== 'secret' && ( )} diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index c50df8f62e..fb38646529 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -924,7 +924,7 @@ const translation = { title: 'Variable Inspect', emptyTip: 'After stepping through a node on the canvas or running a node step by step, you can view the current value of the node variable in Variable Inspect', emptyLink: 'Learn more', - clearAll: 'Clear all', + clearAll: 'Reset all', clearNode: 'Clear cached variable', view: 'View log', edited: 'Edited', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index f8858cd213..be239b8f64 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -925,7 +925,7 @@ const translation = { title: '变量检查', emptyTip: '在画布上逐步浏览节点或逐步运行节点后,您可以在变量检查中查看节点变量的当前值', emptyLink: '了解更多', - clearAll: '清除所有', + clearAll: '重置所有', clearNode: '清除缓存', view: '查看记录', edited: '已编辑',