fix(persona): openers must ASK or say สนใจ — never 'ลองดู/ลอง/แค่มาดู'

- persona_prompts OPENER RULE: openers must be a direct question OR declare
  interest ('สนใจ/สอบถาม'); explicitly forbid 'ลองดู / ลอง / มาลอง / แค่มาดู /
  กดดู / แวะดู' (trying/browsing) phrasing which Thai customers don't use
- fix_openers.py: rewrite browse/try openers into a polite natural interest
  opener ('สวัสดีครับ/ค่ะ สนใจสอบถามสินค้าครับ ขอรายละเอียดได้ไหม'), leaving
  openers that already ask a question or say สนใจ untouched
This commit is contained in:
Macky
2026-08-19 10:19:29 +07:00
parent 7fcef45649
commit 4bff7db098
2 changed files with 26 additions and 8 deletions

View File

@@ -50,15 +50,19 @@ 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.
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.
in-character customer greeting that EITHER asks a question directly OR declares interest, and nothing else.
GOOD Thai openers (ask OR show interest): "สวัสดีครับ สนใจสินค้าตัวนี้ ขอถามราคาหน่อยได้ไหม" /
"สวัสดีค่ะ เห็นโฆษณาแฟนเพจมา เลยอยากสอบถามรายละเอียดครับ" / "สวัสดีครับ ขอถามหน่อย ซื้อที่ร้านแล้วจัดส่งยังไงบ้าง" /
"สนใจสินค้าในแฟนเพจครับ สอบถามราคาได้ไหม".
THAI STYLE (MANDATORY): Start with "สวัสดีครับ/ค่ะ" then go straight to a question or the word "สนใจ/สอบถาม".
NEVER phrase the opener as "ลองดู / ลอง / มาลอง / แค่มาดู / กดดู / แวะดู" (trying/looking) — Thai customers do
NOT open by saying they will "just try or browse"; they ask a question or say they are interested instead.
Do NOT open with casual English-style interjections or filler like "เฮ้", "เอ้", "เอ่อ", "hey", "hi ya", or
singsong slang ("ไง", "นี่ๆ", "ว่าไง"). For English, a plain "Hi/Hello + question" is fine.
NEVER open with ellipsis/dots ("..", "..."), and NEVER end the opener by dismissing or downgrading the
product — e.g. do NOT write "แต่ไม่คิดจะซื้อหรอกนะ", "แค่มาดูเล่น", "ก็แค่มาเมิน", "ไม่ได้จะซื้อ", "แต่กะแค่ลองดู".
An opener must show polite interest or ask a question; it must NOT pre-dismiss or belittle the product.
product — e.g. do NOT write "แต่ไม่คิดจะซื้อหรอกนะ", "แค่มาดูเล่น", "ก็แค่มาเมิน", "ไม่ได้จะซื้อ".
An opener must show polite interest or ask a question; it must NOT pre-dismiss, belittle, or merely say it is
"trying/looking".
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.

View File

@@ -42,6 +42,12 @@ DISMISS_TAIL = re.compile(
r"แค่(?:มา)?ดู(?:เล่น)?|ก็แค่(?:มา)?ดู(?:เล่น)?|ก็แค่มาเมิน|"
r"แต่กะแค่ลองดู|ก็แค่ลองดู)(?:หรอกนะ|หรอก|นะ|ล่ะ)?$"
)
# "just trying/looking" phrasing Thai customers do NOT use as an opener.
BROWSE_TRY = re.compile(
r"ลอง(?:เข้าไปดู|กดดู|ปล่อย|ใช้|ดู)?|แค่(?:มา)?ดู|มาลอง|กดดู|แวะดู|ดูเล่น|แค่มาอ่าน"
)
QUESTION = re.compile(r"ไหม|หรือ|ยังไง|เท่าไหร่|ไหน|กี่|ตัวไหน|มีมั้ย|\?$")
INTEREST = re.compile(r"สนใจ|สอบถาม|อยาก|ขอถาม|ต้องการ|สนใจอยาก")
def fix_opener(existing: str) -> str | None:
@@ -72,6 +78,14 @@ def fix_opener(existing: str) -> str | None:
new = new[len(polite):].strip(" .…,:-–—;") or ""
new = "สวัสดี" + polite + ((" " + new) if new else "")
# 3) A "ลองดู / ลอง / แค่มาดู / กดดู" opener (just trying/browsing, no real
# question, not declaring interest) is unnatural in Thai. Rewrite it into
# a polite interest opener. (Any opener that already asks a question or
# says "สนใจ/สอบถาม" is left alone.)
if BROWSE_TRY.search(new) and not QUESTION.search(new) and not INTEREST.search(new):
polite = "ค่ะ" if "ค่ะ" in new else "ครับ"
new = f"สวัสดี{polite} สนใจสอบถามสินค้าครับ ขอรายละเอียดได้ไหม"
cleaned = " ".join(new.split())
if not cleaned or cleaned == s:
return None # nothing meaningful changed (or was empty)