mirror of
http://100.103.83.12:3003/fegger/odoo-at-payroll.git
synced 2026-09-17 16:56:42 +00:00
feat(agent): log answer comments
This commit is contained in:
@@ -92,6 +92,7 @@ def test_frontend_assets_use_v1_api_and_unknown_assets_are_hidden():
|
||||
assert styles.status_code == 200
|
||||
assert 'fetch("/v1/ask"' in script.text
|
||||
assert 'fetch("/v1/ratings"' in script.text
|
||||
assert 'fetch("/v1/comments"' in script.text
|
||||
assert "innerHTML" not in script.text
|
||||
assert missing.status_code == 404
|
||||
|
||||
@@ -202,9 +203,23 @@ def test_v1_rating_is_persisted_for_logged_answer(monkeypatch, tmp_path):
|
||||
)
|
||||
assert rating.status_code == 200
|
||||
assert rating.json()["accepted"] is True
|
||||
comment = client.post(
|
||||
"/v1/comments",
|
||||
json={
|
||||
"request_id": "rated-answer-1",
|
||||
"comment": "Bitte diesen Fall ins Goldset aufnehmen.",
|
||||
},
|
||||
headers={"Authorization": "Bearer service-secret"},
|
||||
)
|
||||
assert comment.status_code == 200
|
||||
assert comment.json()["comment_id"] > 0
|
||||
|
||||
row = app.state.rag.audit.recent()[0]
|
||||
assert row["rating"] == "up"
|
||||
assert row["feedback"] == "Hilfreich und nachvollziehbar"
|
||||
assert row["comments"][0]["comment"] == (
|
||||
"Bitte diesen Fall ins Goldset aufnehmen."
|
||||
)
|
||||
|
||||
missing = client.post(
|
||||
"/v1/ratings",
|
||||
@@ -212,6 +227,18 @@ def test_v1_rating_is_persisted_for_logged_answer(monkeypatch, tmp_path):
|
||||
headers={"Authorization": "Bearer service-secret"},
|
||||
)
|
||||
assert missing.status_code == 404
|
||||
missing_comment = client.post(
|
||||
"/v1/comments",
|
||||
json={"request_id": "missing-answer", "comment": "Nicht vorhanden"},
|
||||
headers={"Authorization": "Bearer service-secret"},
|
||||
)
|
||||
assert missing_comment.status_code == 404
|
||||
blank_comment = client.post(
|
||||
"/v1/comments",
|
||||
json={"request_id": "rated-answer-1", "comment": " "},
|
||||
headers={"Authorization": "Bearer service-secret"},
|
||||
)
|
||||
assert blank_comment.status_code == 422
|
||||
|
||||
|
||||
def test_health_does_not_expose_internal_ollama_url():
|
||||
|
||||
Reference in New Issue
Block a user