This commit is contained in:
StyleZhang
2024-03-15 16:58:29 +08:00
parent 75b332695b
commit e98456b025
16 changed files with 209 additions and 176 deletions

View File

@ -3,7 +3,7 @@ import {
useCallback,
useMemo,
} from 'react'
import { useStore } from '../../store'
import { useWorkflowStore } from '../../store'
import UserInput from './user-input'
import { useChat } from './hooks'
import Chat from '@/app/components/base/chat/chat'
@ -19,6 +19,7 @@ const ChatWrapper = () => {
suggestedQuestions,
handleSend,
} = useChat()
const workflowStore = useWorkflowStore()
const featuresStore = useFeaturesStore()
const features = featuresStore!.getState().features
@ -38,10 +39,10 @@ const ChatWrapper = () => {
handleSend({
query,
files,
inputs: useStore.getState().inputs,
inputs: workflowStore.getState().inputs,
conversationId,
})
}, [conversationId, handleSend])
}, [conversationId, handleSend, workflowStore])
return (
<Chat

View File

@ -6,12 +6,16 @@ import { useTranslation } from 'react-i18next'
import { useNodes } from 'reactflow'
import FormItem from '../../nodes/_base/components/before-run-form/form-item'
import { BlockEnum } from '../../types'
import { useStore } from '../../store'
import {
useStore,
useWorkflowStore,
} from '../../store'
import type { StartNodeType } from '../../nodes/start/types'
import { ChevronDown } from '@/app/components/base/icons/src/vender/line/arrows'
const UserInput = () => {
const { t } = useTranslation()
const workflowStore = useWorkflowStore()
const [expanded, setExpanded] = useState(true)
const inputs = useStore(s => s.inputs)
const nodes = useNodes<StartNodeType>()
@ -19,7 +23,7 @@ const UserInput = () => {
const variables = startNode?.data.variables || []
const handleValueChange = (variable: string, v: string) => {
useStore.getState().setInputs({
workflowStore.getState().setInputs({
...inputs,
[variable]: v,
})