fix(web): workflow features
This commit is contained in:
@@ -100,6 +100,7 @@ export const useWorkflowGraph = ({
|
|||||||
const [isHandMode, setIsHandMode] = useState(true);
|
const [isHandMode, setIsHandMode] = useState(true);
|
||||||
const [config, setConfig] = useState<WorkflowConfig | null>(null);
|
const [config, setConfig] = useState<WorkflowConfig | null>(null);
|
||||||
const [chatVariables, setChatVariables] = useState<ChatVariable[]>([])
|
const [chatVariables, setChatVariables] = useState<ChatVariable[]>([])
|
||||||
|
const featuresRef = useRef<FeaturesConfigForm | undefined>(undefined)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getConfig()
|
getConfig()
|
||||||
@@ -121,6 +122,7 @@ export const useWorkflowGraph = ({
|
|||||||
})
|
})
|
||||||
setChatVariables(initChatVariables)
|
setChatVariables(initChatVariables)
|
||||||
setConfig({ ...rest, variables: initChatVariables })
|
setConfig({ ...rest, variables: initChatVariables })
|
||||||
|
featuresRef.current = rest.features
|
||||||
onFeaturesLoad?.(rest.features)
|
onFeaturesLoad?.(rest.features)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -1016,6 +1018,7 @@ export const useWorkflowGraph = ({
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
...config,
|
...config,
|
||||||
|
features: featuresRef.current,
|
||||||
variables: chatVariables.map(v => {
|
variables: chatVariables.map(v => {
|
||||||
const { defaultValue, ...cleanV } = v
|
const { defaultValue, ...cleanV } = v
|
||||||
return {
|
return {
|
||||||
@@ -1208,7 +1211,7 @@ export const useWorkflowGraph = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
const handleSaveFeaturesConfig = (value?: FeaturesConfigForm) => {
|
const handleSaveFeaturesConfig = (value?: FeaturesConfigForm) => {
|
||||||
setConfig(prev => prev ? { ...prev, features: value } as WorkflowConfig : prev)
|
featuresRef.current = value
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user