optimize dashboard
This commit is contained in:
@@ -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;
|
||||
@@ -33,6 +34,7 @@ final class SystemRebuildCommand extends Command
|
||||
private readonly TagVectorIndexBuilder $tagIndexBuilder,
|
||||
private readonly IndexMetaManager $metaManager,
|
||||
private readonly VectorIndexHealthService $health,
|
||||
private readonly TagVectorIndexHealthService $tagHealth,
|
||||
private readonly string $projectDir,
|
||||
)
|
||||
{
|
||||
@@ -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;
|
||||
|
||||
35
src/Command/TagHealthCheckCommand.php
Normal file
35
src/Command/TagHealthCheckCommand.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user