Skip to content

Commit 377d7d6

Browse files
Marco van AngerenMarco van Angeren
authored andcommitted
Removed redundant onComplete function, added constructor promotion, fixed changelog
1 parent 627ac43 commit 377d7d6

File tree

2 files changed

+8
-23
lines changed

2 files changed

+8
-23
lines changed

src/chat/CHANGELOG.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ CHANGELOG
44
0.1
55
---
66

7-
* Add streaming support to `ChatInterface::submit()`
8-
- Add `StreamableStoreInterface` which indicates `StoreInterface` implementation can be configured with streaming
9-
- 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
10-
- Streamed responses now also create `AssistantMessage` & are added to `Store` in `Chat::submit()`
11-
- Bugfixed loss of metadata in `Chat::submit()`
12-
* Introduce the component
13-
* Add support for external message stores:
7+
* Introduce the component
8+
* Add support for external message stores:
149
- Doctrine
1510
- Meilisearch
1611
- MongoDb
1712
- Pogocache
1813
- Redis
1914
- SurrealDb
15+
* Add streaming support to `ChatInterface::submit()`
16+
- Add `StreamableStoreInterface` which indicates `StoreInterface` implementation can be configured with streaming
17+
- 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
18+
- Streamed responses now also create `AssistantMessage` & are added to `Store` in `Chat::submit()`
19+
- 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)