File size: 827 Bytes
f440f03
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Tests emotional-context analysis and adaptive prompts."""

from maris_core.orchestrator.routing import build_system_prompt
from maris_core.utils.emotional_context import analyze_emotional_context


def test_analyze_emotional_context_detects_frustration() -> None:
    context = analyze_emotional_context("Šis nestrādā, mani tas jau kaitina un ir kļūda.")

    assert context.emotion == "frustrated"
    assert context.response_style == "calm_reassuring_step_by_step"
    assert context.confidence >= 0.7


def test_build_system_prompt_adds_empathy_when_context_is_not_neutral() -> None:
    context = analyze_emotional_context("Lūdzu palīdzi, man ir panika un esmu apmulsis.")
    prompt = build_system_prompt("general", context)

    assert "noraizējies" in prompt.lower()
    assert "empātiski" in prompt.lower()