Переглянути джерело

CLI train intent Fix + Bugfixes

- CLI train intent: daemon=False Thread damit Training nicht vorzeitig
  abbricht wenn Hauptprozess beendet wird
- Enricher: get_enrichment auf Cache statt SyncState (AttributeError)
- STT: "krone jules" → "crunchyroll" Alias
- Protected Words: Conan, Naruto, Crunchyroll (SymSpell-Schutz)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
patrick 4 місяців тому
батько
коміт
f8e77cda43

+ 5 - 0
plugins/streaming/stt_aliases.json

@@ -8,6 +8,11 @@
     "crunchy roll": "crunchyroll",
     "cranchi roll": "crunchyroll",
     "kronchi": "crunchyroll",
+    "krone jules": "crunchyroll",
+    "krone julis": "crunchyroll",
+    "krone schul": "crunchyroll",
+    "kronjuwel": "crunchyroll",
+    "kron juhl": "crunchyroll",
     "disney plus": "disney+",
     "disney plass": "disney+",
     "disneyplus": "disney+",

+ 1 - 1
plugins/tv_program/enrichment/enricher.py

@@ -282,7 +282,7 @@ class Enricher:
         series_id = _normalize_series_id(title)
 
         # Schon enriched? Direkt zurueckgeben
-        existing = self._sync_state.get_enrichment(series_id)
+        existing = self._cache.get_enrichment(series_id)
         if existing and existing.get("src") != "none":
             pdebug(f"[Enricher] On-Demand: '{title}' bereits enriched")
             return existing

+ 1 - 0
trixy_core/config/datasets/server.py

@@ -116,6 +116,7 @@ class STTCorrectionConfig:
     layers: list[str] = field(default_factory=lambda: ["symspell", "phonetic", "kenlm"])
     protected_words: list[str] = field(default_factory=lambda: [
         "Eminem", "Rammstein", "AC/DC", "Trixy", "Alexa",
+        "Conan", "Naruto", "Crunchyroll", "Netflix",
     ])
     custom_aliases: dict[str, str] = field(default_factory=lambda: {
         "shop": "stopp",

+ 22 - 6
trixy_core/trainer/application.py

@@ -172,14 +172,26 @@ class TrainerApplication(IApplication):
                 except Exception as e:
                     perror(f"Intent-Training Fehler: {e}")
 
-            # Training starten und Fortschritt loggen
-            import threading
-            train_thread = threading.Thread(target=run_training, daemon=True)
+            # Training synchron in Thread ausfuehren
+            # (nicht daemon, damit der Prozess wartet bis fertig)
+            pinfo("  Starte Training (kann einige Minuten dauern)...")
+
+            result_holder: list[Exception | None] = [None]
+
+            def run_training_sync():
+                try:
+                    trainer.train(progress_queue, pause_flag, stop_flag)
+                except Exception as e:
+                    result_holder[0] = e
+
+            train_thread = __import__("threading").Thread(
+                target=run_training_sync, daemon=False,
+            )
             train_thread.start()
 
             # Fortschritt abfragen bis Training fertig
             while train_thread.is_alive():
-                await asyncio.sleep(0.5)
+                await asyncio.sleep(1.0)
                 while not progress_queue.empty():
                     try:
                         progress = progress_queue.get_nowait()
@@ -188,6 +200,8 @@ class TrainerApplication(IApplication):
                     except Exception:
                         break
 
+            train_thread.join()
+
             # Restliche Nachrichten lesen
             while not progress_queue.empty():
                 try:
@@ -197,8 +211,10 @@ class TrainerApplication(IApplication):
                 except Exception:
                     break
 
-            train_thread.join(timeout=5)
-            pinfo("Intent-Training abgeschlossen")
+            if result_holder[0]:
+                perror(f"Intent-Training Fehler: {result_holder[0]}")
+            else:
+                pinfo("Intent-Training abgeschlossen")
 
         except ImportError as e:
             perror(f"Intent-Trainer nicht verfuegbar: {e}")