fix(persona): natural Thai openers - 'สวัสดีครับ/ค่ะ' + direct question, no 'เฮ้/เอ้'

- persona_prompts OPENER RULE: mandate polite Thai openers that start
  with สวัสดีครับ/ค่ะ and go straight to the question or 'สนใจ/สอบถาม';
  explicitly forbid casual English fillers (เฮ้/เอ้/เอ่อ/hey) and
  singsong slang for Thai
- chat_routes: default opener fallback is now locale-aware - Thai locale
  uses 'สวัสดีครับ สนใจสินค้าของคุณครับ...' instead of the English one
This commit is contained in:
Macky
2026-08-19 09:26:19 +07:00
parent 4b5a14079b
commit 07e80be952
2 changed files with 10 additions and 7 deletions

View File

@@ -327,7 +327,7 @@ def start_session(gid: str, pid: str):
if scenario_meta.get("preamble"):
seeded.append({"role": "system", "text": scenario_meta["preamble"]})
if init_mode == "customer":
opener = persona.get("opener") or "Hi, I saw your product and had a question."
opener = persona.get("opener") or (("สวัสดีครับ สนใจสินค้าของคุณครับ ขอถามรายละเอียดหน่อยได้ไหม" if locale == "th" else "Hi, I saw your product and had a question."))
seeded.append({"role": "customer", "text": opener})
initial_internal = {"turns": 0, "score": 50, "signals": []}
@@ -348,7 +348,7 @@ def start_session(gid: str, pid: str):
if scenario_meta.get("preamble"):
seeded.append({"role": "system", "text": scenario_meta["preamble"]})
if init_mode == "customer":
opener = persona.get("opener") or "Hi, I saw your product and had a question."
opener = persona.get("opener") or (("สวัสดีครับ สนใจสินค้าของคุณครับ ขอถามรายละเอียดหน่อยได้ไหม" if locale == "th" else "Hi, I saw your product and had a question."))
seeded.append({"role": "customer", "text": opener})
session, resumed = s["sessions"].start(
org_id=org_id,

View File

@@ -50,11 +50,14 @@ RULES:
7. difficulty 1-5. special="" unless wrong_text.
8. OPENER RULE (IMPORTANT): the `opener` is what the customer says FIRST when initiation_mode="customer".
Every opener — for EVERY tier, including wrong_text and every tier-C persona — must be a natural, polite,
in-character customer greeting that starts warmly or neutrally and expresses some interest or a question
(e.g. "สวัสดีค่ะ เห็นสินค้าคุณแล้ว สนใจอยากสอบถา" / "สวัสดีครับ เข้าไปดูเพจมา อยากถามราคาหน่อย" / "Hi, I saw
your page and had a question"). NEVER make the opener a complaint, a refusal, a price grumble, a "never
mind", or anything negative — the customer's resistance must only surface DURING the conversation, not
in their very first message.
in-character customer greeting that starts warmly or neutrally and expresses some interest or a question.
EXAMPLES (Thai): "สวัสดีครับ สนใจสินค้าตัวนี้ ขอถามราคาหน่อยได้ไห" / "สวัสดีค่ะ เห็นโฆษณาแฟนเพจมา เลยอยากสอบถาม" / "สวัสดีครับ ซื้อของที่นี่แล้วสั่ง-จัดส่งยังไงบ้าง" / "สนใจสินค้าในแฟนเพจครับ สอบถามรายละเอียดได้ไหม".
THAI STYLE (MANDATORY): Start with "สวัสดีครับ/ค่ะ" then go straight to the question or the word "สนใจ/สอบถาม"
do NOT open with casual English-style interjections or filler like "เฮ้", "เอ้", "เอ่อ", "hey", "hi ya", or
singsong slang ("ไง", "นี่ๆ", "ว่าไง"). A question that gets to the point directly is ideal. For English,
a plain "Hi" or "Hello" is fine.
NEVER make the opener a complaint, a refusal, a price grumble, a "never mind", or anything negative — the
customer's resistance must only surface DURING the conversation, not in their very first message.
9. Language: output all human text in the requested language.
Only output valid JSON: {"personas": [ ... ]}
"""