-
-
Notifications
You must be signed in to change notification settings - Fork 116
[AIBundle] Fix stream result profiling #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
OskarStark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AssertSame where possible please
fb0cf29 to
53a05cb
Compare
| private function createTraceableStreamResult(\Generator $originalStream): StreamResult | ||
| { | ||
| return $result = new StreamResult((function () use (&$result, $originalStream) { | ||
| $this->resultCache[$result] = ''; | ||
| foreach ($originalStream as $chunk) { | ||
| yield $chunk; | ||
| if (\is_string($chunk)) { | ||
| $this->resultCache[$result] .= $chunk; | ||
| } | ||
| } | ||
| })()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one 👏
chr-hertel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Thank you @valtzu. |

Address 2 streaming-related issues:
symfony/aifrom withinStreamedResponsecallback (in http controller), no data was collected due to not implementingLateDataCollectorInterfaceStreamResultto the profiler storage always failed, because\Generators are not serializableBoth are used in the Turbo Stream Bot demo, and now the profiler works. Though the toolbar still does not auto-update, but that is currently expected behavior.