-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
160 lines (156 loc) · 5.85 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NeuroSense</title>
<style>
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background: linear-gradient(135deg, #7b2cbf, #bf00ff);
color: #fff;
}
h1 {
font-size: 3rem;
margin-bottom: 20px;
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}
#description {
max-width: 600px;
text-align: center;
margin-bottom: 20px;
}
#chat-container {
width: 100%;
max-width: 600px;
background: rgba(222, 132, 255, 0.8);
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
border-radius: 10px;
overflow: hidden;
}
#chat-box {
height: 400px;
overflow-y: auto;
padding: 20px;
border-bottom: 1px solid #ddd;
background: rgba(255, 255, 255, 0.9);
color: #000;
}
.message {
margin-bottom: 15px;
padding: 10px;
border-radius: 10px;
max-width: 75%;
word-wrap: break-word;
}
.message.user {
background: #b84dff;
color: white;
align-self: flex-end;
text-align: right;
}
.message.bot {
background: #f1f1f1;
color: black;
align-self: flex-start;
text-align: left;
}
#input-container {
display: flex;
padding: 20px;
background: rgba(255, 255, 255, 0.9);
}
#input-container input {
flex: 1;
padding: 10px;
border: 1px solid #ddd;
border-radius: 3px;
font-size: 1rem;
}
#input-container button {
padding: 10px 15px;
margin-left: 10px;
border: none;
background-color: #b84dff;
color: white;
border-radius: 3px;
cursor: pointer;
font-size: 1rem;
}
#input-container button:hover {
background-color: #9c3bdb;
}
#disclaimer {
margin-top: 20px;
max-width: 600px;
text-align: center;
font-size: 0.9rem;
color: #ddd;
}
#resources {
margin-top: 10px;
font-size: 0.9rem;
color: #ddd;
}
</style>
</head>
<body>
<h1>NeuroSense</h1>
<div id="description">
NeuroSense is an LLM chatbot equipped with clinical knowledge from the DSM-5 by the American Psychological Association (APA) and the National Guidelines for Behavioral Health Crisis Care Best Practice Toolkit by SAMHSA.
</div>
<div id="chat-container">
<div id="chat-box"></div>
<div id="input-container">
<input type="text" id="user-input" placeholder="Type your message here...">
<button onclick="sendMessage()">Send</button>
</div>
</div>
<div id="disclaimer">
Disclaimer: NeuroSense is a language model-based chatbot and is not intended to provide medical advice. For professional mental health support, please consult a licensed healthcare provider. If you are experiencing a crisis, contact the National Suicide Prevention Lifeline at 1-800-273-8255 or text HOME to 741741 for immediate assistance from the Crisis Text Line.
</div>
<div id="resources">
<!-- Additional Resources: -->
<ul>
<li>National Alliance on Mental Illness (NAMI): 1-800-950-NAMI (6264)</li>
<li>Substance Abuse and Mental Health Services Administration (SAMHSA): 1-800-662-HELP (4357)</li>
<li>Veterans Crisis Line: 1-800-273-8255 (Press 1) or text 838255</li>
</ul>
</div>
<script>
async function sendMessage() {
const userInput = document.getElementById('user-input').value;
if (!userInput) return;
// Display user's message
const chatBox = document.getElementById('chat-box');
const userMessage = document.createElement('div');
userMessage.className = 'message user';
userMessage.textContent = userInput;
chatBox.appendChild(userMessage);
chatBox.scrollTop = chatBox.scrollHeight;
// Send message to the server
const response = await fetch('http://127.0.0.1:5000/chat', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ message: userInput }),
});
const data = await response.json();
const botMessage = document.createElement('div');
botMessage.className = 'message bot';
botMessage.textContent = data.response;
chatBox.appendChild(botMessage);
chatBox.scrollTop = chatBox.scrollHeight;
// Clear the input
document.getElementById('user-input').value = '';
}
</script>
</body>
</html>