sync: 190 file da Baida98/AI@720c8d8a (2026-08-26 09:30 UTC) [deploy-all]

#110
by Baida07 - opened
agents/unified_loop_llm.py CHANGED
@@ -129,6 +129,8 @@ class LLMSelectionMixin:
129
  text = goal[:200]
130
  if not self._PURE_EXPLANATION_RE.search(text): return False
131
  if self._EXPL_FILE_REF_RE.search(text): return False
 
 
132
  contextual_spans = [
133
  match.span()
134
  for match in self._EXPL_CONTEXTUAL_ACTION_REF_RE.finditer(text)
@@ -570,6 +572,17 @@ class LLMSelectionMixin:
570
  r")",
571
  re.IGNORECASE | re.DOTALL,
572
  )
 
 
 
 
 
 
 
 
 
 
 
573
  _EXPL_CONTEXTUAL_ACTION_REF_RE = re.compile(
574
  r"\b(?:dopo|prima|durante|in seguito a|a seguito di)\s+una\s+modifica\s+"
575
  r"(?:al|del|nel)\s+(?:codice|file|progetto)\b",
 
129
  text = goal[:200]
130
  if not self._PURE_EXPLANATION_RE.search(text): return False
131
  if self._EXPL_FILE_REF_RE.search(text): return False
132
+ if self._EXPL_REALTIME_RE.search(text): return False
133
+ if self._EXPL_TUTORIAL_RE.search(text): return True
134
  contextual_spans = [
135
  match.span()
136
  for match in self._EXPL_CONTEXTUAL_ACTION_REF_RE.finditer(text)
 
572
  r")",
573
  re.IGNORECASE | re.DOTALL,
574
  )
575
+ _EXPL_REALTIME_RE = re.compile(
576
+ r"\b(oggi|adesso|ora|live|real.?time|notizie|news|ultime|recenti|"
577
+ r"aggiornamenti|previsioni|meteo|prezzo|quotazione|borsa|trend)\b",
578
+ re.IGNORECASE,
579
+ )
580
+ _EXPL_TUTORIAL_RE = re.compile(
581
+ r"^\s*spiega(?:mi)?\b.{0,80}?\b(?:e\s+)?poi\s+"
582
+ r"(?:indica|descrivi|elenca)\s+(?:i\s+)?(?:passaggi|step)\s+"
583
+ r"(?:per\s+)?(?:modificare|correggere|configurare|aggiornare)\b",
584
+ re.IGNORECASE | re.DOTALL,
585
+ )
586
  _EXPL_CONTEXTUAL_ACTION_REF_RE = re.compile(
587
  r"\b(?:dopo|prima|durante|in seguito a|a seguito di)\s+una\s+modifica\s+"
588
  r"(?:al|del|nel)\s+(?:codice|file|progetto)\b",
tests/test_pure_explanation_routing.py CHANGED
@@ -50,6 +50,12 @@ def test_spiega_prefix_is_recognized_like_spiegami() -> None:
50
  ) is True
51
 
52
 
 
 
 
 
 
 
53
  def test_secondary_operational_action_stays_out_of_pure_explanation_route() -> None:
54
  assert _classifier()._is_pure_explanation(
55
  "Spiega la differenza tra cache e storage, poi modifica il file di configurazione."
@@ -62,5 +68,11 @@ def test_explicit_file_reference_stays_out_of_pure_explanation_route() -> None:
62
  ) is False
63
 
64
 
 
 
 
 
 
 
65
  def test_overlong_explanation_stays_on_normal_route() -> None:
66
  assert _classifier()._is_pure_explanation("Spiega " + ("il concetto. " * 30)) is False
 
50
  ) is True
51
 
52
 
53
+ def test_read_only_tutorial_about_a_change_is_a_pure_explanation() -> None:
54
+ assert _classifier()._is_pure_explanation(
55
+ "Spiega e poi indica i passaggi per modificare il checkout in modo da mostrare un messaggio di errore più chiaro."
56
+ ) is True
57
+
58
+
59
  def test_secondary_operational_action_stays_out_of_pure_explanation_route() -> None:
60
  assert _classifier()._is_pure_explanation(
61
  "Spiega la differenza tra cache e storage, poi modifica il file di configurazione."
 
68
  ) is False
69
 
70
 
71
+ def test_realtime_explanation_stays_out_of_pure_explanation_route() -> None:
72
+ assert _classifier()._is_pure_explanation(
73
+ "Spiega le notizie di oggi sull'intelligenza artificiale."
74
+ ) is False
75
+
76
+
77
  def test_overlong_explanation_stays_on_normal_route() -> None:
78
  assert _classifier()._is_pure_explanation("Spiega " + ("il concetto. " * 30)) is False