optimize dashboard

This commit is contained in:
team2
2026-03-01 17:07:53 +01:00
parent 6d1ab87f75
commit cfd67e1e3c
2 changed files with 60 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ use App\Service\IngestJobService;
use App\Service\IngestOrchestrator;
use App\Tag\TagNdjsonExporter;
use App\Tag\TagVectorIndexBuilder;
use App\Tag\TagVectorIndexHealthService;
use App\Vector\VectorIndexHealthService;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
@@ -27,13 +28,14 @@ use Symfony\Component\Process\Process;
final class SystemRebuildCommand extends Command
{
public function __construct(
private readonly IngestJobService $jobService,
private readonly IngestOrchestrator $orchestrator,
private readonly TagNdjsonExporter $tagExporter,
private readonly TagVectorIndexBuilder $tagIndexBuilder,
private readonly IndexMetaManager $metaManager,
private readonly VectorIndexHealthService $health,
private readonly string $projectDir,
private readonly IngestJobService $jobService,
private readonly IngestOrchestrator $orchestrator,
private readonly TagNdjsonExporter $tagExporter,
private readonly TagVectorIndexBuilder $tagIndexBuilder,
private readonly IndexMetaManager $metaManager,
private readonly VectorIndexHealthService $health,
private readonly TagVectorIndexHealthService $tagHealth,
private readonly string $projectDir,
)
{
parent::__construct();
@@ -178,6 +180,13 @@ final class SystemRebuildCommand extends Command
return Command::FAILURE;
}
try {
$reportTag = $this->tagHealth->check();
} catch (\Throwable $e) {
$io->error('Tag health check failed: ' . $e->getMessage());
return Command::FAILURE;
}
$io->definitionList(
['ndjson_exists' => $report['ndjson_exists'] ? 'yes' : 'no'],
['ndjson_chunk_count' => (string)$report['ndjson_chunk_count']],
@@ -187,6 +196,15 @@ final class SystemRebuildCommand extends Command
['status' => (string)$report['status']],
);
$io->definitionList(
['tags_ndjson_exists' => $reportTag['tags_ndjson_exists'] ? 'yes' : 'no'],
['tags_ndjson_count' => (string)$reportTag['tags_ndjson_count']],
['tag_vector_exists' => $reportTag['vector_exists'] ? 'yes' : 'no'],
['tag_meta_exists' => $reportTag['meta_exists'] ? 'yes' : 'no'],
['vector_tag_count' => (string)$reportTag['vector_tag_count']],
['status' => (string)$reportTag['status']],
);
if (!in_array($report['status'], ['OK', 'OK_EMPTY'], true)) {
$io->error('Health check not OK: ' . $report['status']);
return Command::FAILURE;

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Tag\TagVectorIndexHealthService;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCommand(
name: 'mto:agent:tag:health',
description: 'Health-Check für TAG/FAISS Konsistenz'
)]
final class TagHealthCheckCommand extends Command
{
public function __construct(
private readonly TagVectorIndexHealthService $health
) {
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$result = $this->health->check();
$output->writeln(json_encode($result, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
return str_starts_with($result['status'], 'OK')
? Command::SUCCESS
: Command::FAILURE;
}
}