Skip to content

Commit 62503c1

Browse files
Marco van AngerenMarco van Angeren
authored andcommitted
Removed redundant onComplete function, added constructor promotion, fixed changelog
1 parent 96c693d commit 62503c1

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

src/chat/CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ CHANGELOG
1818
- Add `StreamableStoreInterface` which indicates `StoreInterface` implementation can be configured with streaming
1919
- Add `AccumulatingStreamResult` wrapper class which adds accumulation logic & callback chaining to `StreamResult` implementations (can wrap both `Agent` and `Platform` variants) to return the full message once `Generator` is exhausted
2020
- Streamed responses now also create `AssistantMessage` & are added to `Store` in `Chat::submit()`
21-
- Bugfixed loss of metadata in `Chat::submit()`
22-
21+
- Bugfixed loss of metadata in `Chat::submit()`

src/chat/src/Result/AccumulatingStreamResult.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,10 @@
2323
*/
2424
final class AccumulatingStreamResult
2525
{
26-
private ?\Closure $onComplete = null;
27-
2826
public function __construct(
2927
private readonly StreamResult|ToolboxStreamResult $innerResult,
30-
?\Closure $onComplete = null,
28+
private ?\Closure $onComplete = null,
3129
) {
32-
$this->onComplete = $onComplete;
33-
}
34-
35-
public function addOnComplete(\Closure $callback): void
36-
{
37-
$existingCallback = $this->onComplete;
38-
39-
$this->onComplete = $existingCallback
40-
? function (AssistantMessage $message) use ($existingCallback, $callback) {
41-
$existingCallback($message);
42-
$callback($message);
43-
}
44-
: $callback;
4530
}
4631

4732
public function getContent(): \Generator

0 commit comments

Comments
 (0)