Backup #1914
| ID | 1914 |
| Dateipfad | /var/www/dev.campus.systemische-tools.de/src/Infrastructure/Config/PipelineStepConfig.php |
| Version | 5 |
| Typ |
modified |
| Größe | 15.1 KB |
| Hash | be74ff4718731f041508c85e0fc3c7a436cb6ef0365e319d247f28f45a581c43 |
| Datum | 2025-12-28 01:16:09 |
| Geändert von | claude-code-hook |
| Grund | Claude Code Pre-Hook Backup vor Edit-Operation |
| Datei existiert |
Ja
|
Dateiinhalt
<?php
declare(strict_types=1);
namespace Infrastructure\Config;
// @responsibility: Konfiguration für Pipeline-Schritte und Collections
final class PipelineStepConfig
{
/**
* Get all available step types with their configuration.
*
* @return array<string, array<string, mixed>>
*/
public static function getStepTypes(): array
{
return [
// Phase 1: Vorverarbeitung
'detect' => [
'label' => 'Erkennung',
'description' => 'Dateien scannen und Format prüfen',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'validate' => [
'label' => 'Validierung',
'description' => 'Datei-Prüfung auf Lesbarkeit und Korruption',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'page_split' => [
'label' => 'Seitenzerlegung',
'description' => 'PDF in Einzelseiten zerlegen für Referenz und Vision-Analyse',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.document_pages',
],
'vision_analyze' => [
'label' => 'Bildanalyse',
'description' => 'Seiten via Vision-Modell analysieren, Bilder und Grafiken erkennen',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.document_pages (vision_analysis)',
'uses_vision' => true,
],
'extract' => [
'label' => 'Textextraktion',
'description' => 'Text extrahieren, OCR für Bilder mit Text',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'structure' => [
'label' => 'Strukturerkennung',
'description' => 'Überschriften, Listen und Hierarchie erkennen',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.document_sections',
],
'segment' => [
'label' => 'Abschnitte',
'description' => 'Logische Dokumentgliederung nach Struktur',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.document_sections',
],
'chunk' => [
'label' => 'Textbausteine',
'description' => 'Chunks erstellen (max 800 Token) mit Seitenreferenz',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.chunks',
],
'queue' => [
'label' => 'Warteschlange',
'description' => 'Dokument zur Verarbeitung einreihen',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'hash' => [
'label' => 'Hash-Berechnung',
'description' => 'SHA256-Hash für Duplikat-Erkennung berechnen',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'rotation' => [
'label' => 'Seitenausrichtung',
'description' => 'Seiten-Rotation per OSD korrigieren',
'phase' => 'Vorverarbeitung',
'storage' => null,
],
'enrich' => [
'label' => 'Anreicherung',
'description' => 'Überschriften und Keywords extrahieren',
'phase' => 'Vorverarbeitung',
'storage' => 'ki_content.chunks (headings, keywords)',
],
// Phase 2: Speicherung & Vektorisierung
'metadata_store' => [
'label' => 'DB-Speicherung',
'description' => 'Dokument, Seiten und Chunks in MariaDB speichern',
'phase' => 'Speicherung',
'storage' => 'ki_content.documents, .document_pages, .chunks',
],
'embed' => [
'label' => 'Vektorisierung',
'description' => 'Embeddings erstellen für Vektor-Suche',
'phase' => 'Speicherung',
'storage' => 'Qdrant: {collection}',
'fixed_model' => 'mxbai-embed-large (1024-dim)',
'has_collection' => true,
],
'collection_setup' => [
'label' => 'Collection',
'description' => 'Qdrant-Collection einrichten falls nötig',
'phase' => 'Speicherung',
'storage' => 'Qdrant: {collection}',
],
'vector_store' => [
'label' => 'Vektorspeicherung',
'description' => 'Vektoren in Qdrant mit MariaDB-ID als Referenz',
'phase' => 'Speicherung',
'storage' => 'Qdrant: {collection}',
],
'index_optimize' => [
'label' => 'Index-Optimierung',
'description' => 'HNSW-Index für schnelle Suche optimieren',
'phase' => 'Speicherung',
'storage' => 'Qdrant: {collection}',
],
'doc_create' => [
'label' => 'Dokument-Eintrag',
'description' => 'Dokument-Datensatz in Datenbank erstellen',
'phase' => 'Speicherung',
'storage' => 'ki_content.documents',
],
'page_store' => [
'label' => 'Seiten-Speicherung',
'description' => 'Einzelseiten in Datenbank speichern',
'phase' => 'Speicherung',
'storage' => 'ki_content.document_pages',
],
'vision' => [
'label' => 'Bild-Analyse',
'description' => 'Seiten via Vision-LLM analysieren',
'phase' => 'Analyse',
'storage' => null,
'uses_llm' => true,
],
'vision_store' => [
'label' => 'Vision-Speicherung',
'description' => 'Vision-Analyse-Ergebnisse speichern',
'phase' => 'Speicherung',
'storage' => 'ki_content.document_pages (vision_analysis)',
],
'chunk_store' => [
'label' => 'Chunk-Speicherung',
'description' => 'Textbausteine in Datenbank speichern',
'phase' => 'Speicherung',
'storage' => 'ki_content.chunks',
],
'qdrant_store' => [
'label' => 'Vektor-Speicherung',
'description' => 'Embedding-Vektoren in Qdrant speichern',
'phase' => 'Speicherung',
'storage' => 'Qdrant: {collection}',
],
'status_update' => [
'label' => 'Status-Update',
'description' => 'Dokument-Status aktualisieren',
'phase' => 'Speicherung',
'storage' => 'ki_content.documents (status)',
],
// Phase 3: Wissensextraktion
'knowledge_page' => [
'label' => 'Seiten-Wissen',
'description' => 'Pro Seite: Entitäten → Semantik → Ontologie → Taxonomie',
'phase' => 'Wissen',
'storage' => 'ki_content.page_knowledge, .entities, .entity_semantics',
'uses_llm' => true,
],
'knowledge_section' => [
'label' => 'Abschnitt-Wissen',
'description' => 'Pro Kapitel: Aggregierte Wissensrepräsentation',
'phase' => 'Wissen',
'storage' => 'ki_content.section_knowledge',
'uses_llm' => true,
],
'knowledge_document' => [
'label' => 'Dokument-Wissen',
'description' => 'Konsolidierte Gesamtsicht des Dokuments',
'phase' => 'Wissen',
'storage' => 'ki_content.document_knowledge',
'uses_llm' => true,
],
'knowledge_validate' => [
'label' => 'Wissens-Validierung',
'description' => 'Abgleich mit DB, Duplikate zusammenführen, neue validieren',
'phase' => 'Wissen',
'storage' => 'ki_content.entities (merged)',
],
// Legacy Analyse-Schritte
'entity_extract' => [
'label' => 'Entitäten (Legacy)',
'description' => 'Personen, Organisationen, Konzepte, Methoden erkennen',
'phase' => 'Analyse',
'storage' => 'ki_content.chunk_entities',
'uses_llm' => true,
],
'relation_extract' => [
'label' => 'Beziehungen (Legacy)',
'description' => 'Relationen zwischen Entitäten extrahieren',
'phase' => 'Analyse',
'storage' => 'ki_content.entity_relations',
'uses_llm' => true,
],
'taxonomy_build' => [
'label' => 'Taxonomie (Legacy)',
'description' => 'Hierarchische Kategorisierung aufbauen',
'phase' => 'Analyse',
'storage' => 'ki_content.chunk_taxonomy, .taxonomy_terms',
'uses_llm' => true,
],
'semantic_analyze' => [
'label' => 'Semantik (Legacy)',
'description' => 'Bedeutungs-Analyse, Konzepte und Definitionen',
'phase' => 'Analyse',
'storage' => 'ki_content.chunk_semantics',
'uses_llm' => true,
],
'summarize' => [
'label' => 'Zusammenfassung',
'description' => 'Dokument- und Seiten-Zusammenfassungen erstellen',
'phase' => 'Analyse',
'storage' => 'ki_content.documents (summary), .document_pages',
'uses_llm' => true,
],
'question_generate' => [
'label' => 'Fragengenerierung',
'description' => 'Beispielfragen für RAG-Chat erstellen',
'phase' => 'Analyse',
'storage' => 'ki_content.generated_questions',
'uses_llm' => true,
],
'entity_store' => [
'label' => 'Entitäten-Speicherung',
'description' => 'Extrahierte Entitäten in Datenbank speichern',
'phase' => 'Wissen',
'storage' => 'ki_content.entities, .document_entities',
],
'entity_normalize' => [
'label' => 'Entitäten-Normalisierung',
'description' => 'Duplikate zusammenführen, Synonyme verknüpfen',
'phase' => 'Wissen',
'storage' => 'ki_content.entity_synonyms',
],
'relation_store' => [
'label' => 'Beziehungs-Speicherung',
'description' => 'Extrahierte Relationen in Datenbank speichern',
'phase' => 'Wissen',
'storage' => 'ki_content.entity_relations',
],
'ontology_classify' => [
'label' => 'Ontologie-Klassifikation',
'description' => 'Entitäten in Ontologie-Klassen einordnen',
'phase' => 'Wissen',
'storage' => 'ki_content.ontology_classes',
],
'chunk_entity_link' => [
'label' => 'Chunk-Entitäten-Verknüpfung',
'description' => 'Chunks mit erkannten Entitäten verknüpfen',
'phase' => 'Wissen',
'storage' => 'ki_content.chunk_entities',
],
'chunk_taxonomy' => [
'label' => 'Chunk-Taxonomie',
'description' => 'Chunks mit Taxonomie-Kategorien verknüpfen',
'phase' => 'Wissen',
'storage' => 'ki_content.chunk_taxonomy',
],
'entity_taxonomy' => [
'label' => 'Entitäten-Taxonomie',
'description' => 'Entitäten mit Taxonomie-Pfaden verknüpfen',
'phase' => 'Wissen',
'storage' => 'ki_content.entity_taxonomy_mapping',
],
'chunk_semantics' => [
'label' => 'Chunk-Semantik',
'description' => 'Semantische Analyse-Ergebnisse pro Chunk speichern',
'phase' => 'Wissen',
'storage' => 'ki_content.chunk_semantics',
],
'finalize' => [
'label' => 'Abschluss',
'description' => 'Status finalisieren und Job beenden',
'phase' => 'Analyse',
'storage' => 'ki_content.documents (status)',
],
'analyze' => [
'label' => 'Analyse (Legacy)',
'description' => 'Kombinierte Analyse (veraltet)',
'phase' => 'Analyse',
'storage' => 'ki_content.chunk_entities, .chunk_semantics',
'uses_llm' => true,
],
];
}
/**
* Get available Qdrant collections.
*
* @return array<string, string>
*/
public static function getCollections(): array
{
return [
'documents' => 'Documents (Schulungsunterlagen)',
'mail' => 'Mail (E-Mails)',
'entities' => 'Entities (Entitäten)',
'knowledge' => 'Knowledge (Wissensbasis)',
];
}
/**
* Get default steps for new pipelines.
*
* @return array<array<string, mixed>>
*/
public static function getDefaultSteps(): array
{
return [
['step_type' => 'detect', 'config' => ['hash_algorithm' => 'sha256'], 'sort_order' => 1, 'enabled' => 1],
['step_type' => 'extract', 'config' => ['ocr_enabled' => true, 'ocr_language' => 'deu'], 'sort_order' => 2, 'enabled' => 1],
['step_type' => 'chunk', 'config' => ['min_size' => 100, 'max_size' => 2000, 'overlap' => 0.1], 'sort_order' => 3, 'enabled' => 1],
['step_type' => 'embed', 'config' => ['model' => 'mxbai-embed-large', 'collection' => 'documents', 'dimensions' => 1024], 'sort_order' => 4, 'enabled' => 1],
['step_type' => 'analyze', 'config' => ['extract_entities' => true, 'extract_relations' => true, 'classify_taxonomy' => true], 'sort_order' => 5, 'enabled' => 0],
];
}
/**
* Get default file extensions.
*
* @return array<string>
*/
public static function getDefaultExtensions(): array
{
return ['.pdf', '.docx', '.pptx', '.md', '.txt'];
}
/**
* Parse extension string into array.
*
* @param string $input
* @return array<string>
*/
public static function parseExtensions(string $input): array
{
$extensions = [];
$parts = preg_split('/[\s,;]+/', $input);
if ($parts === false) {
return self::getDefaultExtensions();
}
foreach ($parts as $ext) {
$ext = trim($ext);
if ($ext === '') {
continue;
}
if ($ext[0] !== '.') {
$ext = '.' . $ext;
}
$extensions[] = strtolower($ext);
}
return $extensions !== [] ? $extensions : self::getDefaultExtensions();
}
}
Vollständig herunterladen
Aktionen
Andere Versionen dieser Datei
| ID |
Version |
Typ |
Größe |
Datum |
| 2197 |
16 |
modified |
17.1 KB |
2025-12-31 02:37 |
| 2192 |
15 |
modified |
17.1 KB |
2025-12-31 02:21 |
| 1940 |
14 |
modified |
16.8 KB |
2025-12-28 01:52 |
| 1939 |
13 |
modified |
16.0 KB |
2025-12-28 01:52 |
| 1938 |
12 |
modified |
15.4 KB |
2025-12-28 01:51 |
| 1937 |
11 |
modified |
15.1 KB |
2025-12-28 01:51 |
| 1919 |
10 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1918 |
9 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1917 |
8 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1916 |
7 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1915 |
6 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1914 |
5 |
modified |
15.1 KB |
2025-12-28 01:16 |
| 1913 |
4 |
modified |
12.8 KB |
2025-12-28 01:13 |
| 1912 |
3 |
modified |
11.0 KB |
2025-12-28 01:12 |
| 1911 |
2 |
modified |
10.0 KB |
2025-12-28 01:12 |
| 762 |
1 |
modified |
10.1 KB |
2025-12-23 08:02 |
← Zurück zur Übersicht