@shenghuabi/workflow 1.1.7 → 1.1.9

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.d.ts CHANGED
@@ -13,3 +13,4 @@ export * from './plugin/plugin.service';
13
13
  export * from './type/type';
14
14
  export * from './workflow-file.service';
15
15
  export * from './util/serialize-text-template';
16
+ export * from './util/useChat';
package/index.js CHANGED
@@ -68,7 +68,8 @@ __export(workflow_exports, {
68
68
  createResultData: () => createResultData,
69
69
  flatFilterHandleList: () => flatFilterHandleList,
70
70
  llmModelConfig: () => llmModelConfig,
71
- serializeLexicalTextarea: () => serializeLexicalTextarea
71
+ serializeLexicalTextarea: () => serializeLexicalTextarea,
72
+ useChat: () => useChat
72
73
  });
73
74
  module.exports = __toCommonJS(workflow_exports);
74
75
 
@@ -703,7 +704,7 @@ var TemplateFormatService = class extends import_static_injector4.RootStaticInje
703
704
  // packages/workflow/inline/node/chat/main/runner.ts
704
705
  var import_util3 = require("@cyia/util");
705
706
 
706
- // packages/workflow/inline/node/chat/util/useChat.ts
707
+ // packages/workflow/util/useChat.ts
707
708
  var import_static_injector5 = require("static-injector");
708
709
 
709
710
  // packages/workflow/util/serialize-text-template.ts
@@ -726,7 +727,7 @@ function serializeLexicalTextarea(input, options) {
726
727
  }).trim();
727
728
  }
728
729
 
729
- // packages/workflow/inline/node/chat/util/useChat.ts
730
+ // packages/workflow/util/useChat.ts
730
731
  function useChat() {
731
732
  const contextProvider = (0, import_static_injector5.inject)(NodeContextToken);
732
733
  const environmentContext = (0, import_static_injector5.inject)(EnviromentParametersToken);
@@ -848,10 +849,11 @@ var LlmRunner = class extends NodeRunnerBase {
848
849
  streamData.extra.historyList = historyList;
849
850
  this.emitter.send(streamData);
850
851
  return async (id) => {
851
- if (id === RUNNER_ORIGIN_OUTPUT[0].id) {
852
+ if (id === void 0 || id === RUNNER_ORIGIN_OUTPUT[0].id) {
852
853
  return streamData.value;
853
- }
854
- if (id === "format") {
854
+ } else if (id === "historyList") {
855
+ return historyList;
856
+ } else if (id === "format") {
855
857
  let value;
856
858
  switch (config.parseBy) {
857
859
  case "markdown":
@@ -1316,15 +1318,13 @@ var IterationMainConfig = {
1316
1318
 
1317
1319
  // packages/workflow/inline/node/input-params/common.ts
1318
1320
  var NODE_COMMON4 = {
1319
- priority: -100,
1321
+ priority: -999,
1320
1322
  type: "input-params",
1321
- label: `入口`,
1322
- icon: { fontIcon: "chat" },
1323
- disableHead: false,
1324
- disableConnect: false,
1325
- color: "accent",
1326
- help: [`- 入口`].join("\n"),
1327
- outputs: [RUNNER_ORIGIN_OUTPUT]
1323
+ label: `外界输入`,
1324
+ icon: { fontIcon: "input" },
1325
+ disableHead: true,
1326
+ disableConnect: true,
1327
+ color: "primary"
1328
1328
  };
1329
1329
 
1330
1330
  // packages/workflow/inline/node/input-params/node.define.ts
@@ -1350,6 +1350,18 @@ var InputParams_NODE_DEFINE = v10.pipe(
1350
1350
  });
1351
1351
  }),
1352
1352
  v10.title("输入类型")
1353
+ ),
1354
+ editorInput: v10.pipe(
1355
+ v10.optional(v10.boolean()),
1356
+ v10.title("编辑器输入"),
1357
+ (0, import_view_angular_core8.valueChange)((fn) => {
1358
+ fn().subscribe(({ list: [value], field }) => {
1359
+ if (value === void 0) {
1360
+ return;
1361
+ }
1362
+ field.context["editorInputChange"](value);
1363
+ });
1364
+ })
1353
1365
  )
1354
1366
  }),
1355
1367
  import_view_angular_core8.actions.wrappers.patch(["div"]),
@@ -1661,11 +1673,6 @@ var ContextBuildService = class {
1661
1673
  template = (0, import_static_injector12.inject)(TemplateFormatService);
1662
1674
  parser = (0, import_static_injector12.inject)(WorkflowParserService);
1663
1675
  createWorkflow(input) {
1664
- const result = this.template.parse(
1665
- input.template.flatMap(
1666
- (item) => item.content.map((item2) => item2.type === "text" ? item2.text : "")
1667
- ).join("\n")
1668
- ).list.map((item) => item.value);
1669
1676
  const chatNode = {
1670
1677
  id: "2",
1671
1678
  data: {
@@ -1681,13 +1688,13 @@ var ContextBuildService = class {
1681
1688
  ]
1682
1689
  ]
1683
1690
  },
1684
- value: input.template,
1685
- config: {}
1691
+ config: { value: { value: input.template } }
1686
1692
  },
1687
1693
  type: "chat"
1688
1694
  };
1689
1695
  return {
1690
- nodes: [chatNode]
1696
+ nodes: [chatNode],
1697
+ edges: []
1691
1698
  };
1692
1699
  }
