-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathai.html
More file actions
177 lines (165 loc) · 5.42 KB
/
ai.html
File metadata and controls
177 lines (165 loc) · 5.42 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>MindMend – AI</title>
<!-- Fonts + styles your project already uses -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;700&family=Inter:wght@400;500;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<style>
.chat-layout {
display: flex;
gap: 16px;
margin-top: 20px;
min-height: 500px; /* larger chat area */
}
#chatHistory {
width: 220px;
border-right: 1px solid #ccc;
padding: 10px;
background: #f9f9f9;
display: flex;
flex-direction: column;
gap: 10px;
overflow-y: auto; /* enable scrollbar */
max-height: 600px; /* fixed height so it scrolls */
}
#chatHistory button {
padding: 8px;
font-weight: bold;
border: none;
border-radius: 6px;
background: #3B2C28;
color: #fff;
cursor: pointer;
}
#chatHistory button:hover {
background: #2a1e1b;
}
.chat-summary {
padding: 6px;
margin-bottom: 4px;
border-radius: 6px;
cursor: pointer;
background: #fff;
border: 1px solid #ddd;
font-size: 14px;
}
.chat-summary:hover {
background: #eee;
}
.chatwrap {
flex: 1;
display: flex;
flex-direction: column;
}
#aiLog {
flex: 1;
overflow-y: auto; /* enable scrollbar */
border: 1px solid #ccc;
border-radius: 6px;
padding: 12px;
margin-bottom: 10px;
background: #fff;
font-size: 16px;
min-height: 400px;
max-height: 600px;
}
.composer {
display: flex;
gap: 8px;
align-items: center;
}
#aiInput {
flex: 1;
padding: 10px;
border: 1px solid #ccc;
border-radius: 6px;
font-size: 16px;
}
.btn {
padding: 8px 12px;
border: none;
border-radius: 6px;
cursor: pointer;
background: #3B2C28;
color: #fff;
font-weight: bold;
}
.btn:hover {
background: #2a1e1b;
}
.muted {
color: #666;
font-style: italic;
}
.chat-summary button {
float: right;
font-size: 14px;
}
.chat-summary button:hover {
color: red;
}
</style>
</head>
<body>
<header>
<div class="container nav">
<div class="brand">MINDMEND</div>
<nav>
<ul>
<li><a href="index.html">HOME</a></li>
<li><a href="ai.html">MINDMEND AI</a></li>
<li><a href="journal.html">JOURNAL</a></li>
<li><a href="counselor.html">COUNSELOR</a></li>
<li><a href="contact.html">CONTACT</a></li>
<li><a href="login.html" id="accountLink">SIGN UP</a></li>
<li><button id="logoutBtn" class="btn" style="display:none">LOG OUT</button></li>
</ul>
</nav>
</div>
<div style="text-align:center;color:#fff;padding:6px 0 14px;opacity:.9">
“EMPOWERING STUDENTS TO EXPRESS, HEAL, AND GROW”
</div>
</header>
<main class="container section">
<h1 style="font-family:Playfair Display,serif;margin-top:0">MindMend AI</h1>
<div class="chat-layout">
<!-- Chat history sidebar -->
<div id="chatHistory">
<button id="newChat">+ New Chat</button>
<!-- Chat summaries will be injected here by ai.js -->
</div>
<!-- Chat window -->
<div class="chatwrap">
<div id="aiLog" aria-live="polite"></div>
<label style="display:flex;gap:8px;align-items:center;margin:10px 0">
<input id="aiConsent" type="checkbox" checked />
<span class="muted">Allow AI to read my recent journals to personalize advice</span>
</label>
<div class="composer">
<input id="aiInput" placeholder="Ask for support…" aria-label="Type your message" />
<button id="aiSend" class="btn" type="button">Send</button>
</div>
</div>
</div>
</main>
<!-- Supabase client FIRST -->
<script type="module">
import { createClient } from "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2/+esm";
window.SUPABASE_URL = "https://pgpxmtkzgifspotnjrpi.supabase.co";
window.SUPABASE_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InBncHhtdGt6Z2lmc3BvdG5qcnBpIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTg4Mzc3MjQsImV4cCI6MjA3NDQxMzcyNH0.me3WRQM5CdGq8bAIRNMsk07lUqxkLUbeIRAgvrc_sYs";
window.supabase = createClient(window.SUPABASE_URL, window.SUPABASE_ANON_KEY);
</script>
<!-- Core (auth/header/guard) -->
<script src="core.js"></script>
<!-- Page script (chat logic) -->
<script src="ai.js"></script>
<script>
(function(){if(!window.chatbase||window.chatbase("getState")!=="initialized"){window.chatbase=(...arguments)=>{if(!window.chatbase.q){window.chatbase.q=[]}window.chatbase.q.push(arguments)};window.chatbase=new Proxy(window.chatbase,{get(target,prop){if(prop==="q"){return target.q}return(...args)=>target(prop,...args)}})}const onLoad=function(){const script=document.createElement("script");script.src="https://www.chatbase.co/embed.min.js";script.id="lm88arw21cRHFouvUtDSU";script.domain="www.chatbase.co";document.body.appendChild(script)};if(document.readyState==="complete"){onLoad()}else{window.addEventListener("load",onLoad)}})();
</script>
</body>
</html>