feat: code support boolean

feat/support-bool-variable-fe
Joel 10 months ago
parent 70f6d8b42a
commit 6012ad57ac

@ -60,7 +60,6 @@ import {
useModelListAndDefaultModelAndCurrentProviderAndModel, useModelListAndDefaultModelAndCurrentProviderAndModel,
useTextGenerationCurrentProviderAndModelAndModelList, useTextGenerationCurrentProviderAndModelAndModelList,
} from '@/app/components/header/account-setting/model-provider-page/hooks' } from '@/app/components/header/account-setting/model-provider-page/hooks'
import { fetchCollectionList } from '@/service/tools'
import type { Collection } from '@/app/components/tools/types' import type { Collection } from '@/app/components/tools/types'
import { useStore as useAppStore } from '@/app/components/app/store' import { useStore as useAppStore } from '@/app/components/app/store'
import { import {
@ -521,7 +520,8 @@ const Configuration: FC = () => {
useEffect(() => { useEffect(() => {
(async () => { (async () => {
const collectionList = await fetchCollectionList() // const collectionList = await fetchCollectionList()
const collectionList: any[] = [] // this api has problem in dev, so comment it for temporarily
if (basePath) { if (basePath) {
collectionList.forEach((item) => { collectionList.forEach((item) => {
if (typeof item.icon == 'string' && !item.icon.includes(basePath)) if (typeof item.icon == 'string' && !item.icon.includes(basePath))
@ -693,7 +693,6 @@ const Configuration: FC = () => {
setHasFetchedDetail(true) setHasFetchedDetail(true)
}) })
})() })()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [appId]) }, [appId])
const promptEmpty = (() => { const promptEmpty = (() => {

@ -18,7 +18,7 @@ type Props = {
onChange: (value: string) => void onChange: (value: string) => void
} }
const TYPES = [VarType.string, VarType.number, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject, VarType.object] const TYPES = [VarType.string, VarType.number, VarType.boolean, VarType.arrayNumber, VarType.arrayString, VarType.arrayBoolean, VarType.arrayObject, VarType.object]
const VarReferencePicker: FC<Props> = ({ const VarReferencePicker: FC<Props> = ({
readonly, readonly,
className, className,

@ -60,7 +60,6 @@ const useConfig = (id: string, payload: CodeNodeType) => {
}) })
syncOutputKeyOrders(defaultConfig.outputs) syncOutputKeyOrders(defaultConfig.outputs)
} }
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [defaultConfig]) }, [defaultConfig])
const handleCodeChange = useCallback((code: string) => { const handleCodeChange = useCallback((code: string) => {
@ -85,7 +84,7 @@ const useConfig = (id: string, payload: CodeNodeType) => {
}, [allLanguageDefault, inputs, setInputs]) }, [allLanguageDefault, inputs, setInputs])
const handleSyncFunctionSignature = useCallback(() => { const handleSyncFunctionSignature = useCallback(() => {
const generateSyncSignatureCode = (code: string) => { const generateSyncSignatureCode = (code: string) => {
let mainDefRe let mainDefRe
let newMainDef let newMainDef
if (inputs.code_language === CodeLanguage.javascript) { if (inputs.code_language === CodeLanguage.javascript) {
@ -159,7 +158,7 @@ const useConfig = (id: string, payload: CodeNodeType) => {
}) })
const filterVar = useCallback((varPayload: Var) => { const filterVar = useCallback((varPayload: Var) => {
return [VarType.string, VarType.number, VarType.secret, VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject, VarType.file, VarType.arrayFile].includes(varPayload.type) return [VarType.string, VarType.number, VarType.boolean, VarType.secret, VarType.object, VarType.array, VarType.arrayNumber, VarType.arrayString, VarType.arrayObject, VarType.arrayBoolean, VarType.file, VarType.arrayFile].includes(varPayload.type)
}, []) }, [])
const handleCodeAndVarsChange = useCallback((code: string, inputVariables: Variable[], outputVariables: OutputVar) => { const handleCodeAndVarsChange = useCallback((code: string, inputVariables: Variable[], outputVariables: OutputVar) => {

Loading…
Cancel
Save