mirror of
http://100.103.83.12:3003/fegger/odoo-at-payroll.git
synced 2026-09-17 16:56:42 +00:00
feat(agent): support cost questions and thinking fallback
This commit is contained in:
@@ -9,6 +9,7 @@ from agent.generate import answer_question
|
||||
from agent.query_planner import (
|
||||
SubQuery,
|
||||
decision_support_plan,
|
||||
is_decision_support,
|
||||
parse_plan,
|
||||
plan_queries,
|
||||
should_plan,
|
||||
@@ -37,6 +38,37 @@ def test_should_plan_gate():
|
||||
assert not should_plan("Wie hoch ist der KV-Mindestlohn im Friseurgewerbe?")
|
||||
|
||||
|
||||
def test_decision_support_matches_umlaut_free_phrasings():
|
||||
"""Nutzer geben Umlaute oft als ae/oe/ue ein; der Trigger muss beide
|
||||
Schreibweisen erkennen und für Kostenaufstellungen eigene Queries liefern."""
|
||||
q1 = (
|
||||
"mein mitarbeiter verdient EUR 3000 brutto. ich moechte ihm einmalig "
|
||||
"500,- bar auszahlen, was ist hier die guenstigste loesung?"
|
||||
)
|
||||
q2 = (
|
||||
"mein mitarbeiter verdient EUR 3000 brutto. ich moechte ihm einmalig "
|
||||
"500,- bar auszahlen, wieviel kostet mich das?"
|
||||
)
|
||||
assert is_decision_support(q1)
|
||||
assert is_decision_support(q2)
|
||||
|
||||
subs1, qtype1 = decision_support_plan(q1, default_year="2026")
|
||||
assert qtype1 == "specific"
|
||||
assert len(subs1) == 4 # Vergleichs- + Kostendimension, Zukunftssicherung fällt weg
|
||||
assert all(s.scope == "gesetz" for s in subs1)
|
||||
texts1 = [s.text for s in subs1]
|
||||
assert any("einmalige Bezüge" in t for t in texts1)
|
||||
assert any("Dienstgeberbeitrag" in t for t in texts1)
|
||||
|
||||
subs2, qtype2 = decision_support_plan(q2, default_year="2026")
|
||||
assert qtype2 == "specific"
|
||||
assert len(subs2) == 3
|
||||
texts = [s.text for s in subs2]
|
||||
assert any("einmalige Bezüge" in t for t in texts)
|
||||
assert any("Dienstgeberbeitrag" in t for t in texts)
|
||||
assert all(s.scope == "gesetz" for s in subs2)
|
||||
|
||||
|
||||
def test_decision_support_plan_splits_direct_payment_and_alternatives():
|
||||
planned = decision_support_plan(
|
||||
"Ich will meinem Mitarbeiter 500 Euro zusätzlich auszahlen. "
|
||||
|
||||
Reference in New Issue
Block a user