mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 01:48:04 +08:00
split hooks
This commit is contained in:
@ -17,7 +17,7 @@ export const useChat = (
|
||||
) => {
|
||||
const { t } = useTranslation()
|
||||
const { notify } = useToastContext()
|
||||
const run = useWorkflowRun()
|
||||
const { handleRun } = useWorkflowRun()
|
||||
const hasStopResponded = useRef(false)
|
||||
const connversationId = useRef('')
|
||||
const taskIdRef = useRef('')
|
||||
@ -126,7 +126,7 @@ export const useChat = (
|
||||
|
||||
let hasSetResponseId = false
|
||||
|
||||
run(
|
||||
handleRun(
|
||||
params,
|
||||
{
|
||||
onData: (message: string, isFirstMessage: boolean, { conversationId: newConversationId, messageId, taskId }: any) => {
|
||||
@ -179,7 +179,7 @@ export const useChat = (
|
||||
},
|
||||
},
|
||||
)
|
||||
}, [run, handleResponding, handleUpdateChatList, notify, t, updateCurrentQA])
|
||||
}, [handleRun, handleResponding, handleUpdateChatList, notify, t, updateCurrentQA])
|
||||
|
||||
return {
|
||||
conversationId: connversationId.current,
|
||||
|
||||
@ -7,10 +7,7 @@ import { useNodes } from 'reactflow'
|
||||
import FormItem from '../nodes/_base/components/before-run-form/form-item'
|
||||
import { BlockEnum } from '../types'
|
||||
import { useStore } from '../store'
|
||||
import {
|
||||
useWorkflow,
|
||||
useWorkflowRun,
|
||||
} from '../hooks'
|
||||
import { useWorkflowRun } from '../hooks'
|
||||
import type { StartNodeType } from '../nodes/start/types'
|
||||
import Button from '@/app/components/base/button'
|
||||
|
||||
@ -18,8 +15,10 @@ const InputsPanel = () => {
|
||||
const { t } = useTranslation()
|
||||
const nodes = useNodes<StartNodeType>()
|
||||
const inputs = useStore(s => s.inputs)
|
||||
const run = useWorkflowRun()
|
||||
const { handleRunInit } = useWorkflow()
|
||||
const {
|
||||
handleRun,
|
||||
handleRunSetting,
|
||||
} = useWorkflowRun()
|
||||
const startNode = nodes.find(node => node.data.type === BlockEnum.Start)
|
||||
const variables = startNode?.data.variables || []
|
||||
|
||||
@ -34,10 +33,10 @@ const InputsPanel = () => {
|
||||
useStore.setState({ showInputsPanel: false })
|
||||
}, [])
|
||||
|
||||
const handleRun = () => {
|
||||
const doRun = () => {
|
||||
handleCancel()
|
||||
handleRunInit()
|
||||
run({ inputs })
|
||||
handleRunSetting()
|
||||
handleRun({ inputs })
|
||||
}
|
||||
|
||||
return (
|
||||
@ -72,7 +71,7 @@ const InputsPanel = () => {
|
||||
<Button
|
||||
type='primary'
|
||||
className='py-0 w-[190px] h-8 rounded-lg text-[13px] font-medium'
|
||||
onClick={handleRun}
|
||||
onClick={doRun}
|
||||
>
|
||||
{t('workflow.singleRun.startRun')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user