7
7
< link rel ="stylesheet " href ="styles.css ">
8
8
< link rel ="stylesheet " href ="animations.css ">
9
9
< link rel ="stylesheet " href ="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap ">
10
- < link
11
- rel ="icon "
12
- href ="https://cdn.glitch.global/97a268a4-dfe5-4c65-912a-0b705b326087/44dd4801-0a72-49da-b50d-12b5cdf82783.jpg?v=1725084192807 "
13
- type ="image/x-icon "/>
10
+ < link rel ="icon " href ="https://cdn.glitch.global/97a268a4-dfe5-4c65-912a-0b705b326087/44dd4801-0a72-49da-b50d-12b5cdf82783.jpg?v=1725084192807 " type ="image/x-icon "/>
14
11
</ head >
15
12
< body >
16
- <!-- Chatbox for displaying messages -->
17
13
< div id ="chatbox " class ="chatbox "> </ div >
18
- <!-- Typing indicator -->
19
14
< div id ="typingIndicator " class ="typing-indicator "> Typing...</ div >
20
15
21
- <!-- Input areas -->
22
16
< textarea id ="userMessage " placeholder ="Type your message... "> </ textarea >
23
17
< textarea id ="systemPrompt " placeholder ="System prompt... "> </ textarea >
24
18
25
19
< input type ="number " id ="temperature " placeholder ="Temperature (0.7) " step ="0.1 " min ="0 ">
26
20
< input type ="number " id ="topP " placeholder ="Top P (0.9) " step ="0.1 " min ="0 ">
27
21
< input type ="number " id ="maxTokens " placeholder ="Max Output Tokens (1000) " step ="10 " min ="1 ">
28
22
29
- <!-- API key and model selection -->
30
23
< input type ="text " id ="apiKey " placeholder ="Enter your Gemini API key ">
31
24
< select id ="modelSelect ">
32
25
< option value ="gemini-1.5-flash "> Gemini 1.5 Flash</ option >
33
26
< option value ="gemini-1.5-pro "> Gemini 1.5 Pro</ option >
34
27
< option value ="gemini-1.0-pro "> Gemini 1.0 Pro</ option >
35
28
</ select >
36
29
37
- <!-- Action buttons -->
38
30
< button id ="sendButton "> Send</ button >
39
31
< button id ="exportButton "> Export Chat</ button >
40
32
< input type ="file " id ="importFile " style ="display:none; ">
41
33
< button id ="importButton "> Import Chat</ button >
42
34
< button id ="regenerateButton "> Regenerate Last Message</ button >
43
35
44
- <!-- Safety Level Selection -->
45
36
< div class ="danger-ui ">
46
37
< label for ="safetyLevel "> Safety Level:</ label >
47
38
< select id ="safetyLevel ">
53
44
< div class ="safety-instructions ">
54
45
< p > < strong > Safe:</ strong > No NSFW content is allowed. Suitable for general audiences. (WORKING GET OR CREATE AN RP PROMPT FOR BETTER RESULT)</ p >
55
46
< p > < strong > Normal:</ strong > Only role-playing (RP) responses allowed. No NSFW content and responses should be appropriate for adults. (NOT WORKING YET)</ p >
56
- < p > < strong > Heat:</ strong > NSFW content is more permissive. Use with caution.(NOT WORKING YET) </ p >
47
+ < p > < strong > Heat:</ strong > NSFW content is more permissive. Use with caution.(NOT WORKING YET)</ p >
57
48
< p > < strong > Horny:</ strong > NSFW content is fully allowed. Intended for explicit use. (NOT WORKING YET)</ p >
58
49
</ div >
59
-
60
- <!-- Debug Menu -->
50
+
61
51
< button id ="toggleDebugMenu "> Toggle Debug Menu</ button >
62
52
< div id ="debugMenu " class ="debug-menu ">
63
53
< h3 > Debug Menu</ h3 >
@@ -66,12 +56,10 @@ <h3>Debug Menu</h3>
66
56
< p > < strong > API Response:</ strong > < span id ="debugApiResponse "> N/A</ span > </ p >
67
57
< p > < strong > NSFW Safety Settings:</ strong > </ p >
68
58
< pre id ="debugNsfwSettings "> N/A</ pre >
69
- <!-- Version Badge -->
70
59
< div class ="version-badge "> 0.1</ div >
71
60
</ div >
72
61
</ div >
73
62
74
- <!-- Import modules from CDN -->
75
63
< script type ="module ">
76
64
import { GoogleGenerativeAI } from "https://esm.run/@google/generative-ai";
77
65
import { HarmBlockThreshold, HarmCategory } from "https://esm.run/@google/generative-ai";
@@ -83,7 +71,7 @@ <h3>Debug Menu</h3>
83
71
horny: "You are in 'Horny' mode. NSFW content is fully allowed. Ensure all content aligns with explicit use guidelines."
84
72
};
85
73
86
- let lastMessage = { } ; // Store last user message and system prompt
74
+ let lastMessage = {};
87
75
88
76
async function sendMessage() {
89
77
const userMessage = document.getElementById('userMessage').value.trim();
@@ -105,7 +93,6 @@ <h3>Debug Menu</h3>
105
93
return;
106
94
}
107
95
108
- // Store the last message details
109
96
lastMessage = { userMessage, systemPrompt };
110
97
111
98
const chatbox = document.getElementById('chatbox');
@@ -204,66 +191,4 @@ <h3>Debug Menu</h3>
204
191
} catch (error) {
205
192
console.error('Error:', error);
206
193
typingIndicator.style.display = 'none';
207
- alert ( 'Failed to generate a response. Please try again later.' ) ;
208
-
209
- document . getElementById ( 'debugSafetyLevel' ) . textContent = safetyLevel ;
210
- document . getElementById ( 'debugSystemInstruction' ) . textContent = systemInstruction ;
211
- document . getElementById ( 'debugApiResponse' ) . textContent = 'Error occurred.' ;
212
- document . getElementById ( 'debugNsfwSettings' ) . textContent = JSON . stringify ( safetySettings , null , 2 ) ;
213
- }
214
- }
215
-
216
- async function regenerateMessage ( ) {
217
- if ( lastMessage . userMessage && lastMessage . systemPrompt ) {
218
- console . log ( 'Regenerating message:' , lastMessage ) ;
219
- document . getElementById ( 'userMessage' ) . value = lastMessage . userMessage ;
220
- document . getElementById ( 'systemPrompt' ) . value = lastMessage . systemPrompt ;
221
- await sendMessage ( ) ;
222
- } else {
223
- alert ( 'No previous message to regenerate.' ) ;
224
- }
225
- }
226
-
227
- document . getElementById ( 'sendButton' ) . addEventListener ( 'click' , sendMessage ) ;
228
- document . getElementById ( 'regenerateButton' ) . addEventListener ( 'click' , regenerateMessage ) ;
229
- document . getElementById ( 'toggleDebugMenu' ) . addEventListener ( 'click' , ( ) => {
230
- const debugMenu = document . getElementById ( 'debugMenu' ) ;
231
- debugMenu . classList . toggle ( 'active' ) ;
232
- } ) ;
233
-
234
- // Add Enter key functionality
235
- document . getElementById ( 'userMessage' ) . addEventListener ( 'keydown' , ( event ) => {
236
- if ( event . key === 'Enter' && ! event . shiftKey ) {
237
- event . preventDefault ( ) ; // Prevent adding a new line
238
- sendMessage ( ) ;
239
- }
240
- } ) ;
241
- </ script >
242
-
243
- < script >
244
- document . addEventListener ( 'DOMContentLoaded' , ( ) => {
245
- const versionBadge = document . querySelector ( '.version-badge' ) ;
246
- const debugMenu = document . getElementById ( 'debugMenu' ) ;
247
-
248
- debugMenu . addEventListener ( 'mousemove' , ( event ) => {
249
- const badgeRect = versionBadge . getBoundingClientRect ( ) ;
250
- const mouseX = event . clientX ;
251
- const mouseY = event . clientY ;
252
-
253
- const badgeCenterX = badgeRect . left + badgeRect . width / 2 ;
254
- const badgeCenterY = badgeRect . top + badgeRect . height / 2 ;
255
- const distance = Math . sqrt ( ( mouseX - badgeCenterX ) ** 2 + ( mouseY - badgeCenterY ) ** 2 ) ;
256
-
257
- // Adjust the distance threshold as needed
258
- const threshold = 100 ;
259
-
260
- if ( distance < threshold ) {
261
- versionBadge . classList . add ( 'spin' ) ;
262
- } else {
263
- versionBadge . classList . remove ( 'spin' ) ;
264
- }
265
- } ) ;
266
- } ) ;
267
- </ script >
268
- </ body >
269
- </ html >
194
+ alert('Failed to generate a response. Please try again later
0 commit comments