support workflow events

This commit is contained in:
JzoNg
2024-04-23 17:09:12 +08:00
parent 2bd93dcbaa
commit c73753138d
119 changed files with 40066 additions and 24 deletions

View File

@ -85,6 +85,12 @@ export type IChatItem = {
message_files?: VisionFile[]
}
export type ChatItem = IChatItem & {
isError?: boolean
workflow_run_id?: string
workflowProcess?: WorkflowProcess
}
export type ResponseHolder = {}
export type ConversationItem = {
@ -140,3 +146,75 @@ export type VisionFile = {
upload_file_id: string
belongs_to?: string
}
export enum BlockEnum {
Start = 'start',
End = 'end',
Answer = 'answer',
LLM = 'llm',
KnowledgeRetrieval = 'knowledge-retrieval',
QuestionClassifier = 'question-classifier',
IfElse = 'if-else',
Code = 'code',
TemplateTransform = 'template-transform',
HttpRequest = 'http-request',
VariableAssigner = 'variable-assigner',
Tool = 'tool',
}
export type NodeTracing = {
id: string
index: number
predecessor_node_id: string
node_id: string
node_type: BlockEnum
title: string
inputs: any
process_data: any
outputs?: any
status: string
error?: string
elapsed_time: number
execution_metadata: {
total_tokens: number
total_price: number
currency: string
}
created_at: number
created_by: {
id: string
name: string
email: string
}
finished_at: number
extras?: any
expand?: boolean // for UI
}
export enum NodeRunningStatus {
NotStart = 'not-start',
Waiting = 'waiting',
Running = 'running',
Succeeded = 'succeeded',
Failed = 'failed',
}
export enum WorkflowRunningStatus {
Waiting = 'waiting',
Running = 'running',
Succeeded = 'succeeded',
Failed = 'failed',
Stopped = 'stopped',
}
export type WorkflowProcess = {
status: WorkflowRunningStatus
tracing: NodeTracing[]
expand?: boolean // for UI
}
export enum CodeLanguage {
python3 = 'python3',
javascript = 'javascript',
json = 'json',
}