Commit 2edef89a authored by Joel's avatar Joel

feat: handle system var

parent cbe7de58
......@@ -39,6 +39,17 @@ const formatItem = (item: any, isChatMode: boolean): NodeOutPutVar => {
type: inputVarTypeToVarType(v.type),
}
})
if (isChatMode) {
res.vars.push({
variable: 'sys.query',
type: VarType.string,
})
res.vars.push({
variable: 'sys.files',
type: VarType.arrayFile,
})
}
break
}
......
......@@ -20,6 +20,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
const { t } = useTranslation()
const readOnly = false
const {
isChatMode,
inputs,
isShowAddVarModal,
showAddVarModal,
......@@ -50,7 +51,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
</Field>
</div>
<Split />
{isChatMode && (
<div className='px-4 pt-4 pb-2'>
<OutputVars title={t(`${i18nPrefix}.builtInVar`)!}>
<>
......@@ -59,7 +60,8 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
type='string'
description={t(`${i18nPrefix}.outputVars.query`)}
/>
<VarItem
{/* Now not support sys.memories */}
{/* <VarItem
name='sys.memories'
type='array[Object]'
description={t(`${i18nPrefix}.outputVars.memories.des`)}
......@@ -75,7 +77,7 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
description: t(`${i18nPrefix}.outputVars.memories.content`),
},
]}
/>
/> */}
<VarItem
name='sys.files'
type='string'
......@@ -84,6 +86,8 @@ const Panel: FC<NodePanelProps<StartNodeType>> = ({
</>
</OutputVars>
</div>
)}
{isShowAddVarModal && (
<ConfigVarModal
isCreate
......
......@@ -4,8 +4,13 @@ import { useBoolean } from 'ahooks'
import type { StartNodeType } from './types'
import type { InputVar } from '@/app/components/workflow/types'
import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud'
import {
useIsChatMode,
} from '@/app/components/workflow/hooks'
const useConfig = (id: string, payload: StartNodeType) => {
const isChatMode = useIsChatMode()
const { inputs, setInputs } = useNodeCrud<StartNodeType>(id, payload)
const [isShowAddVarModal, {
......@@ -27,6 +32,7 @@ const useConfig = (id: string, payload: StartNodeType) => {
setInputs(newInputs)
}, [inputs, setInputs])
return {
isChatMode,
inputs,
isShowAddVarModal,
showAddVarModal,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment