- WS /ws/session: modes, summon, anomaly fragments, streaming direct contact,
passive wire-ghost ambient loop, per-user rate limits, event transcript
- entities: anomaly-signature fingerprinting, LLM minting + procedural
fallback, Codex matching with contact counts and sightings
- tts: 8 local Piper voices (EN/ES), per-entity voice profiles, numpy
effects chain (pitch/rate/bitcrush/echo/static)
- llm: streaming client, submit_stream in bounded queue, SpiritService
with offline fallbacks for every channel
- routes: public /api/codex, /api/codex/{id}, /api/stats; /audio static mount
- models: Entity, EntitySighting, Event, ContactSession(entity_id, language)
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from app.llm import prompts
|
|
|
|
|
|
def test_fragment_system_carries_fiction_framing_not_paranormal_claim():
|
|
system = prompts.fragment_system("a spirit box", "en")
|
|
assert "horror art installation" in system
|
|
assert "single word" in system
|
|
assert "Spanish" not in system
|
|
|
|
|
|
def test_spanish_language_clause_applied():
|
|
assert "Spanish" in prompts.fragment_system("a spirit box", "es")
|
|
assert "Spanish" in prompts.wire_system("es")
|
|
assert "Spanish" in prompts.chat_system({"name": "X"}, "es")
|
|
|
|
|
|
def test_chat_prompt_formats_history_and_question():
|
|
prompt = prompts.chat_prompt(
|
|
"Are you at peace?",
|
|
[
|
|
{"role": "user", "text": "Who are you?"},
|
|
{"role": "spirit", "text": "A voice in the wires."},
|
|
],
|
|
)
|
|
assert "Seeker: Who are you?" in prompt
|
|
assert "Spirit: A voice in the wires." in prompt
|
|
assert prompt.rstrip().endswith("Spirit:")
|
|
|
|
|
|
def test_mint_prompt_requests_exact_json_keys():
|
|
prompt = prompts.mint_prompt("abcdef0123456789", "evp", "[]", ["lessac", "ryan"])
|
|
for key in ('"name"', '"epithet"', '"persona"', '"rarity"', '"voice"', '"visual"', '"quotes"'):
|
|
assert key in prompt
|
|
assert "lessac, ryan" in prompt
|