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

Function getCode

packages/ui/src/views/vectorstore/VectorStoreDialog.jsx:104–168  ·  view source on GitHub ↗
(codeLang, vectorNodeId, isMultiple, configData)

Source from the content-addressed store, hash-verified

102 }
103
104 const getCode = (codeLang, vectorNodeId, isMultiple, configData) => {
105 if (codeLang === 'Python') {
106 return `import requests
107
108API_URL = "${baseURL}/api/v1/vector/upsert/${dialogProps.chatflowid}"
109
110def query(payload):
111 response = requests.post(API_URL, json=payload)
112 return response.json()
113
114output = query({
115 ${isMultiple ? `"stopNodeId": "${vectorNodeId}",\n ` : ``}"overrideConfig": {${getConfigExamplesForPython(
116 configData,
117 'json',
118 isMultiple,
119 vectorNodeId
120 )}
121 }
122})
123`
124 } else if (codeLang === 'JavaScript') {
125 return `async function query(data) {
126 const response = await fetch(
127 "${baseURL}/api/v1/vector/upsert/${dialogProps.chatflowid}",
128 {
129 method: "POST",
130 headers: {
131 "Content-Type": "application/json"
132 },
133 body: JSON.stringify(data)
134 }
135 );
136 const result = await response.json();
137 return result;
138}
139
140query({
141 ${isMultiple ? `"stopNodeId": "${vectorNodeId}",\n ` : ``}"overrideConfig": {${getConfigExamplesForJS(
142 configData,
143 'json',
144 isMultiple,
145 vectorNodeId
146 )}
147 }
148}).then((response) => {
149 console.log(response);
150});
151`
152 } else if (codeLang === 'cURL') {
153 return `curl ${baseURL}/api/v1/vector/upsert/${dialogProps.chatflowid} \\
154 -X POST \\
155 ${
156 isMultiple
157 ? `-d '{"stopNodeId": "${vectorNodeId}", "overrideConfig": {${getConfigExamplesForCurl(
158 configData,
159 'json',
160 isMultiple,
161 vectorNodeId

Callers 1

VectorStoreDialogFunction · 0.70

Calls 3

getConfigExamplesForJSFunction · 0.90
getConfigExamplesForCurlFunction · 0.90

Tested by

no test coverage detected