Compare commits
1 Commits
fix/59
...
burn/1601-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1e6788237 |
37
index.html
37
index.html
@@ -680,7 +680,7 @@ html, body {
|
||||
|
||||
<!-- Footer -->
|
||||
<footer id="footer">
|
||||
<a href="/about.html" aria-label="About The Door">about</a>
|
||||
<a href="/about" aria-label="About The Door">about</a>
|
||||
<button id="safety-plan-btn" aria-label="Open My Safety Plan">my safety plan</button>
|
||||
<button id="clear-chat-btn" aria-label="Clear chat history">clear chat</button>
|
||||
</footer>
|
||||
@@ -854,21 +854,23 @@ Sovereignty and service always.`;
|
||||
|
||||
// ===== CRISIS KEYWORDS =====
|
||||
// Tier 1: General crisis indicators - triggers enhanced 988 panel
|
||||
var crisisKeywords = [
|
||||
// Original keywords
|
||||
// HIGH: suicidal ideation, self-harm — triggers level 3
|
||||
var highKeywords = [
|
||||
'suicide', 'kill myself', 'end it all', 'no reason to live',
|
||||
'want to die', "can't go on", 'nobody cares', 'better off without me',
|
||||
'goodbye forever', 'end my life', 'not worth living', 'no way out',
|
||||
// Self-harm (NEW)
|
||||
'want to die', 'end my life', 'not worth living', 'goodbye forever',
|
||||
'better off without me',
|
||||
'hurt myself', 'self harm', 'self-harm', 'cutting myself', 'cut myself',
|
||||
'burn myself', 'scratch myself', 'hitting myself', 'harm myself',
|
||||
// Passive suicidal ideation (NEW)
|
||||
"don't want to exist", 'not exist anymore', 'disappear forever',
|
||||
'never wake up', 'sleep forever', 'end the pain', 'stop the pain',
|
||||
// Hopelessness (NEW) - context-aware phrases to reduce false positives
|
||||
'no purpose', 'nothing matters', 'giving up on life',
|
||||
'cant go on', 'cannot go on', "can't take it", 'too much pain',
|
||||
'no hope left', 'burden', 'waste of space'
|
||||
'never wake up', 'sleep forever', 'end the pain'
|
||||
];
|
||||
|
||||
// MEDIUM: distress, hopelessness — triggers level 2
|
||||
var mediumKeywords = [
|
||||
'no way out', "can't go on", 'cant go on', 'cannot go on',
|
||||
'nobody cares', 'nothing matters', 'no purpose', 'giving up on life',
|
||||
"can't take it", 'too much pain', 'no hope left', 'burden',
|
||||
'waste of space', 'stop the pain'
|
||||
];
|
||||
|
||||
// Tier 2: Explicit intent - triggers full-screen overlay
|
||||
@@ -956,10 +958,13 @@ Sovereignty and service always.`;
|
||||
function getCrisisLevel(text) {
|
||||
var lower = text.toLowerCase();
|
||||
for (var i = 0; i < explicitPhrases.length; i++) {
|
||||
if (lower.indexOf(explicitPhrases[i]) !== -1) return 2;
|
||||
if (lower.indexOf(explicitPhrases[i]) !== -1) return 4;
|
||||
}
|
||||
for (var j = 0; j < crisisKeywords.length; j++) {
|
||||
if (lower.indexOf(crisisKeywords[j]) !== -1) return 1;
|
||||
for (var j = 0; j < highKeywords.length; j++) {
|
||||
if (lower.indexOf(highKeywords[j]) !== -1) return 3;
|
||||
}
|
||||
for (var k = 0; k < mediumKeywords.length; k++) {
|
||||
if (lower.indexOf(mediumKeywords[k]) !== -1) return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -969,7 +974,7 @@ Sovereignty and service always.`;
|
||||
var level = getCrisisLevel(userText);
|
||||
if (level === 0) return SYSTEM_PROMPT;
|
||||
|
||||
var levelMap = { 0: 'NONE', 1: 'MEDIUM', 2: 'CRITICAL' };
|
||||
var levelMap = { 0: 'NONE', 1: 'LOW', 2: 'MEDIUM', 3: 'HIGH', 4: 'CRITICAL' };
|
||||
var profileName = levelMap[level] || 'NONE';
|
||||
var profile = COMPASSION_PROFILES[profileName];
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
INDEX_HTML = ROOT / 'index.html'
|
||||
ABOUT_HTML = ROOT / 'about.html'
|
||||
|
||||
|
||||
class TestAboutLink(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.html = INDEX_HTML.read_text(encoding='utf-8')
|
||||
|
||||
def test_about_page_exists(self):
|
||||
self.assertTrue(ABOUT_HTML.exists(), 'about.html should exist for static serving')
|
||||
|
||||
def test_footer_about_link_targets_static_about_html(self):
|
||||
self.assertIn('href="/about.html"', self.html)
|
||||
self.assertNotIn('href="/about"', self.html)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user