39 lines
812 B
PHP
39 lines
812 B
PHP
<?php
|
|
|
|
namespace App\Application\DataCollector;
|
|
|
|
use App\Domain\AI\AIClient;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
|
|
|
|
class AiChatDataCollector extends DataCollector
|
|
{
|
|
public function __construct(
|
|
private readonly AIClient $aiClient,
|
|
) {
|
|
}
|
|
|
|
public function collect(Request $request, Response $response, ?\Throwable $exception = null): void
|
|
{
|
|
$this->data = $this->aiClient->getLog();
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return 'ai_chat';
|
|
}
|
|
|
|
/**
|
|
* @return array<mixed>
|
|
*/
|
|
public function getLog(): array
|
|
{
|
|
return $this->data;
|
|
}
|
|
|
|
public function reset(): void
|
|
{
|
|
$this->data = [];
|
|
}
|
|
} |