Bugfix/Remove Markdown in Condition (#4761)

Feature/Add remove-markdown dependency and integrate into Condition node for text processing

- Added `remove-markdown` package to `packages/components/package.json`.
- Integrated `removeMarkdown` function in `Condition.ts` to sanitize string inputs by removing markdown formatting.
This commit is contained in:
Henry Heng 2025-06-30 12:06:23 +01:00 committed by GitHub
parent be7599542b
commit 9b60cf1234
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import { CommonType, ICommonObject, ICondition, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
import removeMarkdown from 'remove-markdown'
class Condition_Agentflow implements INode {
label: string
@ -300,8 +301,8 @@ class Condition_Agentflow implements INode {
value2 = parseFloat(_value2 as string) || 0
break
default: // string
value1 = _value1 as string
value2 = _value2 as string
value1 = removeMarkdown((_value1 as string) || '')
value2 = removeMarkdown((_value2 as string) || '')
}
const compareOperationResult = compareOperationFunctions[operation](value1, value2)

View File

@ -131,6 +131,7 @@
"puppeteer": "^20.7.1",
"pyodide": ">=0.21.0-alpha.2",
"redis": "^4.6.7",
"remove-markdown": "^0.6.2",
"replicate": "^0.31.1",
"sanitize-filename": "^1.6.3",
"srt-parser-2": "^1.2.3",

View File

@ -456,6 +456,9 @@ importers:
redis:
specifier: ^4.6.7
version: 4.6.13
remove-markdown:
specifier: ^0.6.2
version: 0.6.2
replicate:
specifier: ^0.31.1
version: 0.31.1
@ -15708,6 +15711,9 @@ packages:
resolution: { integrity: sha512-wigO8/O08XHb8YPzpDDT+QmRANfW6vLqxfaXm1YXhnFf3AkSLyjfG3GEFg4McZkmgL7KvCj5u2KczkvSP6NfHA== }
engines: { node: '>= 0.10' }
remove-markdown@0.6.2:
resolution: { integrity: sha512-EijDXJZbzpGbQBd852ViUzcqgpMujthM+SAEHiWCMcZonRbZ+xViWKLJA/vrwbDwYdxrs1aFDjpBhcGrZoJRGA== }
remove-trailing-separator@1.1.0:
resolution: { integrity: sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== }
@ -38298,6 +38304,8 @@ snapshots:
safe-buffer: 5.2.1
through2: 2.0.5
remove-markdown@0.6.2: {}
remove-trailing-separator@1.1.0: {}
renderkid@3.0.0: