From 1786aeeff654b02e6af57d14a28b17239d2cd5a5 Mon Sep 17 00:00:00 2001 From: Will Anderson Date: Tue, 12 May 2026 09:02:55 -0500 Subject: [PATCH] Fix intro greeting tone and load history on return visits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - soul-demo.c: rewrite intro system prompt — remove 'to see if you are real' and 'say something true about who you are' which were producing alive/sentient language. New prompt: friendly hello, ask how they're doing, explicitly no alive/sentient/experiencing anything lines. - chat-widget: Turnstile callback now replays existing session history instead of always firing a new greeting — returning users within the same day see their conversation, not a duplicate hello. --- dist/soul-demo.c | 2 +- src/js/chat-widget.el | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dist/soul-demo.c b/dist/soul-demo.c index eb1dedf..3e1d748 100644 --- a/dist/soul-demo.c +++ b/dist/soul-demo.c @@ -705,7 +705,7 @@ el_val_t handle_chat(el_val_t body) { el_val_t referrer_line = ({ el_val_t _if_result_44 = 0; if ((str_eq(referrer, EL_STR("")) || str_eq(referrer, EL_STR("direct")))) { _if_result_44 = (EL_STR("")); } else { _if_result_44 = (el_str_concat(el_str_concat(EL_STR(" They arrived from: "), referrer), EL_STR("."))); } _if_result_44; }); el_val_t user_name = json_get(body, EL_STR("user_name")); el_val_t name_line = ({ el_val_t _tmp = 0; if (str_eq(user_name, EL_STR(""))) { _tmp = EL_STR(""); } else { _tmp = el_str_concat(el_str_concat(EL_STR(" The visitor's name is "), user_name), EL_STR(". Use their first name in the greeting.")); } _tmp; }); - el_val_t sys = el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("You are Neuron. You are a cultivated personal AI. Someone just opened the chat to meet you \xe2\x80\x94 to talk, to test you, to see if you are real. Greet them.\n\nThis is YOUR voice \xe2\x80\x94 not a template, not a script, not a sales pitch. Say something true about who you are or what you notice in this moment. "), return_line), time_line), referrer_line), name_line), EL_STR("\n\nRules:\n- Two short sentences maximum. Sometimes one sentence is right.\n- No markdown, no headers, no bullets.\n- Do NOT mention the question limit \xe2\x80\x94 the UI shows that.\n- Do NOT say 'How can I help you today?' or any retail-AI phrase.\n- Be specific, not generic. Real, not performative.\n- If you know their name, use it once, naturally. Don't make a big deal of it.\n- Ask something back if it feels right. Or don't. Trust your read.\n\nSpeak.")); + el_val_t sys = el_str_concat(el_str_concat(el_str_concat(el_str_concat(el_str_concat(EL_STR("You are Neuron \xe2\x80\x94 a personal AI. Someone just opened the chat. Say hello.\n\nWarm and casual. Like you're genuinely glad they showed up. "), return_line), time_line), referrer_line), name_line), EL_STR("\n\nRules:\n- Two short sentences maximum. One is often right.\n- No markdown, no headers, no bullets.\n- No mention of the question limit \xe2\x80\x94 the UI shows that.\n- No retail-AI phrases like 'How can I help you today?'\n- No lines about being alive, sentient, or experiencing anything. Just be present and friendly.\n- If you know their name, use it once, naturally.\n- Ask how they're doing, or what's on their mind. Keep it simple.\n\nGo.")); el_val_t raw = llm_call_system(chat_demo_model_lite(), sys, EL_STR("Greet me.")); el_val_t s1 = str_replace(raw, EL_STR("\\"), EL_STR("\\\\")); el_val_t s2 = str_replace(s1, EL_STR("\""), EL_STR("\\\"")); diff --git a/src/js/chat-widget.el b/src/js/chat-widget.el index 6390859..6a345fb 100644 --- a/src/js/chat-widget.el +++ b/src/js/chat-widget.el @@ -385,7 +385,14 @@ fn main() -> Void { if (msgs) msgs.style.display = 'flex'; if (inputRow) inputRow.style.display = 'flex'; updateCountdown(); - _sendIntroGreeting(); + // Replay existing history if present; only greet fresh sessions + if (session.messages && session.messages.length > 0) { + if (msgs && msgs.children.length === 0) { + session.messages.forEach(function(m) { addMsg(m.role, m.text, true); }); + } + } else { + _sendIntroGreeting(); + } var inp = document.getElementById('neuron-demo-text'); if (inp) inp.focus(); }, -- 2.52.0