Nomad changes
All checks were successful
Deploy fil (kreuzberg) / deploy (push) Successful in 49s

This commit is contained in:
Henrik Jess Nielsen
2026-06-01 23:40:55 +02:00
parent 72b1a0a6ed
commit b4c07d3693
5723 changed files with 1130655 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
```php title="PHP"
<?php declare(strict_types=1);
use Kreuzberg\Kreuzberg;
class PdfOnlyProcessor implements PostProcessor {
public function name(): string {
return "pdf-only-processor";
}
public function version(): string {
return "1.0.0";
}
public function initialize(): void {
// Initialize PDF-specific resources
}
public function shutdown(): void {
// Cleanup resources
}
public function process(object &$result, object $config): void {
// Only execute for PDFs
if ($result->mime_type !== 'application/pdf') {
return;
}
// Process PDF-specific logic
// For example: extract page information, count pages, extract images, etc.
if (!isset($result->metadata)) {
$result->metadata = [];
}
if (is_array($result->metadata)) {
$result->metadata['pdf_processed'] = true;
$result->metadata['processor_version'] = '1.0.0';
}
}
public function processingStage(): string {
return "Middle";
}
public function shouldProcess(object $result, object $config): bool {
// Only process PDFs with content
return $result->mime_type === 'application/pdf' && !empty($result->content);
}
public function estimatedDurationMs(object $result): int {
// PDF processing varies by size
return 50;
}
public function priority(): int {
return 75;
}
}
// Register the PDF-only processor
$processor = new PdfOnlyProcessor();
Kreuzberg::registerPostProcessor($processor);
echo "PDF-only processor registered\n";
```