From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/tools/utils/to-form-schema.ts | 33 +-------------------------------- 1 files changed, 1 insertions(+), 32 deletions(-) diff --git a/app/components/tools/utils/to-form-schema.ts b/app/components/tools/utils/to-form-schema.ts index 179f590..4e83248 100644 --- a/app/components/tools/utils/to-form-schema.ts +++ b/app/components/tools/utils/to-form-schema.ts @@ -1,5 +1,5 @@ import type { ToolCredential, ToolParameter } from '../types' -export const toType = (type: string) => { +const toType = (type: string) => { switch (type) { case 'string': return 'text-input' @@ -62,35 +62,4 @@ newValues[formSchema.variable] = formSchema.default }) return newValues -} - -export const generateFormValue = (value: Record<string, any>, formSchemas: { variable: string; default?: any }[], isReasoning = false) => { - const newValues = {} as any - formSchemas.forEach((formSchema) => { - const itemValue = value[formSchema.variable] - if ((formSchema.default !== undefined) && (value === undefined || itemValue === null || itemValue === '' || itemValue === undefined)) { - newValues[formSchema.variable] = { - ...(isReasoning ? { value: null, auto: 1 } : { value: formSchema.default }), - } - } - }) - return newValues -} - -export const getPlainValue = (value: Record<string, any>) => { - const plainValue = { ...value } - Object.keys(plainValue).forEach((key) => { - plainValue[key] = value[key].value - }) - return plainValue -} - -export const getStructureValue = (value: Record<string, any>) => { - const newValue = { ...value } as any - Object.keys(newValue).forEach((key) => { - newValue[key] = { - value: value[key], - } - }) - return newValue } -- Gitblit v1.8.0