This commit is contained in:
Lars committed 2026-08-25 17:16:35 +02:00
1 parent fd7102e3b3
commit 60f0d2830d
17 files changed
+1502 -257

No files matched your search

+101 -4
View File
@@ -38,12 +38,68 @@ LEGACY_STYLE_KEYS = {item["slug"] for item in SEED_TRAIT_HINTS}
EXISTING_BEFORE_NEW = (
"bestehenden Trait bestätigen",
"präzisieren",
"Scope ändern",
"zusammenführen oder aufteilen",
"Scope / Core-vs-Facet-Zuordnung ändern",
"redundante Traits zusammenführen oder sinnvoll aufteilen",
"erst dann einen neuen Trait anlegen",
"neue Facet nur bei tatsächlicher semantischer Notwendigkeit",
)
TRAIT_ACTIONS = (
"keep",
"update",
"add",
"remove",
"reclassify",
"merge",
"split",
"confirm",
"precisify",
"rescope",
"create",
"move",
)
ACTION_ALIASES = {
"keep": "keep",
"confirm": "keep",
"update": "update",
"precisify": "update",
"add": "add",
"create": "add",
"remove": "remove",
"retire": "remove",
"reclassify": "reclassify",
"rescope": "reclassify",
"move": "reclassify",
"merge": "merge",
"split": "split",
}
APPLY_ACTIONS = {
"keep": "confirm",
"update": "precisify",
"add": "create",
"remove": "remove",
"reclassify": "rescope",
"merge": "merge",
"split": "split",
}
EVIDENCE_BASIS = ("kansho_sources", "external_chat_history", "external_context")
EXTERNAL_EVIDENCE = ("external_chat_history", "external_context")
BASIS_ALIASES = {
"kansho_sources": "kansho_sources",
"kansho": "kansho_sources",
"external_chat_history": "external_chat_history",
"external_context": "external_context",
"external": "external_context",
"dayone_export": "external_context",
"day_one": "external_context",
"dayone": "external_context",
}
ANALYSIS_MODES = ("initial_build", "review")
META_STYLE_MARKERS = (
"explizite nutzer-review",
"expliziter initial profile build",
"explizite nutzer-review des writing profile",
"expliziter initialer profilaufbau",
)
TRAIT_ACTIONS = ("confirm", "precisify", "rescope", "merge", "split", "create", "keep", "update")
ACTION_ALIASES = {"keep": "confirm", "update": "precisify"}
def normalize_facet_key(key: str | None) -> str:
@@ -125,6 +181,47 @@ def recency_role(occurred_at: str | None, now: datetime | None = None) -> str:
return "long_term"
def is_meta_style_text(text: str | None) -> bool:
raw = (text or "").strip().lower()
if not raw:
return True
if len(raw.split()) <= 24 and any(marker in raw for marker in META_STYLE_MARKERS):
return True
return False
def normalize_evidence_basis(raw) -> list[str]:
values = raw if isinstance(raw, list) else [raw] if raw else []
out: list[str] = []
seen: set[str] = set()
for item in values:
key = str(item or "").strip().lower().replace("-", "_").replace(" ", "_")
if not key:
continue
mapped = BASIS_ALIASES.get(key)
if not mapped:
mapped = "kansho_sources" if key.startswith("kansho") else "external_context"
if mapped in seen:
continue
seen.add(mapped)
out.append(mapped)
return out
def is_external_only(basis) -> bool:
values = list(basis or [])
return bool(values) and "kansho_sources" not in values
def normalize_mode(value: str | None) -> str:
raw = (value or "").strip()
if raw in {"incremental", "review"}:
return "review"
if raw == "initial_build":
return "initial_build"
return ""
def seed_catalog() -> list[dict]:
return [
{