@shenghuabi/workflow 1.0.12 → 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.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(v.string(), v.title("问题"), actions2.class.top("flex-1"))
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(v.string(), v.title("回答"), actions2.class.top("flex-1"))
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 v3 from "valibot";
210
- var INLINE_Template = v3.pipe(
211
- v3.object({
212
- enable: v3.optional(v3.boolean(), true),
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: v3.pipe(
215
- v3.optional(v3.string(), "{{NODE.description}}"),
216
- v3.title("模板"),
217
- v3.description("允许使用变量:{{NODE.xxx}}(参考节点帮助)"),
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 = v3.pipe(
231
- v3.object({
232
- enable: v3.optional(v3.boolean(), false),
203
+ var INLINE_Template2 = v2.pipe(
204
+ v2.object({
205
+ enable: v2.optional(v2.boolean(), false),
233
206
  // 经用条件
234
- value: v3.pipe(
235
- v3.optional(v3.string()),
236
- v3.title("模板"),
237
- v3.description("允许使用变量:{{ENTRY.xxx}}(参考节点帮助)"),
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 as setComponent2,
256
- renderConfig as renderConfig3
228
+ setComponent
257
229
  } from "@piying/view-angular-core";
258
- import { condition as condition3 } from "@piying/valibot-visit";
259
- import * as v4 from "valibot";
230
+ import * as v3 from "valibot";
260
231
  function llmModelConfig(item) {
261
- return v4.pipe(
262
- v4.intersect([
263
- v4.pipe(
264
- v4.intersect([
265
- v4.pipe(
266
- v4.object({
267
- name: v4.pipe(
268
- v4.optional(v4.string()),
269
- v4.title("预定义模型配置"),
270
- setComponent2("select"),
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: v4.pipe(v4.optional(v4.string()), v4.title("模型")),
246
+ model: v3.pipe(v3.optional(v3.string()), v3.title("模型")),
276
247
  // todo 配置变化configuration层被去掉.这里应该更详细支持更多参数
277
- baseURL: v4.pipe(v4.optional(v4.string()), v4.title("地址"))
248
+ baseURL: v3.pipe(v3.optional(v3.string()), v3.title("地址"))
278
249
  }),
279
250
  asColumn()
280
251
  )
281
252
  ]),
282
- v4.title(item?.label ?? "对话模型"),
283
- condition3({
284
- environments: ["display", "config"],
285
- actions: [asVirtualGroup()]
286
- })
253
+ v3.title(item?.label ?? "对话模型"),
254
+ asVirtualGroup()
287
255
  )
288
256
  ]),
289
- condition3({
290
- environments: ["display", "config"],
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 as v42 } from "uuid";
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(), () => v42()),
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
- condition as condition4,
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
- setComponent3(""),
493
- condition4({
494
- environments: ["display"],
495
- actions: [
496
- setComponent3("prompt-list"),
497
- valueChange((fn) => {
498
- fn({ list: [void 0] }).subscribe(({ list: [value], field }) => {
499
- if (!Array.isArray(value)) {
500
- return;
501
- }
502
- const inputValue = value ?? [];
503
- field.context.parseTemplate(
504
- inputValue.flatMap(
505
- (item) => item.content.map(
506
- (item2) => item2.type === "text" ? item2.text : ""
507
- )
508
- )
509
- ).then((value2) => {
510
- if (!value2) {
511
- return;
512
- }
513
- field.context.changeHandleData(field, "input", 1, value2);
514
- });
515
- const list = inputValue.flatMap(
516
- (item) => item.content.map(
517
- (item2) => item2.type === "image_url" ? item2.image_url.url : void 0
518
- )
519
- ).filter(Boolean).map((item) => ({
520
- value: `${item}`,
521
- label: `${item}`,
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,