mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 19:00:59 +03:00
Bugfix/add regex to csv and airtable agent (#2983)
add regex to csv and airtable agent
This commit is contained in:
@@ -171,6 +171,8 @@ json.dumps(my_dict)`
|
||||
}
|
||||
const res = await chain.call(inputs, [loggerHandler, ...callbacks])
|
||||
pythonCode = res?.text
|
||||
// Regex to get rid of markdown code blocks syntax
|
||||
pythonCode = pythonCode.replace(/^```[a-z]+\n|\n```$/gm, '')
|
||||
}
|
||||
|
||||
// Then run the code using Pyodide
|
||||
@@ -178,6 +180,7 @@ json.dumps(my_dict)`
|
||||
if (pythonCode) {
|
||||
try {
|
||||
const code = `import pandas as pd\n${pythonCode}`
|
||||
// TODO: get print console output
|
||||
finalResult = await pyodide.runPythonAsync(code)
|
||||
} catch (error) {
|
||||
throw new Error(`Sorry, I'm unable to find answer for question: "${input}" using following code: "${pythonCode}"`)
|
||||
|
||||
Reference in New Issue
Block a user