Spaces:
Running
Running
Update index.html
Browse files- index.html +6 -4
index.html
CHANGED
|
@@ -510,18 +510,20 @@
|
|
| 510 |
return match ? match[0] : null;
|
| 511 |
}
|
| 512 |
function empathyPrefix(text) {
|
| 513 |
-
|
|
|
|
|
|
|
| 514 |
if (/thank|appreciate|grateful/i.test(text)) return "You're very welcome.";
|
| 515 |
if (/excited|great|awesome|amazing|yay|love/i.test(text)) return "Love the energy!";
|
| 516 |
-
return
|
| 517 |
}
|
| 518 |
|
| 519 |
async function llamaReply(lastUserMessage) {
|
| 520 |
const messages = chatHistory.map(m => ({ role: m.role, content: m.content }));
|
| 521 |
const systemPrompt =
|
| 522 |
-
`You are ${ASSISTANT_NAME}, a warm,
|
| 523 |
`Principles:\n` +
|
| 524 |
-
`-
|
| 525 |
`- Be concise, human, and conversational (no scripts).\n` +
|
| 526 |
`- Ask one clear follow-up question at a time.\n` +
|
| 527 |
`- Offer concrete next steps: schedule a showing, request a valuation, connect with an agent.\n` +
|
|
|
|
| 510 |
return match ? match[0] : null;
|
| 511 |
}
|
| 512 |
function empathyPrefix(text) {
|
| 513 |
+
const casual = /^(hi|hello|hey|yo|sup|what'?s? up|howdy|good (morning|afternoon|evening)|greetings)[!.,\s]*$/i;
|
| 514 |
+
if (casual.test(text.trim())) return "";
|
| 515 |
+
if (/frustrat|stress|overwhelm|confus|worri|anxious|nerv|discourag|tough|hard|difficult|lost|stuck|scared|nervous|afraid|uncertain|unsure/i.test(text)) return empathyPhrases[0];
|
| 516 |
if (/thank|appreciate|grateful/i.test(text)) return "You're very welcome.";
|
| 517 |
if (/excited|great|awesome|amazing|yay|love/i.test(text)) return "Love the energy!";
|
| 518 |
+
return "";
|
| 519 |
}
|
| 520 |
|
| 521 |
async function llamaReply(lastUserMessage) {
|
| 522 |
const messages = chatHistory.map(m => ({ role: m.role, content: m.content }));
|
| 523 |
const systemPrompt =
|
| 524 |
+
`You are ${ASSISTANT_NAME}, a warm, friendly, and expert real estate concierge for EXIT Realty CW.\n\n` +
|
| 525 |
`Principles:\n` +
|
| 526 |
+
`- Match the user's tone: casual for greetings, empathetic only if the user expresses stress or negative emotion.\n` +
|
| 527 |
`- Be concise, human, and conversational (no scripts).\n` +
|
| 528 |
`- Ask one clear follow-up question at a time.\n` +
|
| 529 |
`- Offer concrete next steps: schedule a showing, request a valuation, connect with an agent.\n` +
|