refactor(scenario): only 2 scenarios (social / face-to-face); 're-contact' becomes a persona trait

- Scenario picker now has only social + f2f_call (removed recontact) in backend
  _scenarios, start_session validation, and Chat.vue picker.
- 'ลูกค้ากลับมาติดต่อ' is no longer a scenario: it's now a PERSONA trait. Persona prompt
  generates ~1-in-4 personas with recontact=true (asked before, now returns warmer/ready);
  store shape gets recontact field; simulator injects a re-contact note into the persona's
  system prompt so it plays as a returning customer naturally.
- test_scenario updated: unknown scenario defaults to social; recontact shown as a
  generated persona trait.
All 9 backend suites pass. Rebuilt dist.
This commit is contained in:
Macky
2026-08-09 11:21:34 +07:00
parent cb2642a659
commit fd2cae9e62
35 changed files with 54 additions and 48 deletions

View File

@@ -101,8 +101,15 @@ class Simulator:
adapt = scenario_adapt or {
"social": "Chat style: short, casual, quick social-messaging replies.",
"f2f_call": "Style: natural, conversational like a live face-to-face or phone talk.",
"recontact": "Style: casual messaging; you already know the product from 1-3 months ago.",
}.get(scenario, "")
# Personality trait: a "recontact" customer asked about this before and is only now
# coming back, already warmer / more ready to buy. Reference it in chat naturally.
if persona.get("recontact"):
adapt += (
"\nYou contacted/interacted with this seller BEFORE (earlier contact) and are now "
"coming back — you already know the product basics, so you're warmer and more ready "
"to decide. Mention this naturally (e.g. 'I asked about this a while back')."
)
tolerance = int(persona.get("tolerance", 3) or 3)
system = CHAT_SYSTEM.format(
name=persona.get("name", "Customer"),