Skip to content

Commit b2ce4fa

Browse files
committed
add fix for override files in upsert vector
1 parent 8d84632 commit b2ce4fa

File tree

3 files changed

+98
-9
lines changed

3 files changed

+98
-9
lines changed

packages/server/src/utils/upsertVector.ts

+19-6
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,29 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
161161
const availableVariables = await appServer.AppDataSource.getRepository(Variable).find()
162162
const { nodeOverrides, variableOverrides, apiOverrideStatus } = getAPIOverrideConfig(chatflow)
163163

164-
// For "files" input, add a new node override with the actual input name such as pdfFile, txtFile, etc.
164+
// For "files" input, add a new node override with the actual input name such as pdfFile, txtFile, etc, to allow overriding the input
165165
for (const nodeLabel in nodeOverrides) {
166166
const params = nodeOverrides[nodeLabel]
167167
const enabledFileParam = params.find((param) => param.enabled && param.name === 'files')
168168
if (enabledFileParam) {
169-
const fileInputFieldFromExt = mapExtToInputField(enabledFileParam.type)
170-
nodeOverrides[nodeLabel].push({
171-
...enabledFileParam,
172-
name: fileInputFieldFromExt
173-
})
169+
if (enabledFileParam.type.includes(',')) {
170+
const fileInputFieldsFromExt = enabledFileParam.type.split(',').map((fileType) => mapExtToInputField(fileType.trim()))
171+
for (const fileInputFieldFromExt of fileInputFieldsFromExt) {
172+
if (nodeOverrides[nodeLabel].some((param) => param.name === fileInputFieldFromExt)) {
173+
continue
174+
}
175+
nodeOverrides[nodeLabel].push({
176+
...enabledFileParam,
177+
name: fileInputFieldFromExt
178+
})
179+
}
180+
} else {
181+
const fileInputFieldFromExt = mapExtToInputField(enabledFileParam.type)
182+
nodeOverrides[nodeLabel].push({
183+
...enabledFileParam,
184+
name: fileInputFieldFromExt
185+
})
186+
}
174187
}
175188
}
176189

packages/ui/src/views/chatflows/APICodeDialog.jsx

+37-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import cURLSVG from '@/assets/images/cURL.svg'
3838
import EmbedSVG from '@/assets/images/embed.svg'
3939
import ShareChatbotSVG from '@/assets/images/sharing.png'
4040
import settingsSVG from '@/assets/images/settings.svg'
41-
import { IconBulb, IconBox, IconVariable } from '@tabler/icons-react'
41+
import { IconBulb, IconBox, IconVariable, IconExclamationCircle } from '@tabler/icons-react'
4242

4343
// API
4444
import apiKeyApi from '@/api/apikey'
@@ -726,9 +726,44 @@ formData.append("openAIApiKey[openAIEmbeddings_0]", "sk-my-openai-2nd-key")`
726726
<CheckboxInput label='Show Override Config' value={checkboxVal} onChange={onCheckBoxChanged} />
727727
{checkboxVal && getConfigApi.data && getConfigApi.data.length > 0 && (
728728
<>
729-
<Typography sx={{ mt: 2, mb: 3 }}>
729+
<Typography sx={{ mt: 2 }}>
730730
You can override existing input configuration of the chatflow with overrideConfig property.
731731
</Typography>
732+
<div
733+
style={{
734+
display: 'flex',
735+
flexDirection: 'column',
736+
borderRadius: 10,
737+
background: 'rgb(254,252,191)',
738+
padding: 10,
739+
marginTop: 10,
740+
marginBottom: 10
741+
}}
742+
>
743+
<div
744+
style={{
745+
display: 'flex',
746+
flexDirection: 'row',
747+
alignItems: 'center'
748+
}}
749+
>
750+
<IconExclamationCircle size={30} color='rgb(116,66,16)' />
751+
<span style={{ color: 'rgb(116,66,16)', marginLeft: 10, fontWeight: 500 }}>
752+
{
753+
'For security reason, override config is disabled by default. You can change this by going into Chatflow Configuration -> Security tab, and enable the property you want to override.'
754+
}
755+
&nbsp;Refer{' '}
756+
<a
757+
rel='noreferrer'
758+
target='_blank'
759+
href='https://docs.flowiseai.com/using-flowise/api#override-config'
760+
>
761+
here
762+
</a>{' '}
763+
for more details
764+
</span>
765+
</div>
766+
</div>
732767
<Stack direction='column' spacing={2} sx={{ width: '100%', my: 2 }}>
733768
<Card sx={{ borderColor: theme.palette.primary[200] + 75, p: 2 }} variant='outlined'>
734769
<Stack sx={{ mt: 1, mb: 2, ml: 1, alignItems: 'center' }} direction='row' spacing={2}>

packages/ui/src/views/vectorstore/VectorStoreDialog.jsx

+42-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { CheckboxInput } from '@/ui-component/checkbox/Checkbox'
2323
import { BackdropLoader } from '@/ui-component/loading/BackdropLoader'
2424
import { TableViewOnly } from '@/ui-component/table/Table'
2525

26-
import { IconX, IconBulb } from '@tabler/icons-react'
26+
import { IconX, IconBulb, IconExclamationCircle } from '@tabler/icons-react'
2727
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
2828
import pythonSVG from '@/assets/images/python.svg'
2929
import javascriptSVG from '@/assets/images/javascript.svg'
@@ -545,6 +545,47 @@ formData.append("openAIApiKey[openAIEmbeddings_0]", "sk-my-openai-2nd-key")`
545545
showLineNumbers={false}
546546
wrapLines
547547
/>
548+
<div
549+
style={{
550+
display: 'flex',
551+
flexDirection: 'column',
552+
borderRadius: 10,
553+
background: 'rgb(254,252,191)',
554+
padding: 10,
555+
marginTop: 20,
556+
marginBottom: 20
557+
}}
558+
>
559+
<div
560+
style={{
561+
display: 'flex',
562+
flexDirection: 'row',
563+
alignItems: 'center'
564+
}}
565+
>
566+
<IconExclamationCircle size={30} color='rgb(116,66,16)' />
567+
<span
568+
style={{
569+
color: 'rgb(116,66,16)',
570+
marginLeft: 10,
571+
fontWeight: 500
572+
}}
573+
>
574+
{
575+
'For security reason, override config is disabled by default. You can change this by going into Chatflow Configuration -> Security tab, and enable the property you want to override.'
576+
}
577+
&nbsp;Refer{' '}
578+
<a
579+
rel='noreferrer'
580+
target='_blank'
581+
href='https://docs.flowiseai.com/using-flowise/api#override-config'
582+
>
583+
here
584+
</a>{' '}
585+
for more details
586+
</span>
587+
</div>
588+
</div>
548589
<div
549590
style={{
550591
display: 'flex',

0 commit comments

Comments
 (0)