Skip to content

Commit 9b60cf1

Browse files
authored
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.
1 parent be75995 commit 9b60cf1

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

packages/components/nodes/agentflow/Condition/Condition.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { CommonType, ICommonObject, ICondition, INode, INodeData, INodeOutputsValue, INodeParams } from '../../../src/Interface'
2+
import removeMarkdown from 'remove-markdown'
23

34
class Condition_Agentflow implements INode {
45
label: string
@@ -300,8 +301,8 @@ class Condition_Agentflow implements INode {
300301
value2 = parseFloat(_value2 as string) || 0
301302
break
302303
default: // string
303-
value1 = _value1 as string
304-
value2 = _value2 as string
304+
value1 = removeMarkdown((_value1 as string) || '')
305+
value2 = removeMarkdown((_value2 as string) || '')
305306
}
306307

307308
const compareOperationResult = compareOperationFunctions[operation](value1, value2)

packages/components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
"puppeteer": "^20.7.1",
132132
"pyodide": ">=0.21.0-alpha.2",
133133
"redis": "^4.6.7",
134+
"remove-markdown": "^0.6.2",
134135
"replicate": "^0.31.1",
135136
"sanitize-filename": "^1.6.3",
136137
"srt-parser-2": "^1.2.3",

pnpm-lock.yaml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)