amber-laravel/app/Repositories/LLM/AIChunkMessage.php

32 lines
596 B
PHP
Raw Normal View History

2024-07-24 17:16:41 +00:00
<?php
namespace App\Repositories\LLM;
class AIChunkMessage extends BaseMessage
{
public ChatEnum $role = ChatEnum::AssistantChunk;
2024-07-24 17:26:40 +00:00
protected string $last_append = '';
2024-07-24 17:16:41 +00:00
public function toAIMessage(): AIMessage
{
$a = new AIMessage(
content: $this->content,
);
$a->processing = false;
return $a;
}
public function append(string $content): void
{
$this->content .= $content;
$this->last_append = $content;
}
public function getLastAppend(): string
{
return $this->last_append;
}
}