MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / handleRequest

Function handleRequest

frontend/src/components/retrieval/index.tsx:283–321  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

281 }
282
283 const handleRequest = async () => {
284 if (selectedRows.length === 0 || !selectValue) {
285 return toast.error(`${t('missingRequiredParameters')}`)
286 }
287 try {
288
289 if (collectionId) {
290 const params = {
291 name: drawerName || '',
292 description: descriptionText || ''
293 }
294 await updateRetrieval(collectionId, params)
295
296 } else {
297 const params = {
298 capacity: Number(selectValue),
299 embedding_model_id: selectedRows[0].slice(-8),
300
301 name: drawerName || '',
302 description: descriptionText || '',
303 embedding_size: embeddingSize || undefined,
304 metadata: {}
305 }
306 await createRetrieval(params)
307 }
308 setOpenDrawer(false)
309 setIsVisible(true)
310 const limit1 = limit || 20
311 dispatch(fetchRetrievalData({
312 limit: limit1
313 }) as any);
314 setUpdateRetrievalPrevButton(true)
315
316 } catch (error) {
317 const apiError = error as ApiErrorResponse;
318 const errorMessage: string = apiError.response.data.error.message;
319 toast.error(errorMessage)
320 }
321 }
322 const handleNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
323 setDrawerName(e.target.value)
324 }

Callers 1

RetrievalFunction · 0.70

Calls 3

updateRetrievalFunction · 0.90
createRetrievalFunction · 0.90
fetchRetrievalDataFunction · 0.90

Tested by

no test coverage detected