CreateChatSessionUseCase.php
- Pfad:
src/UseCases/Chat/CreateChatSessionUseCase.php - Namespace: UseCases\Chat
- Zeilen: 35 | Größe: 852 Bytes
- Geändert: 2025-12-25 16:56:23 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Dependencies 5
- implements UseCases\Chat\CreateChatSessionUseCaseInterface
- constructor Domain\Repository\ChatSessionRepositoryInterface
- constructor Domain\Service\ModelRegistryInterface
- use Domain\Repository\ChatSessionRepositoryInterface
- use Domain\Service\ModelRegistryInterface
Klassen 1
-
CreateChatSessionUseCaseclass Zeile 12
Funktionen 2
-
__construct()public Zeile 14 -
createSession()public Zeile 20
Verwendet von 1
Code
<?php
declare(strict_types=1);
namespace UseCases\Chat;
// @responsibility: Creates new chat sessions with default settings
use Domain\Repository\ChatSessionRepositoryInterface;
use Domain\Service\ModelRegistryInterface;
final class CreateChatSessionUseCase implements CreateChatSessionUseCaseInterface
{
public function __construct(
private ChatSessionRepositoryInterface $sessionRepo,
private ModelRegistryInterface $modelRegistry
) {
}
public function createSession(): string
{
$uuid = $this->sessionRepo->generateUuid();
$defaultModel = $this->modelRegistry->getDefaultChatModel();
$this->sessionRepo->create(
uuid: $uuid,
model: $defaultModel,
collections: '["documents"]',
contextLimit: 5
);
return $uuid;
}
}