@shenghuabi/workflow 1.0.11 → 1.1.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/index.js +92 -138
- package/index.js.map +4 -4
- package/index.mjs +78 -129
- package/index.mjs.map +4 -4
- package/inline/node/chat/chat.node.define.d.ts +5 -18
- package/inline/node/chat/main/index.d.ts +5 -18
- package/inline/node/text/text.node.define.d.ts +1 -1
- package/package.json +2 -2
- package/share/common/examples.define.d.ts +1 -10
- package/share/common/index.d.ts +0 -1
- package/share/common/llm.define.d.ts +2 -6
- package/share/index.js +56 -96
- package/share/index.js.map +4 -4
- package/share/index.mjs +47 -91
- package/share/index.mjs.map +4 -4
- package/webview/index.js +56 -83
- package/webview/index.js.map +2 -2
- package/webview/index.mjs +58 -93
- package/webview/index.mjs.map +3 -3
- package/share/common/handle.define.d.ts +0 -5
package/index.mjs
CHANGED
|
@@ -111,11 +111,7 @@ function generateHandle(value, label = value) {
|
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// packages/workflow/share/common/examples.define.ts
|
|
114
|
-
import {
|
|
115
|
-
actions as actions2,
|
|
116
|
-
condition,
|
|
117
|
-
renderConfig
|
|
118
|
-
} from "@piying/view-angular-core";
|
|
114
|
+
import { actions as actions2 } from "@piying/view-angular-core";
|
|
119
115
|
import * as v from "valibot";
|
|
120
116
|
|
|
121
117
|
// packages/workflow/share/util/layout.ts
|
|
@@ -146,7 +142,11 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
146
142
|
),
|
|
147
143
|
actions2.wrappers.set(["tooltip"])
|
|
148
144
|
),
|
|
149
|
-
value: v.pipe(
|
|
145
|
+
value: v.pipe(
|
|
146
|
+
v.string(),
|
|
147
|
+
v.title("问题"),
|
|
148
|
+
actions2.class.top("flex-1")
|
|
149
|
+
)
|
|
150
150
|
}),
|
|
151
151
|
// todo 待修复
|
|
152
152
|
actions2.class.top("flex gap-2 items-center")
|
|
@@ -158,7 +158,11 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
158
158
|
v.description("是否需要格式化"),
|
|
159
159
|
actions2.wrappers.set(["tooltip"])
|
|
160
160
|
),
|
|
161
|
-
value: v.pipe(
|
|
161
|
+
value: v.pipe(
|
|
162
|
+
v.string(),
|
|
163
|
+
v.title("回答"),
|
|
164
|
+
actions2.class.top("flex-1")
|
|
165
|
+
)
|
|
162
166
|
}),
|
|
163
167
|
actions2.class.top("flex gap-2 items-center")
|
|
164
168
|
)
|
|
@@ -169,52 +173,21 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
169
173
|
[]
|
|
170
174
|
),
|
|
171
175
|
v.title("用例"),
|
|
172
|
-
v.description("回答问题之前,会参考定义的用例格式进行回复,用于规范回答")
|
|
173
|
-
condition({
|
|
174
|
-
environments: ["display"],
|
|
175
|
-
actions: [
|
|
176
|
-
renderConfig({
|
|
177
|
-
hidden: true
|
|
178
|
-
})
|
|
179
|
-
]
|
|
180
|
-
})
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
// packages/workflow/share/common/handle.define.ts
|
|
184
|
-
import * as v2 from "valibot";
|
|
185
|
-
import { renderConfig as renderConfig2, setComponent } from "@piying/view-angular-core";
|
|
186
|
-
import { condition as condition2 } from "@piying/valibot-visit";
|
|
187
|
-
var HiddenAction = condition2({
|
|
188
|
-
environments: ["display", "default"],
|
|
189
|
-
actions: [setComponent(""), renderConfig2({ hidden: true })]
|
|
190
|
-
});
|
|
191
|
-
var AnyHiddenList = v2.pipe(
|
|
192
|
-
v2.array(v2.pipe(v2.optional(v2.any()), HiddenAction)),
|
|
193
|
-
setComponent(""),
|
|
194
|
-
renderConfig2({ hidden: true })
|
|
195
|
-
);
|
|
196
|
-
var HandleDataDefine = v2.pipe(
|
|
197
|
-
v2.optional(
|
|
198
|
-
v2.object({
|
|
199
|
-
output: AnyHiddenList,
|
|
200
|
-
input: AnyHiddenList
|
|
201
|
-
})
|
|
202
|
-
),
|
|
203
|
-
HiddenAction
|
|
176
|
+
v.description("回答问题之前,会参考定义的用例格式进行回复,用于规范回答")
|
|
204
177
|
);
|
|
205
178
|
|
|
206
179
|
// packages/workflow/share/common/inline-template.define.ts
|
|
207
180
|
import { actions as actions3, disableWhen } from "@piying/view-angular-core";
|
|
208
181
|
import { map } from "rxjs";
|
|
209
|
-
import * as
|
|
210
|
-
var INLINE_Template =
|
|
211
|
-
|
|
212
|
-
enable:
|
|
182
|
+
import * as v2 from "valibot";
|
|
183
|
+
var INLINE_Template = v2.pipe(
|
|
184
|
+
v2.object({
|
|
185
|
+
enable: v2.optional(v2.boolean(), true),
|
|
213
186
|
// 经用条件
|
|
214
|
-
value:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
187
|
+
value: v2.pipe(
|
|
188
|
+
v2.optional(v2.string(), "{{NODE.description}}"),
|
|
189
|
+
v2.title("模板"),
|
|
190
|
+
v2.description("允许使用变量:{{NODE.xxx}}(参考节点帮助)"),
|
|
218
191
|
actions3.wrappers.set(["tooltip", "label"]),
|
|
219
192
|
actions3.class.top("flex-1"),
|
|
220
193
|
disableWhen({
|
|
@@ -227,14 +200,14 @@ var INLINE_Template = v3.pipe(
|
|
|
227
200
|
actions3.wrappers.patch(["div"]),
|
|
228
201
|
actions3.class.top("flex gap-2")
|
|
229
202
|
);
|
|
230
|
-
var INLINE_Template2 =
|
|
231
|
-
|
|
232
|
-
enable:
|
|
203
|
+
var INLINE_Template2 = v2.pipe(
|
|
204
|
+
v2.object({
|
|
205
|
+
enable: v2.optional(v2.boolean(), false),
|
|
233
206
|
// 经用条件
|
|
234
|
-
value:
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
207
|
+
value: v2.pipe(
|
|
208
|
+
v2.optional(v2.string()),
|
|
209
|
+
v2.title("模板"),
|
|
210
|
+
v2.description("允许使用变量:{{ENTRY.xxx}}(参考节点帮助)"),
|
|
238
211
|
actions3.wrappers.set(["tooltip", "label"]),
|
|
239
212
|
actions3.class.top("flex-1"),
|
|
240
213
|
disableWhen({
|
|
@@ -252,53 +225,37 @@ var INLINE_Template2 = v3.pipe(
|
|
|
252
225
|
import {
|
|
253
226
|
asVirtualGroup,
|
|
254
227
|
actions as actions4,
|
|
255
|
-
setComponent
|
|
256
|
-
renderConfig as renderConfig3
|
|
228
|
+
setComponent
|
|
257
229
|
} from "@piying/view-angular-core";
|
|
258
|
-
import
|
|
259
|
-
import * as v4 from "valibot";
|
|
230
|
+
import * as v3 from "valibot";
|
|
260
231
|
function llmModelConfig(item) {
|
|
261
|
-
return
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
name:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
232
|
+
return v3.pipe(
|
|
233
|
+
v3.intersect([
|
|
234
|
+
v3.pipe(
|
|
235
|
+
v3.intersect([
|
|
236
|
+
v3.pipe(
|
|
237
|
+
v3.object({
|
|
238
|
+
name: v3.pipe(
|
|
239
|
+
v3.optional(v3.string()),
|
|
240
|
+
v3.title("预定义模型配置"),
|
|
241
|
+
setComponent("select"),
|
|
271
242
|
actions4.inputs.patchAsync({
|
|
272
243
|
options: (field) => field.context.getModelList()
|
|
273
244
|
})
|
|
274
245
|
),
|
|
275
|
-
model:
|
|
246
|
+
model: v3.pipe(v3.optional(v3.string()), v3.title("模型")),
|
|
276
247
|
// todo 配置变化configuration层被去掉.这里应该更详细支持更多参数
|
|
277
|
-
baseURL:
|
|
248
|
+
baseURL: v3.pipe(v3.optional(v3.string()), v3.title("地址"))
|
|
278
249
|
}),
|
|
279
250
|
asColumn()
|
|
280
251
|
)
|
|
281
252
|
]),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
environments: ["display", "config"],
|
|
285
|
-
actions: [asVirtualGroup()]
|
|
286
|
-
})
|
|
253
|
+
v3.title(item?.label ?? "对话模型"),
|
|
254
|
+
asVirtualGroup()
|
|
287
255
|
)
|
|
288
256
|
]),
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
actions: [asVirtualGroup()]
|
|
292
|
-
}),
|
|
293
|
-
condition3({
|
|
294
|
-
environments: ["display"],
|
|
295
|
-
actions: [
|
|
296
|
-
renderConfig3({
|
|
297
|
-
hidden: true
|
|
298
|
-
})
|
|
299
|
-
]
|
|
300
|
-
}),
|
|
301
|
-
setComponent2("accordion")
|
|
257
|
+
asVirtualGroup(),
|
|
258
|
+
setComponent("accordion")
|
|
302
259
|
);
|
|
303
260
|
}
|
|
304
261
|
|
|
@@ -307,7 +264,7 @@ var DEFAULT_CHAT_SCHEMA_KEY = `[JsonSchema]`;
|
|
|
307
264
|
var RUNNER_ORIGIN_OUTPUT_KEY = `[Origin]`;
|
|
308
265
|
|
|
309
266
|
// packages/workflow/share/type2.ts
|
|
310
|
-
import { v4
|
|
267
|
+
import { v4 } from "uuid";
|
|
311
268
|
import * as v6 from "valibot";
|
|
312
269
|
var extraData = v6.looseObject({
|
|
313
270
|
references: v6.optional(v6.array(v6.custom(Boolean)))
|
|
@@ -315,7 +272,7 @@ var extraData = v6.looseObject({
|
|
|
315
272
|
var baseDataDefine = v6.object({
|
|
316
273
|
node: v6.object({ type: v6.string(), id: v6.string() }),
|
|
317
274
|
nodeResult: v6.pipe(v6.optional(v6.boolean(), false)),
|
|
318
|
-
dataId: v6.optional(v6.string(), () =>
|
|
275
|
+
dataId: v6.optional(v6.string(), () => v4()),
|
|
319
276
|
extra: v6.optional(extraData)
|
|
320
277
|
});
|
|
321
278
|
var CommonDataDefine = v6.object({
|
|
@@ -409,8 +366,7 @@ var NODE_COMMON = {
|
|
|
409
366
|
import * as v7 from "valibot";
|
|
410
367
|
import {
|
|
411
368
|
actions as actions5,
|
|
412
|
-
|
|
413
|
-
setComponent as setComponent3,
|
|
369
|
+
setComponent as setComponent2,
|
|
414
370
|
valueChange
|
|
415
371
|
} from "@piying/view-angular-core";
|
|
416
372
|
var ResponseList = ["json", "markdown", "yaml"];
|
|
@@ -489,42 +445,36 @@ var CHAT_NODE_DEFINE = v7.looseObject({
|
|
|
489
445
|
),
|
|
490
446
|
value: v7.pipe(
|
|
491
447
|
v7.custom(Boolean),
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
inputType: `image`
|
|
523
|
-
}));
|
|
524
|
-
field.context.changeHandleData(field, "input", 3, list ?? []);
|
|
525
|
-
});
|
|
526
|
-
})
|
|
527
|
-
]
|
|
448
|
+
setComponent2("prompt-list"),
|
|
449
|
+
valueChange((fn) => {
|
|
450
|
+
fn({ list: [void 0] }).subscribe(({ list: [value], field }) => {
|
|
451
|
+
if (!Array.isArray(value)) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
const inputValue = value ?? [];
|
|
455
|
+
field.context.parseTemplate(
|
|
456
|
+
inputValue.flatMap(
|
|
457
|
+
(item) => item.content.map(
|
|
458
|
+
(item2) => item2.type === "text" ? item2.text : ""
|
|
459
|
+
)
|
|
460
|
+
)
|
|
461
|
+
).then((value2) => {
|
|
462
|
+
if (!value2) {
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
field.context.changeHandleData(field, "input", 1, value2);
|
|
466
|
+
});
|
|
467
|
+
const list = inputValue.flatMap(
|
|
468
|
+
(item) => item.content.map(
|
|
469
|
+
(item2) => item2.type === "image_url" ? item2.image_url.url : void 0
|
|
470
|
+
)
|
|
471
|
+
).filter(Boolean).map((item) => ({
|
|
472
|
+
value: `${item}`,
|
|
473
|
+
label: `${item}`,
|
|
474
|
+
inputType: `image`
|
|
475
|
+
}));
|
|
476
|
+
field.context.changeHandleData(field, "input", 3, list ?? []);
|
|
477
|
+
});
|
|
528
478
|
})
|
|
529
479
|
)
|
|
530
480
|
})
|
|
@@ -2011,7 +1961,6 @@ export {
|
|
|
2011
1961
|
DEFAULT_INPUT_KEY,
|
|
2012
1962
|
EXAMPLES_DEFINE,
|
|
2013
1963
|
EnviromentParametersToken,
|
|
2014
|
-
HandleDataDefine,
|
|
2015
1964
|
HelpObj,
|
|
2016
1965
|
INLINE_Template,
|
|
2017
1966
|
INLINE_Template2,
|