fix: copy inspect variable value get extra quotes

pull/21680/head
hjlarry 11 months ago
parent 18757d07c9
commit 2a8a98e732

@ -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()} />
)} )}
</> </>
)} )}

Loading…
Cancel
Save