@workglow/ai 0.0.93 → 0.0.95

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