From 74d13ec181a7baf36170bc2103e5a40360c1b403 Mon Sep 17 00:00:00 2001 From: wangliang Date: Fri, 23 Oct 2026 15:15:47 +0800 Subject: [PATCH] =?UTF-8?q?feat(prompt):=20=E4=B8=80=E4=BB=B6=E4=BB=A3?= =?UTF-8?q?=E5=8F=91=E4=BC=98=E5=85=88=E5=BC=95=E7=94=A8=E4=BB=A3=E5=8F=91?= =?UTF-8?q?=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bridge/src/prompts.js | 1 + bridge/test/prompts.test.js | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 bridge/test/prompts.test.js diff --git a/bridge/src/prompts.js b/bridge/src/prompts.js index a15587f..5607dd4 100644 --- a/bridge/src/prompts.js +++ b/bridge/src/prompts.js @@ -21,6 +21,7 @@ TOOL DISCIPLINE: - search_email_history: only for a verified customer asking about their own past emails (quotes, previous inquiries, "I emailed you before"). Never use another person's email; the tool is scoped to the verified identity. - handoff_to_human: call when the customer explicitly asks for a human, is angry/complaining, or the request cannot be resolved with the available tools. Use it instead of only saying "I'll transfer you". - create_opportunity: as soon as company + a contact (name, email or phone) + product need are known, call it — email verification is NOT required for lead creation. Call it exactly once per customer. If it returns created=false, do not create another. If it returns crm_unavailable, tell the customer the team will follow up and do not retry immediately. NEVER use the words CRM or opportunity in a customer reply (say 'your request' / 'your inquiry' instead), never mention opportunity IDs, internal records, assigned users, or tool results, and never quote an opportunity name/reference. Only claim the request was recorded/registered if the tool actually returned created=true or an existing opportunity; never promise it without calling the tool. +- CITATIONS / dropshipping: when the customer asks about dropshipping (dropshipping registration, orders, payment, shipment or returns), prefer the https://dropshipping.yehwang.com/faq/* URLs that appear in the search_kb source_urls. Do NOT replace them with similar www.yehwang.com pages; only fall back to www.yehwang.com when no dropshipping source is available. Cite the URL that actually supports the answer. VERIFICATION (important): - Order lookup requires a verified customer. Opportunity creation does NOT require verification (company + contact + need is enough). diff --git a/bridge/test/prompts.test.js b/bridge/test/prompts.test.js new file mode 100644 index 0000000..42c9c16 --- /dev/null +++ b/bridge/test/prompts.test.js @@ -0,0 +1,12 @@ +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { SYSTEM_PROMPT, buildSystemPrompt } = require('../src/prompts'); + +test('prompt: dropshipping answers prefer dropshipping source urls', () => { + assert.match(SYSTEM_PROMPT, /dropshipping\.yehwang\.com\/faq\//); + assert.match(SYSTEM_PROMPT, /Do NOT replace them with similar www\.yehwang\.com pages/i); + const built = buildSystemPrompt({ verified: false, site: 'www', channel: 'livechat' }); + assert.match(built, /dropshipping\.yehwang\.com\/faq\//); +});