add vector stores

This commit is contained in:
Henry
2023-04-20 10:11:55 +01:00
parent 27e026d943
commit 503386c074
14 changed files with 289 additions and 20 deletions
@@ -0,0 +1,28 @@
import { useState } from 'react'
import PropTypes from 'prop-types'
import { FormControl, Switch } from '@mui/material'
export const SwitchInput = ({ value, onChange, disabled = false }) => {
const [myValue, setMyValue] = useState(!!value ?? false)
return (
<>
<FormControl sx={{ mt: 1, width: '100%' }} size='small'>
<Switch
disabled={disabled}
checked={myValue}
onChange={(event) => {
setMyValue(event.target.checked)
onChange(event.target.checked)
}}
/>
</FormControl>
</>
)
}
SwitchInput.propTypes = {
value: PropTypes.string,
onChange: PropTypes.func,
disabled: PropTypes.bool
}
@@ -12,6 +12,7 @@ import { IconArrowsMaximize } from '@tabler/icons'
import { Dropdown } from 'ui-component/dropdown/Dropdown'
import { Input } from 'ui-component/input/Input'
import { File } from 'ui-component/file/File'
import { SwitchInput } from 'ui-component/switch/Switch'
import { flowContext } from 'store/context/ReactFlowContext'
import { isValidConnection, getAvailableNodesForVariable } from 'utils/genericHelper'
@@ -146,6 +147,13 @@ const NodeInputHandler = ({ inputAnchor, inputParam, data, disabled = false }) =
value={data.inputs[inputParam.name] ?? inputParam.default ?? 'Choose a file to upload'}
/>
)}
{inputParam.type === 'boolean' && (
<SwitchInput
disabled={disabled}
onChange={(newValue) => (data.inputs[inputParam.name] = newValue)}
value={data.inputs[inputParam.name] ?? inputParam.default ?? false}
/>
)}
{(inputParam.type === 'string' || inputParam.type === 'password' || inputParam.type === 'number') && (
<Input
disabled={disabled}