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

Function getConfigExamplesForCurl

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

Source from the content-addressed store, hash-verified

983}
984
985export const getConfigExamplesForCurl = (configData, bodyType, isMultiple, stopNodeId) => {
986 let finalStr = ''
987 configData = unshiftFiles(configData)
988 const loop = Math.min(configData.length, 4)
989 for (let i = 0; i < loop; i += 1) {
990 const config = configData[i]
991 let exampleVal = `"example"`
992 if (config.type === 'string') exampleVal = bodyType === 'json' ? `"example"` : `example`
993 else if (config.type === 'boolean') exampleVal = `true`
994 else if (config.type === 'number') exampleVal = `1`
995 else if (config.type === 'json') exampleVal = `{key:val}`
996 else if (config.name === 'files')
997 exampleVal = `@/home/user1/Desktop/example${config.type.includes(',') ? config.type.split(',')[0] : config.type}`
998 finalStr += bodyType === 'json' ? `"${config.name}": ${exampleVal}` : `\n -F "${config.name}=${exampleVal}"`
999 if (i === loop - 1)
1000 finalStr +=
1001 bodyType === 'json'
1002 ? ` }`
1003 : !isMultiple
1004 ? ``
1005 : stopNodeId
1006 ? ` \\\n -F "stopNodeId=${stopNodeId}"`
1007 : ` \\\n -F "question=Hey, how are you?"`
1008 else finalStr += bodyType === 'json' ? `, ` : ` \\`
1009 }
1010 return finalStr
1011}
1012
1013export const getOS = () => {
1014 let userAgent = window.navigator.userAgent.toLowerCase(),

Callers 6

getConfigCodeFunction · 0.90
getCodeFunction · 0.90
getCodeWithFormDataFunction · 0.90

Calls 1

unshiftFilesFunction · 0.85

Tested by

no test coverage detected