런타임 계약과 학습자 흐름 보강

This commit is contained in:
Yun Chan 2026-06-29 08:12:14 +09:00
parent f456b8997a
commit 206018b088
56 changed files with 4306 additions and 1008 deletions

View file

@ -88,18 +88,32 @@ def turn_rapport(ev: dict[str, Any]) -> float | None:
return max(-1.0, min(1.0, value))
def turn_technique_label(item: object) -> str | None:
if isinstance(item, dict):
label = (
item.get("label_ko")
or item.get("label")
or item.get("name")
or item.get("id")
or item.get("code")
)
else:
label = item
if label is None:
return None
text = str(label).strip()
return text or None
def turn_techniques(ev: dict[str, Any]) -> list[str]:
raw = ev.get("techniques")
if not isinstance(raw, list):
return []
labels: list[str] = []
for item in raw:
if isinstance(item, dict):
label = item.get("label") or item.get("name") or item.get("id") or item.get("code")
else:
label = item
label = turn_technique_label(item)
if label:
labels.append(str(label))
labels.append(label)
return labels