@our-llm/shared 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/workflow-events.ts +8 -1
- package/workflow.types.ts +8 -0
package/package.json
CHANGED
package/workflow-events.ts
CHANGED
|
@@ -45,6 +45,11 @@ export interface SimpleMessage {
|
|
|
45
45
|
documents?: Array<{ filename: string; url: string }>
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
export interface LoadingData {
|
|
49
|
+
n: string // nodeId
|
|
50
|
+
m: string // loading message
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
// Token 流式事件的 data
|
|
49
54
|
export interface TokenData {
|
|
50
55
|
n: string // nodeId
|
|
@@ -62,7 +67,7 @@ export interface ErrorData {
|
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
// SSE 事件类型
|
|
65
|
-
export type SSEEventType = 'ws' | 'ns' | 'ne' | 'tk' | 'ok' | 'err'
|
|
70
|
+
export type SSEEventType = 'ws' | 'ns' | 'ne' | 'tk' | 'ok' | 'err' | 'l'
|
|
66
71
|
|
|
67
72
|
// 事件类型映射(后端使用)
|
|
68
73
|
export const EventTypeMap = {
|
|
@@ -72,6 +77,7 @@ export const EventTypeMap = {
|
|
|
72
77
|
token: 'tk',
|
|
73
78
|
complete: 'ok',
|
|
74
79
|
error: 'err',
|
|
80
|
+
loading: 'l',
|
|
75
81
|
} as const
|
|
76
82
|
|
|
77
83
|
// 反向映射(前端使用)
|
|
@@ -82,4 +88,5 @@ export const EventTypeReverse = {
|
|
|
82
88
|
tk: 'token',
|
|
83
89
|
ok: 'complete',
|
|
84
90
|
err: 'error',
|
|
91
|
+
l: 'loading',
|
|
85
92
|
} as const
|
package/workflow.types.ts
CHANGED
|
@@ -24,6 +24,7 @@ export const NodeType = {
|
|
|
24
24
|
IMAGE_TO_VIDEO: 'image_to_video',
|
|
25
25
|
MESSAGE: 'message',
|
|
26
26
|
BILLING: 'billing',
|
|
27
|
+
LOADING: 'loading',
|
|
27
28
|
} as const
|
|
28
29
|
|
|
29
30
|
export type NodeType = (typeof NodeType)[keyof typeof NodeType]
|
|
@@ -123,6 +124,12 @@ export interface BillingNodeConfig extends NodeConfig {
|
|
|
123
124
|
script: string // JS 代码片段,接收 context 参数,返回 { tokenCount: number, artifactCount: number }
|
|
124
125
|
}
|
|
125
126
|
|
|
127
|
+
// Loading 节点配置
|
|
128
|
+
export interface LoadingNodeConfig extends NodeConfig {
|
|
129
|
+
type: typeof NodeType.LOADING
|
|
130
|
+
message: string // loading 提示语
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
// 联合类型:所有节点配置
|
|
127
134
|
export type AnyNodeConfig =
|
|
128
135
|
| StartNodeConfig
|
|
@@ -136,6 +143,7 @@ export type AnyNodeConfig =
|
|
|
136
143
|
| ImageToVideoNodeConfig
|
|
137
144
|
| MessageNodeConfig
|
|
138
145
|
| BillingNodeConfig
|
|
146
|
+
| LoadingNodeConfig
|
|
139
147
|
|
|
140
148
|
// 工作流边配置
|
|
141
149
|
export interface WorkflowEdge {
|