1693
1700
  };
@@ -1699,18 +1706,10 @@ var WorkflowExecService = class {
1699
1706
  parse(data) {
1700
1707
  return this.#parser.parse(data);
1701
1708
  }
1702
- async runParse(define, input, ob, abortSignal) {
1703
- return this.#runner.run(
1704
- define,
1705
- {
1706
- inputs: input.input ?? {},
1707
- environmentParameters: input.environmentParameters
1708
- },
1709
- ob,
1710
- abortSignal
1711
- );
1709
+ async runParse(...args) {
1710
+ return this.#runner.run(...args);
1712
1711
  }
1713
- async exec(data, input, options, ob, abortSignal) {
1712
+ async exec(data, input, options, ob, abortSignal, providers) {
1714
1713
  let define;
1715
1714
  if (data.define) {
1716
1715
  define = data.define;
@@ -1722,7 +1721,7 @@ var WorkflowExecService = class {
1722
1721
  define = res.data;
1723
1722
  }
1724
1723
  try {
1725
- return await this.runParse(define, input, ob, abortSignal);
1724
+ return await this.runParse(define, input, ob, abortSignal, providers);
1726
1725
  } catch (error) {
1727
1726
  if (options.showError) {
1728
1727
  }
@@ -1730,7 +1729,7 @@ var WorkflowExecService = class {
1730
1729
  }
1731
1730
  }
1732
1731
  #contextBuild = (0, import_static_injector13.inject)(ContextBuildService);
1733
- async agentChat(input, fn, abort) {
1732
+ async agentChat(input, fn, abort, providers) {
1734
1733
  const workflow = this.#contextBuild.createWorkflow(input);
1735
1734
  const subject = new import_rxjs3.Subject();
1736
1735
  subject.subscribe({
@@ -1741,12 +1740,13 @@ var WorkflowExecService = class {
1741
1740
  const result2 = await this.exec(
1742
1741
  { flow: workflow },
1743
1742
  {
1744
- input: input.input,
1743
+ // inputs: input.inputs,
1745
1744
  environmentParameters: input.environmentParameters
1746
1745
  },
1747
1746
  { showError: true },
1748
1747
  subject,
1749
- abort
1748
+ abort,
1749
+ providers
1750
1750
  );
1751
1751
  return result2;
1752
1752
  }
@@ -1886,6 +1886,7 @@ var WORKFLOW_MODULE = {
1886
1886
  createResultData,
1887
1887
  flatFilterHandleList,
1888
1888
  llmModelConfig,
1889
- serializeLexicalTextarea
1889
+ serializeLexicalTextarea,
1890
+ useChat
1890
1891
  });
1891
1892
  //# sourceMappingURL=index.js.map