@shenghuabi/workflow 1.0.12 → 1.1.1
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 +98 -139
- package/index.js.map +4 -4
- package/index.mjs +84 -130
- package/index.mjs.map +4 -4
- package/inline/node/chat/chat.node.define.d.ts +3 -41
- package/inline/node/chat/main/index.d.ts +3 -41
- 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 +64 -85
- package/webview/index.js.map +3 -3
- package/webview/index.mjs +67 -96
- package/webview/index.mjs.map +3 -3
- package/share/common/handle.define.d.ts +0 -5
package/index.js
CHANGED
|
@@ -41,7 +41,6 @@ __export(workflow_exports, {
|
|
|
41
41
|
DEFAULT_INPUT_KEY: () => DEFAULT_INPUT_KEY,
|
|
42
42
|
EXAMPLES_DEFINE: () => EXAMPLES_DEFINE,
|
|
43
43
|
EnviromentParametersToken: () => EnviromentParametersToken,
|
|
44
|
-
HandleDataDefine: () => HandleDataDefine,
|
|
45
44
|
HelpObj: () => HelpObj,
|
|
46
45
|
INLINE_Template: () => INLINE_Template,
|
|
47
46
|
INLINE_Template2: () => INLINE_Template2,
|
|
@@ -204,7 +203,11 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
204
203
|
),
|
|
205
204
|
import_view_angular_core2.actions.wrappers.set(["tooltip"])
|
|
206
205
|
),
|
|
207
|
-
value: v.pipe(
|
|
206
|
+
value: v.pipe(
|
|
207
|
+
v.string(),
|
|
208
|
+
v.title("问题"),
|
|
209
|
+
import_view_angular_core2.actions.class.top("flex-1")
|
|
210
|
+
)
|
|
208
211
|
}),
|
|
209
212
|
// todo 待修复
|
|
210
213
|
import_view_angular_core2.actions.class.top("flex gap-2 items-center")
|
|
@@ -216,7 +219,11 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
216
219
|
v.description("是否需要格式化"),
|
|
217
220
|
import_view_angular_core2.actions.wrappers.set(["tooltip"])
|
|
218
221
|
),
|
|
219
|
-
value: v.pipe(
|
|
222
|
+
value: v.pipe(
|
|
223
|
+
v.string(),
|
|
224
|
+
v.title("回答"),
|
|
225
|
+
import_view_angular_core2.actions.class.top("flex-1")
|
|
226
|
+
)
|
|
220
227
|
}),
|
|
221
228
|
import_view_angular_core2.actions.class.top("flex gap-2 items-center")
|
|
222
229
|
)
|
|
@@ -227,131 +234,85 @@ var EXAMPLES_DEFINE = v.pipe(
|
|
|
227
234
|
[]
|
|
228
235
|
),
|
|
229
236
|
v.title("用例"),
|
|
230
|
-
v.description("回答问题之前,会参考定义的用例格式进行回复,用于规范回答")
|
|
231
|
-
(0, import_view_angular_core2.condition)({
|
|
232
|
-
environments: ["display"],
|
|
233
|
-
actions: [
|
|
234
|
-
(0, import_view_angular_core2.renderConfig)({
|
|
235
|
-
hidden: true
|
|
236
|
-
})
|
|
237
|
-
]
|
|
238
|
-
})
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
// packages/workflow/share/common/handle.define.ts
|
|
242
|
-
var v2 = __toESM(require("valibot"), 1);
|
|
243
|
-
var import_view_angular_core3 = require("@piying/view-angular-core");
|
|
244
|
-
var import_valibot_visit = require("@piying/valibot-visit");
|
|
245
|
-
var HiddenAction = (0, import_valibot_visit.condition)({
|
|
246
|
-
environments: ["display", "default"],
|
|
247
|
-
actions: [(0, import_view_angular_core3.setComponent)(""), (0, import_view_angular_core3.renderConfig)({ hidden: true })]
|
|
248
|
-
});
|
|
249
|
-
var AnyHiddenList = v2.pipe(
|
|
250
|
-
v2.array(v2.pipe(v2.optional(v2.any()), HiddenAction)),
|
|
251
|
-
(0, import_view_angular_core3.setComponent)(""),
|
|
252
|
-
(0, import_view_angular_core3.renderConfig)({ hidden: true })
|
|
253
|
-
);
|
|
254
|
-
var HandleDataDefine = v2.pipe(
|
|
255
|
-
v2.optional(
|
|
256
|
-
v2.object({
|
|
257
|
-
output: AnyHiddenList,
|
|
258
|
-
input: AnyHiddenList
|
|
259
|
-
})
|
|
260
|
-
),
|
|
261
|
-
HiddenAction
|
|
237
|
+
v.description("回答问题之前,会参考定义的用例格式进行回复,用于规范回答")
|
|
262
238
|
);
|
|
263
239
|
|
|
264
240
|
// packages/workflow/share/common/inline-template.define.ts
|
|
265
|
-
var
|
|
241
|
+
var import_view_angular_core3 = require("@piying/view-angular-core");
|
|
266
242
|
var import_rxjs = require("rxjs");
|
|
267
|
-
var
|
|
268
|
-
var INLINE_Template =
|
|
269
|
-
|
|
270
|
-
enable:
|
|
243
|
+
var v2 = __toESM(require("valibot"), 1);
|
|
244
|
+
var INLINE_Template = v2.pipe(
|
|
245
|
+
v2.object({
|
|
246
|
+
enable: v2.optional(v2.boolean(), true),
|
|
271
247
|
// 经用条件
|
|
272
|
-
value:
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
(0,
|
|
248
|
+
value: v2.pipe(
|
|
249
|
+
v2.optional(v2.string(), "{{NODE.description}}"),
|
|
250
|
+
v2.title("模板"),
|
|
251
|
+
v2.description("允许使用变量:{{NODE.xxx}}(参考节点帮助)"),
|
|
252
|
+
import_view_angular_core3.actions.wrappers.set(["tooltip", "label"]),
|
|
253
|
+
import_view_angular_core3.actions.class.top("flex-1"),
|
|
254
|
+
(0, import_view_angular_core3.disableWhen)({
|
|
279
255
|
listen: (fn) => fn({
|
|
280
256
|
list: [["..", "enable"]]
|
|
281
257
|
}).pipe((0, import_rxjs.map)(({ list }) => !list[0]))
|
|
282
258
|
})
|
|
283
259
|
)
|
|
284
260
|
}),
|
|
285
|
-
|
|
286
|
-
|
|
261
|
+
import_view_angular_core3.actions.wrappers.patch(["div"]),
|
|
262
|
+
import_view_angular_core3.actions.class.top("flex gap-2")
|
|
287
263
|
);
|
|
288
|
-
var INLINE_Template2 =
|
|
289
|
-
|
|
290
|
-
enable:
|
|
264
|
+
var INLINE_Template2 = v2.pipe(
|
|
265
|
+
v2.object({
|
|
266
|
+
enable: v2.optional(v2.boolean(), false),
|
|
291
267
|
// 经用条件
|
|
292
|
-
value:
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
(0,
|
|
268
|
+
value: v2.pipe(
|
|
269
|
+
v2.optional(v2.string()),
|
|
270
|
+
v2.title("模板"),
|
|
271
|
+
v2.description("允许使用变量:{{ENTRY.xxx}}(参考节点帮助)"),
|
|
272
|
+
import_view_angular_core3.actions.wrappers.set(["tooltip", "label"]),
|
|
273
|
+
import_view_angular_core3.actions.class.top("flex-1"),
|
|
274
|
+
(0, import_view_angular_core3.disableWhen)({
|
|
299
275
|
listen: (fn) => fn({
|
|
300
276
|
list: [["..", "enable"]]
|
|
301
277
|
}).pipe((0, import_rxjs.map)(({ list }) => !list[0]))
|
|
302
278
|
})
|
|
303
279
|
)
|
|
304
280
|
}),
|
|
305
|
-
|
|
306
|
-
|
|
281
|
+
import_view_angular_core3.actions.wrappers.patch(["div"]),
|
|
282
|
+
import_view_angular_core3.actions.class.top("flex gap-2 items-center")
|
|
307
283
|
);
|
|
308
284
|
|
|
309
285
|
// packages/workflow/share/common/llm.define.ts
|
|
310
|
-
var
|
|
311
|
-
var
|
|
312
|
-
var v4 = __toESM(require("valibot"), 1);
|
|
286
|
+
var import_view_angular_core4 = require("@piying/view-angular-core");
|
|
287
|
+
var v3 = __toESM(require("valibot"), 1);
|
|
313
288
|
function llmModelConfig(item) {
|
|
314
|
-
return
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
name:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
(0,
|
|
324
|
-
|
|
289
|
+
return v3.pipe(
|
|
290
|
+
v3.intersect([
|
|
291
|
+
v3.pipe(
|
|
292
|
+
v3.intersect([
|
|
293
|
+
v3.pipe(
|
|
294
|
+
v3.object({
|
|
295
|
+
name: v3.pipe(
|
|
296
|
+
v3.optional(v3.string()),
|
|
297
|
+
v3.title("预定义模型配置"),
|
|
298
|
+
(0, import_view_angular_core4.setComponent)("select"),
|
|
299
|
+
import_view_angular_core4.actions.inputs.patchAsync({
|
|
325
300
|
options: (field) => field.context.getModelList()
|
|
326
301
|
})
|
|
327
302
|
),
|
|
328
|
-
model:
|
|
303
|
+
model: v3.pipe(v3.optional(v3.string()), v3.title("模型")),
|
|
329
304
|
// todo 配置变化configuration层被去掉.这里应该更详细支持更多参数
|
|
330
|
-
baseURL:
|
|
305
|
+
baseURL: v3.pipe(v3.optional(v3.string()), v3.title("地址"))
|
|
331
306
|
}),
|
|
332
307
|
asColumn()
|
|
333
308
|
)
|
|
334
309
|
]),
|
|
335
|
-
|
|
336
|
-
(0,
|
|
337
|
-
environments: ["display", "config"],
|
|
338
|
-
actions: [(0, import_view_angular_core5.asVirtualGroup)()]
|
|
339
|
-
})
|
|
310
|
+
v3.title(item?.label ?? "对话模型"),
|
|
311
|
+
(0, import_view_angular_core4.asVirtualGroup)()
|
|
340
312
|
)
|
|
341
313
|
]),
|
|
342
|
-
(0,
|
|
343
|
-
|
|
344
|
-
actions: [(0, import_view_angular_core5.asVirtualGroup)()]
|
|
345
|
-
}),
|
|
346
|
-
(0, import_valibot_visit2.condition)({
|
|
347
|
-
environments: ["display"],
|
|
348
|
-
actions: [
|
|
349
|
-
(0, import_view_angular_core5.renderConfig)({
|
|
350
|
-
hidden: true
|
|
351
|
-
})
|
|
352
|
-
]
|
|
353
|
-
}),
|
|
354
|
-
(0, import_view_angular_core5.setComponent)("accordion")
|
|
314
|
+
(0, import_view_angular_core4.asVirtualGroup)(),
|
|
315
|
+
(0, import_view_angular_core4.setComponent)("accordion")
|
|
355
316
|
);
|
|
356
317
|
}
|
|
357
318
|
|
|
@@ -460,7 +421,7 @@ var NODE_COMMON = {
|
|
|
460
421
|
|
|
461
422
|
// packages/workflow/inline/node/chat/chat.node.define.ts
|
|
462
423
|
var v7 = __toESM(require("valibot"), 1);
|
|
463
|
-
var
|
|
424
|
+
var import_view_angular_core5 = require("@piying/view-angular-core");
|
|
464
425
|
var ResponseList = ["json", "markdown", "yaml"];
|
|
465
426
|
var ResponseFormat = ["text", "json_object", "json_schema"];
|
|
466
427
|
var CHAT_NODE_DEFINE = v7.looseObject({
|
|
@@ -471,7 +432,7 @@ var CHAT_NODE_DEFINE = v7.looseObject({
|
|
|
471
432
|
/** 处理时解析 */
|
|
472
433
|
responseFormat: v7.pipe(
|
|
473
434
|
v7.optional(v7.picklist(ResponseFormat)),
|
|
474
|
-
|
|
435
|
+
import_view_angular_core5.actions.inputs.patch({
|
|
475
436
|
options: [
|
|
476
437
|
// 有输入json时
|
|
477
438
|
{
|
|
@@ -497,7 +458,7 @@ var CHAT_NODE_DEFINE = v7.looseObject({
|
|
|
497
458
|
/** 处理后解析 */
|
|
498
459
|
parseBy: v7.pipe(
|
|
499
460
|
v7.optional(v7.picklist(ResponseList)),
|
|
500
|
-
|
|
461
|
+
import_view_angular_core5.actions.inputs.patch({
|
|
501
462
|
options: [
|
|
502
463
|
{ label: "直接返回", value: void 0 },
|
|
503
464
|
{
|
|
@@ -518,7 +479,7 @@ var CHAT_NODE_DEFINE = v7.looseObject({
|
|
|
518
479
|
]
|
|
519
480
|
}),
|
|
520
481
|
v7.title("返回解析"),
|
|
521
|
-
(0,
|
|
482
|
+
(0, import_view_angular_core5.valueChange)((fn) => {
|
|
522
483
|
fn({ list: [["..", "responseFormat"]] }).subscribe(
|
|
523
484
|
({ list: [value], field }) => {
|
|
524
485
|
if ((value ?? "").startsWith("json")) {
|
|
@@ -532,48 +493,47 @@ var CHAT_NODE_DEFINE = v7.looseObject({
|
|
|
532
493
|
),
|
|
533
494
|
examples: EXAMPLES_DEFINE
|
|
534
495
|
}),
|
|
535
|
-
|
|
536
|
-
|
|
496
|
+
import_view_angular_core5.actions.wrappers.patch(["div"]),
|
|
497
|
+
import_view_angular_core5.actions.class.top("grid auto-rows-auto gap-2")
|
|
537
498
|
),
|
|
538
499
|
value: v7.pipe(
|
|
539
500
|
v7.custom(Boolean),
|
|
540
|
-
(0,
|
|
541
|
-
(
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
})
|
|
501
|
+
(0, import_view_angular_core5.setComponent)("prompt-list")
|
|
502
|
+
// valueChange((fn) => {
|
|
503
|
+
// fn({ list: [undefined] }).subscribe(({ list: [value], field }) => {
|
|
504
|
+
// if (!Array.isArray(value)) {
|
|
505
|
+
// return;
|
|
506
|
+
// }
|
|
507
|
+
// const inputValue: ChatMessageListInputType = value ?? [];
|
|
508
|
+
// // field.context
|
|
509
|
+
// // .parseTemplate(
|
|
510
|
+
// // inputValue.flatMap((item) =>
|
|
511
|
+
// // item.content.map((item) =>
|
|
512
|
+
// // item.type === 'text' ? item.text : '',
|
|
513
|
+
// // ),
|
|
514
|
+
// // ),
|
|
515
|
+
// // )
|
|
516
|
+
// // .then((value: any) => {
|
|
517
|
+
// // if (!value) {
|
|
518
|
+
// // return;
|
|
519
|
+
// // }
|
|
520
|
+
// // field.context.changeHandleData(field, 'input', 1, value);
|
|
521
|
+
// // });
|
|
522
|
+
// // const list = inputValue
|
|
523
|
+
// // .flatMap((item) =>
|
|
524
|
+
// // item.content.map((item) =>
|
|
525
|
+
// // item.type === 'image_url' ? item.image_url.url : undefined,
|
|
526
|
+
// // ),
|
|
527
|
+
// // )
|
|
528
|
+
// // .filter(Boolean)
|
|
529
|
+
// // .map((item) => ({
|
|
530
|
+
// // value: `${item}`,
|
|
531
|
+
// // label: `${item}`,
|
|
532
|
+
// // inputType: `image` as const,
|
|
533
|
+
// // }));
|
|
534
|
+
// // field.context.changeHandleData(field, 'input', 3, list ?? []);
|
|
535
|
+
// });
|
|
536
|
+
// }),
|
|
577
537
|
)
|
|
578
538
|
})
|
|
579
539
|
});
|
|
@@ -2060,7 +2020,6 @@ var WORKFLOW_MODULE = {
|
|
|
2060
2020
|
DEFAULT_INPUT_KEY,
|
|
2061
2021
|
EXAMPLES_DEFINE,
|
|
2062
2022
|
EnviromentParametersToken,
|
|
2063
|
-
HandleDataDefine,
|
|
2064
2023
|
HelpObj,
|
|
2065
2024
|
INLINE_Template,
|
|
2066
2025
|
INLINE_Template2,
|