feat: add per-shop persona routing for ai replies

This commit is contained in:
2026-03-02 13:02:07 +08:00
parent 684409686d
commit 4022ed8f7a
3 changed files with 66 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ def build_prompt(
state: Any,
extract_image_url: Callable[[str], str],
shop_type_resolver: Callable[[str, str], str],
shop_persona_resolver: Callable[[str, str], str],
parse_order_info: Callable[[str], dict[str, str]],
build_order_instruction: Callable[[str, str], str],
) -> str:
@@ -58,6 +59,7 @@ def build_prompt(
stage_info += f"\n【客户压价次数】{state.discount_count}"
shop_type = shop_type_resolver(message.acc_id or "", message.goods_name or "")
shop_persona = shop_persona_resolver(message.acc_id or "", message.goods_name or "")
shop_hint = ""
try:
from config.config import CONFIG_DIR
@@ -84,6 +86,8 @@ def build_prompt(
prompt += f"商品名称: {message.goods_name}\n"
if shop_hint:
prompt += f"\n{shop_hint}\n"
if shop_persona:
prompt += f"\n【店铺人设】{shop_persona}\n"
order_paid = False
order_unpaid = False