harden code and ingester

This commit is contained in:
team 1
2026-02-12 14:31:29 +01:00
parent 5a52e07edc
commit 994f582f35
8 changed files with 77 additions and 496 deletions

View File

@@ -6,7 +6,7 @@ namespace App\Command;
use App\Entity\DocumentVersion;
use App\Entity\User;
use App\Ingest\IngestFlow;
use App\Service\IngestOrchestrator;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
@@ -18,7 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface;
class KnowledgeIngestCommand extends Command
{
public function __construct(
private readonly IngestFlow $ingestFlow,
private readonly IngestOrchestrator $orchestrator,
private readonly EntityManagerInterface $em,
) {
parent::__construct();
@@ -33,8 +33,8 @@ class KnowledgeIngestCommand extends Command
protected function execute(InputInterface $input, OutputInterface $output): int
{
$versionId = $input->getArgument('versionId');
$userId = $input->getArgument('userId');
$versionId = (string) $input->getArgument('versionId');
$userId = (string) $input->getArgument('userId');
$version = $this->em->getRepository(DocumentVersion::class)->find($versionId);
$user = $this->em->getRepository(User::class)->find($userId);
@@ -46,9 +46,9 @@ class KnowledgeIngestCommand extends Command
$output->writeln('Starting ingest...');
$this->ingestFlow->ingestDocumentVersion($version, $user);
$job = $this->orchestrator->runForVersion($version, $user, false);
$output->writeln('<info>Ingest completed.</info>');
$output->writeln(sprintf('<info>Ingest completed. Job: %s</info>', (string) $job->getId()));
return Command::SUCCESS;
}