fix type of workflow process

This commit is contained in:
JzoNg 2024-03-21 09:24:09 +08:00
parent 40775e27ce
commit 8dc8650ecb
4 changed files with 8 additions and 9 deletions

View File

@ -27,14 +27,10 @@ import WorkflowProcessItem from '@/app/components/base/chat/chat/answer/workflow
import type { WorkflowProcess } from '@/app/components/base/chat/types'
const MAX_DEPTH = 3
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export interface WorkflowProcessData extends WorkflowProcess {
expand: boolean
}
export type IGenerationItemProps = {
isWorkflow?: boolean
workflowProcessData?: WorkflowProcessData
workflowProcessData?: WorkflowProcess
className?: string
isError: boolean
onRetry: () => void

View File

@ -53,6 +53,7 @@ export type ChatConfig = Omit<ModelConfig, 'model'> & {
export type WorkflowProcess = {
status: WorkflowRunningStatus
tracing: NodeTracing[]
expand?: boolean // for UI
}
export type ChatItem = IChatItem & {

View File

@ -5,7 +5,7 @@ import { useBoolean } from 'ahooks'
import { t } from 'i18next'
import produce from 'immer'
import cn from 'classnames'
import TextGenerationRes, { type WorkflowProcessData } from '@/app/components/app/text-generate/item'
import TextGenerationRes from '@/app/components/app/text-generate/item'
import NoData from '@/app/components/share/text-generation/no-data'
import Toast from '@/app/components/base/toast'
import { sendCompletionMessage, sendWorkflowMessage, updateFeedback } from '@/service/share'
@ -16,6 +16,7 @@ import type { InstalledApp } from '@/models/explore'
import type { ModerationService } from '@/models/common'
import { TransferMethod, type VisionFile, type VisionSettings } from '@/types/app'
import { BlockEnum, NodeRunningStatus, WorkflowRunningStatus } from '@/app/components/workflow/types'
import type { WorkflowProcess } from '@/app/components/base/chat/types'
export type IResultProps = {
isWorkflow: boolean
@ -77,9 +78,9 @@ const Result: FC<IResultProps> = ({
doSetCompletionRes(res)
}
const getCompletionRes = () => completionResRef.current
const [workflowProcessData, doSetWorkflowProccessData] = useState<WorkflowProcessData>()
const workflowProcessDataRef = useRef<WorkflowProcessData>()
const setWorkflowProccessData = (data: WorkflowProcessData) => {
const [workflowProcessData, doSetWorkflowProccessData] = useState<WorkflowProcess>()
const workflowProcessDataRef = useRef<WorkflowProcess>()
const setWorkflowProccessData = (data: WorkflowProcess) => {
workflowProcessDataRef.current = data
doSetWorkflowProccessData(data)
}

View File

@ -30,6 +30,7 @@ export type NodeTracing = {
email: string
}
finished_at: number
expand?: boolean // for UI
}
export type FetchWorkflowDraftResponse = {