fix: chatflow run progress problem (#4298)

This commit is contained in:
Joel 2024-05-11 16:23:31 +08:00 committed by GitHub
parent 20a9037d5b
commit c01c95d77f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -468,7 +468,10 @@ export const useChat = (
}))
},
onNodeStarted: ({ data }) => {
responseItem.workflowProcess!.tracing!.push(data as any)
responseItem.workflowProcess!.tracing!.push({
...data,
status: WorkflowRunningStatus.Running,
} as any)
handleUpdateChatList(produce(chatListRef.current, (draft) => {
const currentIndex = draft.findIndex(item => item.id === responseItem.id)
draft[currentIndex] = {

View File

@ -7,7 +7,7 @@ import {
import { useTranslation } from 'react-i18next'
import { produce, setAutoFreeze } from 'immer'
import { useWorkflowRun } from '../../hooks'
import { WorkflowRunningStatus } from '../../types'
import { NodeRunningStatus, WorkflowRunningStatus } from '../../types'
import type {
ChatItem,
Inputs,
@ -173,7 +173,7 @@ export const useChat = (
// answer
const responseItem: ChatItem = {
id: `${Date.now()}`,
id: placeholderAnswerId,
content: '',
agent_thoughts: [],
message_files: [],
@ -298,7 +298,10 @@ export const useChat = (
}))
},
onNodeStarted: ({ data }) => {
responseItem.workflowProcess!.tracing!.push(data as any)
responseItem.workflowProcess!.tracing!.push({
...data,
status: NodeRunningStatus.Running,
} as any)
handleUpdateChatList(produce(chatListRef.current, (draft) => {
const currentIndex = draft.findIndex(item => item.id === responseItem.id)
draft[currentIndex] = {