|
@@ -183,13 +183,22 @@ class NLPClassifierPlugin(TrixyPlugin):
|
|
|
if prediction.confidence >= min_confidence:
|
|
if prediction.confidence >= min_confidence:
|
|
|
intent = prediction.intent
|
|
intent = prediction.intent
|
|
|
confidence = prediction.confidence
|
|
confidence = prediction.confidence
|
|
|
- slots = prediction.slots
|
|
|
|
|
matched_by = "classifier"
|
|
matched_by = "classifier"
|
|
|
|
|
|
|
|
|
|
+ # Slot-Extraktion via KeywordMatcher (der Classifier erkennt Intents,
|
|
|
|
|
+ # der KeywordMatcher extrahiert Slots aus den Patterns)
|
|
|
|
|
+ slots = prediction.slots or {}
|
|
|
|
|
+ if self._keyword_matcher:
|
|
|
|
|
+ kw_slots = self._keyword_matcher.match(text)
|
|
|
|
|
+ if kw_slots and kw_slots.slots:
|
|
|
|
|
+ slots = kw_slots.slots
|
|
|
|
|
+ pdebug(f"[Classifier] Slots via KeywordMatcher: {slots}")
|
|
|
|
|
+
|
|
|
if log_predictions:
|
|
if log_predictions:
|
|
|
pinfo(
|
|
pinfo(
|
|
|
f"[Classifier] ONNX: '{intent}' "
|
|
f"[Classifier] ONNX: '{intent}' "
|
|
|
- f"(conf={confidence:.2f}, {prediction.inference_ms:.1f}ms)"
|
|
|
|
|
|
|
+ f"(conf={confidence:.2f}, {prediction.inference_ms:.1f}ms, "
|
|
|
|
|
+ f"slots={slots})"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
# --- Stufe 3: LLM-Fallback ---
|
|
# --- Stufe 3: LLM-Fallback ---
|