mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
store
This commit is contained in:
@ -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
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user