fix: copy inspect variable value get extra quotes (#21680)

This commit is contained in:
非法操作
2025-06-30 22:14:29 +08:00
committed by GitHub
parent 55a6b330ec
commit eb9edf4908

View File

@@ -63,6 +63,17 @@ const Right = ({
resetConversationVar(currentNodeVar.var.id) resetConversationVar(currentNodeVar.var.id)
} }
const getCopyContent = () => {
const value = currentNodeVar?.var.value
if (value === null || value === undefined)
return ''
if (typeof value === 'object')
return JSON.stringify(value)
return String(value)
}
return ( return (
<div className={cn('flex h-full flex-col')}> <div className={cn('flex h-full flex-col')}>
{/* header */} {/* header */}
@@ -124,7 +135,7 @@ const Right = ({
</Tooltip> </Tooltip>
)} )}
{currentNodeVar.var.value_type !== 'secret' && ( {currentNodeVar.var.value_type !== 'secret' && (
<CopyFeedback content={currentNodeVar.var.value ? JSON.stringify(currentNodeVar.var.value) : ''} /> <CopyFeedback content={getCopyContent()} />
)} )}
</> </>
)} )}