Files
mirosociety/backend/app/constants.py
T
toorandClaude 36b0f2b660 chore: initial commit
- Track MiroSociety source: backend (FastAPI), frontend (Vue3/Vite), docs, configs.
- Add start.sh / deploy.sh for local dev (uv venv + npm + dev servers on 31400/31401).
- Fix pyproject.toml: missing httpx dependency.
- Tighten .gitignore: .env, .venv, node_modules, data/, *.log, uv.lock, frontend/dist, etcd.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-17 13:48:30 +08:00

36 lines
1.3 KiB
Python

from __future__ import annotations
TIMES_OF_DAY = ["morning", "afternoon", "evening"]
VALID_EMOTIONAL_STATES = [
"calm", "content", "curious", "satisfied", "hopeful",
"restless", "frustrated", "dissatisfied", "uneasy", "anxious",
"angry", "fearful", "hostile", "desperate",
"conflicted", "torn", "confused",
]
def normalize_emotional_state(raw: str) -> str:
if not raw:
return "calm"
lower = raw.lower().strip()
for state in VALID_EMOTIONAL_STATES:
if state in lower:
return state
if any(w in lower for w in ("happy", "joy", "pleased", "glad", "happiness")):
return "content"
if any(w in lower for w in ("worry", "nervous", "uncertain", "anxiety", "anxiet")):
return "anxious"
if any(w in lower for w in ("sad", "sorrow", "grief", "mourn")):
return "dissatisfied"
if any(w in lower for w in ("rage", "fury", "furious", "outraged")):
return "angry"
if any(w in lower for w in ("scared", "terrified", "afraid")):
return "fearful"
if any(w in lower for w in ("bored", "tired", "weary")):
return "restless"
if any(w in lower for w in ("excited", "eager", "enthusiastic")):
return "hopeful"
if any(w in lower for w in ("suspicious", "wary", "distrustful")):
return "uneasy"
return "calm"