MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / getConfigExamplesForJS

Function getConfigExamplesForJS

packages/ui/src/utils/genericHelper.js:939–960  ·  view source on GitHub ↗
(configData, bodyType, isMultiple, stopNodeId)

Source from the content-addressed store, hash-verified

937}
938
939export const getConfigExamplesForJS = (configData, bodyType, isMultiple, stopNodeId) => {
940 let finalStr = ''
941 configData = unshiftFiles(configData)
942 const loop = Math.min(configData.length, 4)
943 for (let i = 0; i < loop; i += 1) {
944 const config = configData[i]
945 let exampleVal = `"example"`
946 if (config.type === 'string') exampleVal = `"example"`
947 else if (config.type === 'boolean') exampleVal = `true`
948 else if (config.type === 'number') exampleVal = `1`
949 else if (config.type === 'json') exampleVal = `{ "key": "val" }`
950 else if (config.name === 'files') exampleVal = `input.files[0]`
951 finalStr += bodyType === 'json' ? `\n "${config.name}": ${exampleVal},` : `formData.append("${config.name}", ${exampleVal})\n`
952 if (i === loop - 1 && bodyType !== 'json')
953 finalStr += !isMultiple
954 ? ``
955 : stopNodeId
956 ? `formData.append("stopNodeId", "${stopNodeId}")\n`
957 : `formData.append("question", "Hey, how are you?")\n`
958 }
959 return finalStr
960}
961
962export const getConfigExamplesForPython = (configData, bodyType, isMultiple, stopNodeId) => {
963 let finalStr = ''

Callers 6

getConfigCodeFunction · 0.90
getCodeFunction · 0.90
getCodeWithFormDataFunction · 0.90

Calls 1

unshiftFilesFunction · 0.85

Tested by

no test coverage detected