support reset conversation variable value

This commit is contained in:
JzoNg 2025-05-30 16:48:28 +08:00
parent 4ba525c4c9
commit 9fd850b449
3 changed files with 16 additions and 2 deletions

View File

@ -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 (
<div className={cn('flex h-full flex-col')}>
{/* header */}
@ -110,6 +117,13 @@ const Right = ({
</ActionButton>
</Tooltip>
)}
{currentNodeVar.var.type === VarInInspectType.conversation && (
<Tooltip popupContent={t('workflow.debug.variableInspect.clearNode')}>
<ActionButton onClick={handleClear}>
<RiDeleteBinLine className='h-4 w-4' />
</ActionButton>
</Tooltip>
)}
{currentNodeVar.var.value_type !== 'secret' && (
<CopyFeedback content={currentNodeVar.var.value ? JSON.stringify(currentNodeVar.var.value) : ''} />
)}

View File

@ -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',

View File

@ -925,7 +925,7 @@ const translation = {
title: '变量检查',
emptyTip: '在画布上逐步浏览节点或逐步运行节点后,您可以在变量检查中查看节点变量的当前值',
emptyLink: '了解更多',
clearAll: '清除所有',
clearAll: '重置所有',
clearNode: '清除缓存',
view: '查看记录',
edited: '已编辑',