Skip to content

Commit c58ddce

Browse files
committed
feature #1027 [Platform] Add ID to message bag (lochmueller)
This PR was merged into the main branch. Discussion ---------- [Platform] Add ID to message bag | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | Issues | | License | MIT Add ID to the message bag. Commits ------- 3bbb0da feat: Add ID to message bag
2 parents 5685346 + 3bbb0da commit c58ddce

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/platform/src/Message/MessageBag.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
namespace Symfony\AI\Platform\Message;
1313

1414
use Symfony\AI\Platform\Metadata\MetadataAwareTrait;
15+
use Symfony\Component\Uid\AbstractUid;
16+
use Symfony\Component\Uid\TimeBasedUidInterface;
17+
use Symfony\Component\Uid\Uuid;
1518

1619
/**
1720
* @author Christopher Hertel <mail@christopher-hertel.de>
@@ -22,6 +25,8 @@ class MessageBag implements \Countable, \IteratorAggregate
2225
{
2326
use MetadataAwareTrait;
2427

28+
private AbstractUid&TimeBasedUidInterface $id;
29+
2530
/**
2631
* @var list<MessageInterface>
2732
*/
@@ -30,6 +35,12 @@ class MessageBag implements \Countable, \IteratorAggregate
3035
public function __construct(MessageInterface ...$messages)
3136
{
3237
$this->messages = array_values($messages);
38+
$this->id = Uuid::v7();
39+
}
40+
41+
public function getId(): AbstractUid&TimeBasedUidInterface
42+
{
43+
return $this->id;
3344
}
3445

3546
public function add(MessageInterface $message): void

0 commit comments

Comments
 (0)