@workglow/ai 0.0.92 → 0.0.94

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/dist/node.js CHANGED
@@ -1842,6 +1842,9 @@ Workflow9.prototype.textNamedEntityRecognition = CreateWorkflow9(TextNamedEntity
1842
1842
  import { CreateWorkflow as CreateWorkflow10, Workflow as Workflow10 } from "@workglow/task-graph";
1843
1843
 
1844
1844
  // src/task/base/StreamingAiTask.ts
1845
+ import {
1846
+ getStreamingPorts
1847
+ } from "@workglow/task-graph";
1845
1848
  class StreamingAiTask extends AiTask {
1846
1849
  static type = "StreamingAiTask";
1847
1850
  async* executeStream(input, context) {
@@ -1852,10 +1855,18 @@ class StreamingAiTask extends AiTask {
1852
1855
  jobRunId: this.config.runnerId,
1853
1856
  input: jobInput
1854
1857
  });
1855
- yield* job.executeStream(jobInput, {
1858
+ const ports = getStreamingPorts(this.outputSchema());
1859
+ const defaultPort = ports.length > 0 ? ports[0].port : "text";
1860
+ for await (const event of job.executeStream(jobInput, {
1856
1861
  signal: context.signal,
1857
1862
  updateProgress: context.updateProgress.bind(this)
1858
- });
1863
+ })) {
1864
+ if (event.type === "text-delta") {
1865
+ yield { ...event, port: event.port ?? defaultPort };
1866
+ } else {
1867
+ yield event;
1868
+ }
1869
+ }
1859
1870
  }
1860
1871
  }
1861
1872
 
@@ -5792,4 +5803,4 @@ export {
5792
5803
  AiJob
5793
5804
  };
5794
5805
 
5795
- //# debugId=F363EF2B0833C2C664756E2164756E21
5806
+ //# debugId=BDC88B5889B3E75A64756E2164756E21