( messages: Array<UIMessage>, )
| 191 | } |
| 192 | |
| 193 | function findLatestRecipePart( |
| 194 | messages: Array<UIMessage>, |
| 195 | ): StructuredRecipePart | undefined { |
| 196 | for (const message of [...messages].reverse()) { |
| 197 | for (const part of [...message.parts].reverse()) { |
| 198 | if (part.type === 'structured-output') return part |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | return undefined |
| 203 | } |
| 204 | |
| 205 | function isExpectedFetchStreamingError(error: Error | undefined): boolean { |
| 206 | if (!error) return false |