Backup #1478
| ID | 1478 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/ServiceProvider/ChatServiceProvider.php |
| Version | 2 |
| Typ |
modified |
| Größe | 4.0 KB |
| Hash | 6e0f204f938919b01283f2b07074c7baf9fbfd3571febde4e0c3e480bc9002c0 |
| Datum | 2025-12-25 17:03:14 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
declare(strict_types=1);
// @responsibility: Register Chat bounded context services in DI container
namespace ServiceProvider;
use Domain\Repository\ChatMessageRepositoryInterface;
use Domain\Repository\ChatSessionRepositoryInterface;
use Domain\Repository\ContentConfigRepositoryInterface;
use Domain\Repository\PromptsRepositoryInterface;
use Domain\Service\ModelRegistryInterface;
use Framework\Container;
use Infrastructure\AI\AIConfig;
use Infrastructure\AI\ChatService;
use Infrastructure\AI\ContentQualityValidator;
use Infrastructure\AI\ModelRegistry;
use Infrastructure\AI\OllamaService;
use Infrastructure\AI\QdrantClient;
use Infrastructure\AI\QdrantService;
use Infrastructure\AI\VectorSearchService;
use Infrastructure\Formatting\ChatMessageFormatter;
use Infrastructure\Persistence\ChatMessageRepository;
use Infrastructure\Persistence\ChatSessionRepository;
use Infrastructure\Persistence\ContentConfigRepository;
use Infrastructure\Persistence\CriticsRepository;
use Infrastructure\Persistence\PromptsRepository;
use UseCases\Chat\ManageChatSessionsUseCase;
/**
* ChatServiceProvider registers all chat and AI-related services.
*/
final class ChatServiceProvider implements ServiceProviderInterface
{
public function register(Container $container): void
{
// Repositories
$container->set(ChatSessionRepository::class, fn (Container $c) => new ChatSessionRepository($c->get('pdo.content')));
$container->set(ChatMessageRepository::class, fn (Container $c) => new ChatMessageRepository($c->get('pdo.content')));
$container->set(PromptsRepository::class, fn (Container $c) => new PromptsRepository($c->get('pdo.content')));
$container->set(CriticsRepository::class, fn (Container $c) => new CriticsRepository($c->get('pdo.content')));
$container->set(ContentConfigRepository::class, fn (Container $c) => new ContentConfigRepository($c->get('pdo.content')));
// Interface aliases
$container->set(ChatSessionRepositoryInterface::class, fn (Container $c) => $c->get(ChatSessionRepository::class));
$container->set(ChatMessageRepositoryInterface::class, fn (Container $c) => $c->get(ChatMessageRepository::class));
$container->set(PromptsRepositoryInterface::class, fn (Container $c) => $c->get(PromptsRepository::class));
// AI Services
$container->set(AIConfig::class, fn () => AIConfig::fromCredentialsFile());
$container->set(ChatService::class, fn (Container $c) => $c->get(AIConfig::class)->createChatService());
$container->set(OllamaService::class, fn (Container $c) => $c->get(AIConfig::class)->createOllamaService());
$container->set(QdrantService::class, fn (Container $c) => $c->get(AIConfig::class)->createQdrantService());
$container->set(VectorSearchService::class, fn () => new VectorSearchService());
$container->set(QdrantClient::class, fn () => new QdrantClient());
$container->set(ContentQualityValidator::class, function (Container $c) {
return new ContentQualityValidator($c->get(OllamaService::class));
});
$container->set(ModelRegistry::class, function (Container $c) {
$registry = new ModelRegistry($c->get('pdo.dev'));
ModelRegistry::setInstance($registry);
return $registry;
});
// Formatters
$container->set(ChatMessageFormatter::class, fn () => new ChatMessageFormatter());
// Use Cases
$container->set(ManageChatSessionsUseCase::class, function (Container $c) {
return new ManageChatSessionsUseCase(
$c->get(ChatSessionRepositoryInterface::class),
$c->get(ChatMessageRepositoryInterface::class),
$c->get(ContentConfigRepository::class),
$c->get(\Domain\Repository\CollectionRepositoryInterface::class),
$c->get(\Infrastructure\Validation\CollectionValidator::class),
$c->get('pdo.dev'),
$c->get(ModelRegistry::class)
);
});
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 2148 |
20 |
modified |
8.8 KB |
2025-12-30 20:43 |
| 2147 |
19 |
modified |
8.9 KB |
2025-12-30 20:43 |
| 2110 |
18 |
modified |
8.8 KB |
2025-12-29 08:48 |
| 2109 |
17 |
modified |
8.8 KB |
2025-12-29 08:48 |
| 2086 |
16 |
modified |
8.3 KB |
2025-12-29 00:11 |
| 2085 |
15 |
modified |
8.3 KB |
2025-12-29 00:10 |
| 2079 |
14 |
modified |
7.9 KB |
2025-12-29 00:05 |
| 2078 |
13 |
modified |
7.9 KB |
2025-12-29 00:04 |
| 2030 |
12 |
modified |
7.8 KB |
2025-12-28 23:23 |
| 1593 |
11 |
modified |
7.0 KB |
2025-12-27 00:15 |
| 1592 |
10 |
modified |
6.8 KB |
2025-12-27 00:14 |
| 1562 |
9 |
modified |
6.2 KB |
2025-12-26 20:29 |
| 1561 |
8 |
modified |
6.0 KB |
2025-12-26 20:29 |
| 1560 |
7 |
modified |
5.9 KB |
2025-12-26 20:29 |
| 1489 |
6 |
modified |
5.0 KB |
2025-12-25 17:04 |
| 1481 |
5 |
modified |
4.6 KB |
2025-12-25 17:03 |
| 1480 |
4 |
modified |
4.4 KB |
2025-12-25 17:03 |
| 1479 |
3 |
modified |
4.3 KB |
2025-12-25 17:03 |
| 1478 |
2 |
modified |
4.0 KB |
2025-12-25 17:03 |
| 1477 |
1 |
modified |
3.9 KB |
2025-12-25 17:03 |
← Zurück zur Übersicht