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

Function handleConfirm

frontend/src/components/modelsPage/index.tsx:273–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271
272 }
273 const handleConfirm = async () => {
274 const function_call = propertyForm.getFieldValue('function_call')
275 const wildcardFunctioncall = wildcardForm.getFieldValue('function_call')
276 if (!function_call) {
277 propertyForm.setFieldValue('function_call', false)
278 }
279 if (!wildcardFunctioncall) {
280 wildcardForm.setFieldValue('function_call', false)
281 }
282 const streaming = propertyForm.getFieldValue('streaming')
283 const wildcardStreaming = wildcardForm.getFieldValue('streaming')
284 if (!streaming) {
285 propertyForm.setFieldValue('streaming', false)
286 }
287 if (!wildcardStreaming) {
288 wildcardForm.setFieldValue('streaming', false)
289 }
290 const values = propertyForm.getFieldsValue();
291 const wildcardValues = wildcardForm.getFieldsValue();
292 const numericValues: any = {};
293 const numericValues1: any = {}
294 for (const key in values) {
295 if (typeof values[key] === 'boolean') {
296 numericValues[key] = values[key];
297 } else {
298 const value = Number(values[key]);
299 numericValues[key] = isNaN(value) ? values[key] : value;
300 }
301 }
302 for (const key in wildcardValues) {
303 if (typeof wildcardValues[key] === 'boolean') {
304 numericValues1[key] = wildcardValues[key];
305 } else {
306 const value = Number(wildcardValues[key]);
307 numericValues1[key] = isNaN(value) ? wildcardValues[key] : value;
308 }
309 }
310 await form1.validateFields().then(async () => {
311 await propertyForm.validateFields()
312 await wildcardForm.validateFields()
313 await form.validateFields().then(async () => {
314 const params = {
315 name: form1.getFieldValue('name'),
316 credentials: resetButtonShow ? undefined : form.getFieldsValue(),
317 properties: numericValues,
318 model_schema_id: selectedSecondId,
319 host_type: 'provider'
320
321 }
322 const wildcardParams = {
323 name: form1.getFieldValue('name'),
324 model_schema_id: selectedSecondId,
325 provider_model_id: form1.getFieldValue('provider_model_id'),
326 credentials: resetButtonShow ? undefined : form.getFieldsValue(),
327 properties: numericValues1,
328 type: type,
329 host_type: 'provider'
330 }

Callers

nothing calls this directly

Calls 2

updateModelsFunction · 0.90
fetchModelsDataFunction · 0.90

Tested by

no test coverage detected