MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / streamIterator

Method streamIterator

packages/components/src/agents.ts:130–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

128 }
129
130 async *streamIterator() {
131 this.reset()
132
133 // Loop to handle iteration
134 while (true) {
135 try {
136 if (this.iterations === 0) {
137 await this.onFirstStep()
138 }
139
140 const result = await this._callNext()
141 yield result
142 } catch (e: any) {
143 if ('message' in e && e.message.startsWith('Final outputs already reached: ')) {
144 if (!this.finalOutputs) {
145 throw e
146 }
147 return this.finalOutputs
148 }
149 if (this.runManager) {
150 await this.runManager.handleChainError(e)
151 }
152 throw e
153 }
154 }
155 }
156
157 /**
158 * Perform any necessary setup for the first step

Callers 1

_streamIteratorMethod · 0.95

Calls 3

resetMethod · 0.95
onFirstStepMethod · 0.95
_callNextMethod · 0.95

Tested by

no test coverage detected