Aqcua commited on
Commit
b58742f
·
verified ·
1 Parent(s): a256758

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +596 -17
index.html CHANGED
@@ -1,19 +1,598 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
  <!doctype html>
2
+ <!DOCTYPE html>
3
+ <html lang="en">
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Bigkas Uno - Uncensored AI Chat Platform</title>
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/marked@9.1.2/marked.min.js"></script>
10
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet">
11
+ <script>
12
+ tailwind.config = {
13
+ theme: {
14
+ extend: {
15
+ fontFamily: {
16
+ 'sans': ['Inter', 'system-ui', 'sans-serif'],
17
+ 'brand': ['Orbitron', 'monospace'],
18
+ },
19
+ animation: {
20
+ 'gradient': 'gradient 8s ease infinite',
21
+ 'pulse-slow': 'pulse 3s infinite',
22
+ 'float': 'float 6s ease-in-out infinite',
23
+ 'glow': 'glow 2s ease-in-out infinite alternate',
24
+ },
25
+ keyframes: {
26
+ gradient: {
27
+ '0%, 100%': { 'background-position': '0% 50%' },
28
+ '50%': { 'background-position': '100% 50%' },
29
+ },
30
+ float: {
31
+ '0%, 100%': { transform: 'translateY(0px)' },
32
+ '50%': { transform: 'translateY(-10px)' },
33
+ },
34
+ glow: {
35
+ '0%': { boxShadow: '0 0 20px rgba(93, 92, 222, 0.5)' },
36
+ '100%': { boxShadow: '0 0 30px rgba(147, 51, 234, 0.8)' },
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ </script>
43
+ <style>
44
+ .trinomic-gradient {
45
+ background: linear-gradient(-45deg, #5D5CDE, #9333EA, #EC4899, #F59E0B);
46
+ background-size: 400% 400%;
47
+ }
48
+
49
+ .trinomic-gradient-subtle {
50
+ background: linear-gradient(135deg, rgba(93, 92, 222, 0.1), rgba(147, 51, 234, 0.1), rgba(236, 72, 153, 0.1));
51
+ }
52
+
53
+ .chat-message {
54
+ animation: slideInUp 0.3s ease-out;
55
+ }
56
+
57
+ @keyframes slideInUp {
58
+ from {
59
+ opacity: 0;
60
+ transform: translateY(20px);
61
+ }
62
+ to {
63
+ opacity: 1;
64
+ transform: translateY(0);
65
+ }
66
+ }
67
+
68
+ .typing-indicator {
69
+ display: inline-flex;
70
+ align-items: center;
71
+ }
72
+
73
+ .typing-dot {
74
+ width: 6px;
75
+ height: 6px;
76
+ border-radius: 50%;
77
+ background-color: #9333EA;
78
+ margin: 0 2px;
79
+ animation: typing 1.4s infinite ease-in-out;
80
+ }
81
+
82
+ .typing-dot:nth-child(1) { animation-delay: -0.32s; }
83
+ .typing-dot:nth-child(2) { animation-delay: -0.16s; }
84
+
85
+ @keyframes typing {
86
+ 0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
87
+ 40% { transform: scale(1); opacity: 1; }
88
+ }
89
+
90
+ .message-content pre {
91
+ background: rgba(0, 0, 0, 0.1);
92
+ border-radius: 8px;
93
+ padding: 12px;
94
+ overflow-x: auto;
95
+ margin: 8px 0;
96
+ }
97
+
98
+ .message-content code {
99
+ background: rgba(0, 0, 0, 0.1);
100
+ padding: 2px 6px;
101
+ border-radius: 4px;
102
+ font-family: 'Courier New', monospace;
103
+ }
104
+
105
+ .scrollbar-thin::-webkit-scrollbar {
106
+ width: 6px;
107
+ }
108
+
109
+ .scrollbar-thin::-webkit-scrollbar-track {
110
+ background: rgba(0, 0, 0, 0.1);
111
+ border-radius: 3px;
112
+ }
113
+
114
+ .scrollbar-thin::-webkit-scrollbar-thumb {
115
+ background: linear-gradient(45deg, #5D5CDE, #9333EA);
116
+ border-radius: 3px;
117
+ }
118
+
119
+ .scrollbar-thin::-webkit-scrollbar-thumb:hover {
120
+ background: linear-gradient(45deg, #4C4BCD, #7C2D99);
121
+ }
122
+ </style>
123
+ </head>
124
+ <body class="min-h-screen bg-gray-50 dark:bg-gray-900 font-sans transition-colors duration-300">
125
+ <!-- Background Pattern -->
126
+ <div class="fixed inset-0 opacity-30">
127
+ <div class="absolute inset-0 trinomic-gradient animate-gradient"></div>
128
+ <div class="absolute inset-0 bg-white dark:bg-gray-900"></div>
129
+ </div>
130
+
131
+ <!-- Main Container -->
132
+ <div class="relative z-10 min-h-screen flex flex-col">
133
+ <!-- Header -->
134
+ <header class="bg-white/80 dark:bg-gray-800/80 backdrop-blur-lg border-b border-gray-200 dark:border-gray-700 sticky top-0 z-20">
135
+ <div class="max-w-6xl mx-auto px-4 py-4">
136
+ <div class="flex items-center justify-between">
137
+ <div class="flex items-center space-x-3">
138
+ <div class="w-12 h-12 trinomic-gradient rounded-xl flex items-center justify-center animate-glow">
139
+ <span class="text-white font-brand font-bold text-xl">B</span>
140
+ </div>
141
+ <div>
142
+ <h1 class="text-2xl lg:text-3xl font-brand font-black bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 bg-clip-text text-transparent">
143
+ Bigkas Uno
144
+ </h1>
145
+ <p class="text-sm text-gray-600 dark:text-gray-400">Uncensored AI • Versatile • Transparent</p>
146
+ </div>
147
+ </div>
148
+
149
+ <div class="flex items-center space-x-4">
150
+ <div class="hidden sm:flex items-center space-x-2 text-sm text-gray-600 dark:text-gray-400">
151
+ <div class="w-2 h-2 bg-green-500 rounded-full animate-pulse"></div>
152
+ <span>Model: Uno</span>
153
+ </div>
154
+ <button id="settingsBtn" class="p-2 text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 transition-colors">
155
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
156
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path>
157
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
158
+ </svg>
159
+ </button>
160
+ </div>
161
+ </div>
162
+ </div>
163
+ </header>
164
+
165
+ <!-- Main Chat Area -->
166
+ <main class="flex-1 flex flex-col max-w-6xl mx-auto w-full">
167
+ <!-- Welcome Message -->
168
+ <div id="welcomeMessage" class="text-center py-12 px-4">
169
+ <div class="animate-float">
170
+ <div class="w-24 h-24 trinomic-gradient rounded-full mx-auto mb-6 flex items-center justify-center animate-glow">
171
+ <span class="text-white font-brand font-bold text-4xl">U</span>
172
+ </div>
173
+ </div>
174
+ <h2 class="text-3xl lg:text-4xl font-bold text-gray-800 dark:text-white mb-4">
175
+ Welcome to <span class="font-brand bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 bg-clip-text text-transparent">Bigkas Uno</span>
176
+ </h2>
177
+ <p class="text-lg text-gray-600 dark:text-gray-400 max-w-2xl mx-auto mb-8">
178
+ Experience uncensored AI conversations with Uno, our versatile and transparent AI model.
179
+ Ask anything, explore ideas freely, and get authentic responses without limitations.
180
+ </p>
181
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4 max-w-4xl mx-auto">
182
+ <div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700">
183
+ <div class="w-12 h-12 bg-purple-100 dark:bg-purple-900 rounded-lg flex items-center justify-center mb-4">
184
+ <svg class="w-6 h-6 text-purple-600 dark:text-purple-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
185
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path>
186
+ </svg>
187
+ </div>
188
+ <h3 class="font-semibold text-gray-800 dark:text-white mb-2">Uncensored</h3>
189
+ <p class="text-sm text-gray-600 dark:text-gray-400">No artificial limitations or restrictions on topics</p>
190
+ </div>
191
+ <div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700">
192
+ <div class="w-12 h-12 bg-pink-100 dark:bg-pink-900 rounded-lg flex items-center justify-center mb-4">
193
+ <svg class="w-6 h-6 text-pink-600 dark:text-pink-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
194
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"></path>
195
+ </svg>
196
+ </div>
197
+ <h3 class="font-semibold text-gray-800 dark:text-white mb-2">Versatile</h3>
198
+ <p class="text-sm text-gray-600 dark:text-gray-400">Adaptable to any conversation style or topic</p>
199
+ </div>
200
+ <div class="trinomic-gradient-subtle p-6 rounded-xl border border-gray-200 dark:border-gray-700">
201
+ <div class="w-12 h-12 bg-orange-100 dark:bg-orange-900 rounded-lg flex items-center justify-center mb-4">
202
+ <svg class="w-6 h-6 text-orange-600 dark:text-orange-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
203
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"></path>
204
+ </svg>
205
+ </div>
206
+ <h3 class="font-semibold text-gray-800 dark:text-white mb-2">Transparent</h3>
207
+ <p class="text-sm text-gray-600 dark:text-gray-400">Honest and direct responses without hidden agendas</p>
208
+ </div>
209
+ </div>
210
+ </div>
211
+
212
+ <!-- Chat Messages Container -->
213
+ <div id="messagesContainer" class="flex-1 px-4 pb-4 hidden">
214
+ <div id="messagesList" class="space-y-4 max-h-[60vh] overflow-y-auto scrollbar-thin pr-2">
215
+ <!-- Messages will be added here dynamically -->
216
+ </div>
217
+ </div>
218
+
219
+ <!-- Typing Indicator -->
220
+ <div id="typingIndicator" class="hidden px-4 pb-4">
221
+ <div class="flex items-start space-x-3">
222
+ <div class="w-10 h-10 trinomic-gradient rounded-full flex items-center justify-center flex-shrink-0">
223
+ <span class="text-white font-bold text-sm">U</span>
224
+ </div>
225
+ <div class="bg-white dark:bg-gray-800 rounded-2xl px-4 py-3 shadow-lg border border-gray-200 dark:border-gray-700">
226
+ <div class="typing-indicator">
227
+ <div class="typing-dot"></div>
228
+ <div class="typing-dot"></div>
229
+ <div class="typing-dot"></div>
230
+ <span class="ml-2 text-sm text-gray-500 dark:text-gray-400">Uno is thinking...</span>
231
+ </div>
232
+ </div>
233
+ </div>
234
+ </div>
235
+
236
+ <!-- Input Area -->
237
+ <div class="p-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-lg border-t border-gray-200 dark:border-gray-700">
238
+ <div class="max-w-4xl mx-auto">
239
+ <div class="flex items-end space-x-3">
240
+ <div class="flex-1">
241
+ <textarea
242
+ id="messageInput"
243
+ placeholder="Ask Uno anything... (uncensored, no limitations)"
244
+ class="w-full text-base resize-none border border-gray-300 dark:border-gray-600 rounded-xl px-4 py-3 bg-white dark:bg-gray-700 text-gray-900 dark:text-white placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-all duration-200 min-h-[48px] max-h-32 scrollbar-thin"
245
+ rows="1"
246
+ ></textarea>
247
+ </div>
248
+ <button
249
+ id="sendButton"
250
+ class="bg-gradient-to-r from-purple-600 via-pink-600 to-orange-500 text-white p-3 rounded-xl hover:shadow-lg hover:scale-105 transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed disabled:transform-none focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2"
251
+ disabled
252
+ >
253
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
254
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"></path>
255
+ </svg>
256
+ </button>
257
+ </div>
258
+ <div class="flex items-center justify-between mt-2 text-xs text-gray-500 dark:text-gray-400">
259
+ <span>Press Enter to send, Shift+Enter for new line</span>
260
+ <span id="charCount">0</span>
261
+ </div>
262
+ </div>
263
+ </div>
264
+ </main>
265
+ </div>
266
+
267
+ <!-- Settings Modal -->
268
+ <div id="settingsModal" class="hidden fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4">
269
+ <div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-md w-full p-6 border border-gray-200 dark:border-gray-700">
270
+ <div class="flex items-center justify-between mb-6">
271
+ <h3 class="text-xl font-semibold text-gray-800 dark:text-white">Settings</h3>
272
+ <button id="closeSettings" class="text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200">
273
+ <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
274
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
275
+ </svg>
276
+ </button>
277
+ </div>
278
+
279
+ <div class="space-y-4">
280
+ <div>
281
+ <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Temperature</label>
282
+ <input type="range" id="temperatureSlider" min="0" max="1" step="0.1" value="0.7" class="w-full">
283
+ <div class="flex justify-between text-xs text-gray-500 dark:text-gray-400 mt-1">
284
+ <span>Conservative</span>
285
+ <span id="temperatureValue">0.7</span>
286
+ <span>Creative</span>
287
+ </div>
288
+ </div>
289
+
290
+ <div>
291
+ <label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">Max Tokens</label>
292
+ <input type="range" id="maxTokensSlider" min="100" max="4000" step="100" value="1000" class="w-full">
293
+ <div class="flex justify-between text-xs text-gray-500 dark:text-gray-400 mt-1">
294
+ <span>100</span>
295
+ <span id="maxTokensValue">1000</span>
296
+ <span>4000</span>
297
+ </div>
298
+ </div>
299
+
300
+ <div class="pt-4 border-t border-gray-200 dark:border-gray-700">
301
+ <button id="clearChat" class="w-full bg-red-500 text-white py-2 px-4 rounded-lg hover:bg-red-600 transition-colors">
302
+ Clear Chat History
303
+ </button>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ </div>
308
+
309
+ <script>
310
+ // Dark mode detection
311
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
312
+ document.documentElement.classList.add('dark');
313
+ }
314
+ window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
315
+ if (event.matches) {
316
+ document.documentElement.classList.add('dark');
317
+ } else {
318
+ document.documentElement.classList.remove('dark');
319
+ }
320
+ });
321
+
322
+ // Global variables
323
+ const API_KEY = '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';
324
+ const API_URL = 'https://openrouter.ai/api/v1/chat/completions';
325
+ const MODEL = 'cognitivecomputations/dolphin-mistral-24b-venice-edition:free';
326
+
327
+ let conversationHistory = [];
328
+ let isGenerating = false;
329
+ let currentSettings = {
330
+ temperature: 0.7,
331
+ maxTokens: 1000
332
+ };
333
+
334
+ // DOM elements
335
+ const messageInput = document.getElementById('messageInput');
336
+ const sendButton = document.getElementById('sendButton');
337
+ const messagesList = document.getElementById('messagesList');
338
+ const messagesContainer = document.getElementById('messagesContainer');
339
+ const welcomeMessage = document.getElementById('welcomeMessage');
340
+ const typingIndicator = document.getElementById('typingIndicator');
341
+ const charCount = document.getElementById('charCount');
342
+ const settingsBtn = document.getElementById('settingsBtn');
343
+ const settingsModal = document.getElementById('settingsModal');
344
+ const closeSettings = document.getElementById('closeSettings');
345
+ const temperatureSlider = document.getElementById('temperatureSlider');
346
+ const temperatureValue = document.getElementById('temperatureValue');
347
+ const maxTokensSlider = document.getElementById('maxTokensSlider');
348
+ const maxTokensValue = document.getElementById('maxTokensValue');
349
+ const clearChat = document.getElementById('clearChat');
350
+
351
+ // Event listeners
352
+ messageInput.addEventListener('input', handleInputChange);
353
+ messageInput.addEventListener('keypress', handleKeyPress);
354
+ sendButton.addEventListener('click', sendMessage);
355
+ settingsBtn.addEventListener('click', () => settingsModal.classList.remove('hidden'));
356
+ closeSettings.addEventListener('click', () => settingsModal.classList.add('hidden'));
357
+ clearChat.addEventListener('click', clearChatHistory);
358
+
359
+ temperatureSlider.addEventListener('input', (e) => {
360
+ currentSettings.temperature = parseFloat(e.target.value);
361
+ temperatureValue.textContent = e.target.value;
362
+ });
363
+
364
+ maxTokensSlider.addEventListener('input', (e) => {
365
+ currentSettings.maxTokens = parseInt(e.target.value);
366
+ maxTokensValue.textContent = e.target.value;
367
+ });
368
+
369
+ // Click outside modal to close
370
+ settingsModal.addEventListener('click', (e) => {
371
+ if (e.target === settingsModal) {
372
+ settingsModal.classList.add('hidden');
373
+ }
374
+ });
375
+
376
+ function handleInputChange() {
377
+ const value = messageInput.value;
378
+ charCount.textContent = value.length;
379
+ sendButton.disabled = !value.trim() || isGenerating;
380
+
381
+ // Auto-resize textarea
382
+ messageInput.style.height = '48px';
383
+ messageInput.style.height = Math.min(messageInput.scrollHeight, 128) + 'px';
384
+ }
385
+
386
+ function handleKeyPress(e) {
387
+ if (e.key === 'Enter' && !e.shiftKey) {
388
+ e.preventDefault();
389
+ if (!sendButton.disabled) {
390
+ sendMessage();
391
+ }
392
+ }
393
+ }
394
+
395
+ function showCustomAlert(message, type = 'info') {
396
+ const alertDiv = document.createElement('div');
397
+ alertDiv.className = `fixed top-4 right-4 z-50 p-4 rounded-lg shadow-lg max-w-sm ${
398
+ type === 'error' ? 'bg-red-500 text-white' :
399
+ type === 'success' ? 'bg-green-500 text-white' :
400
+ 'bg-blue-500 text-white'
401
+ }`;
402
+ alertDiv.innerHTML = `
403
+ <div class="flex items-center justify-between">
404
+ <span>${message}</span>
405
+ <button onclick="this.parentElement.parentElement.remove()" class="ml-4 text-white hover:text-gray-200">
406
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
407
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path>
408
+ </svg>
409
+ </button>
410
+ </div>
411
+ `;
412
+ document.body.appendChild(alertDiv);
413
+ setTimeout(() => alertDiv.remove(), 5000);
414
+ }
415
+
416
+ function showCustomConfirm(message, onConfirm) {
417
+ const modal = document.createElement('div');
418
+ modal.className = 'fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50';
419
+ modal.innerHTML = `
420
+ <div class="bg-white dark:bg-gray-800 p-6 rounded-lg shadow-lg max-w-sm w-full mx-4">
421
+ <p class="text-gray-700 dark:text-gray-300 mb-4">${message}</p>
422
+ <div class="flex justify-end space-x-3">
423
+ <button class="px-4 py-2 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded" onclick="this.closest('.fixed').remove()">Cancel</button>
424
+ <button class="px-4 py-2 bg-red-500 text-white hover:bg-red-600 rounded" onclick="this.closest('.fixed').remove(); (${onConfirm})()">Confirm</button>
425
+ </div>
426
+ </div>
427
+ `;
428
+ document.body.appendChild(modal);
429
+ }
430
+
431
+ async function sendMessage() {
432
+ const message = messageInput.value.trim();
433
+ if (!message || isGenerating) return;
434
+
435
+ // Hide welcome message and show chat
436
+ welcomeMessage.classList.add('hidden');
437
+ messagesContainer.classList.remove('hidden');
438
+
439
+ // Add user message to chat
440
+ addMessageToChat('user', message);
441
+
442
+ // Clear input and reset
443
+ messageInput.value = '';
444
+ messageInput.style.height = '48px';
445
+ charCount.textContent = '0';
446
+
447
+ // Update UI state
448
+ isGenerating = true;
449
+ sendButton.disabled = true;
450
+ showTypingIndicator();
451
+
452
+ try {
453
+ // Add system message to instruct the model
454
+ const systemMessage = {
455
+ role: "system",
456
+ content: "You are Bigkas Uno, also called 'Uno' for short. You are an uncensored AI assistant designed for versatility and transparency. You should be honest, direct, and helpful without artificial limitations. Respond naturally and authentically to any topic or question while being respectful and informative."
457
+ };
458
+
459
+ // Prepare conversation history
460
+ const messages = [systemMessage, ...conversationHistory, { role: "user", content: message }];
461
+
462
+ const response = await fetch(API_URL, {
463
+ method: "POST",
464
+ headers: {
465
+ "Authorization": `Bearer ${API_KEY}`,
466
+ "HTTP-Referer": window.location.origin,
467
+ "X-Title": "Bigkas Uno - Uncensored AI Chat",
468
+ "Content-Type": "application/json"
469
+ },
470
+ body: JSON.stringify({
471
+ model: MODEL,
472
+ messages: messages,
473
+ temperature: currentSettings.temperature,
474
+ max_tokens: currentSettings.maxTokens,
475
+ stream: true
476
+ })
477
+ });
478
+
479
+ if (!response.ok) {
480
+ throw new Error(`API Error: ${response.status} ${response.statusText}`);
481
+ }
482
+
483
+ hideTypingIndicator();
484
+
485
+ // Create AI message container
486
+ const aiMessageDiv = addMessageToChat('assistant', '');
487
+ const contentDiv = aiMessageDiv.querySelector('.message-content');
488
+
489
+ // Handle streaming response
490
+ const reader = response.body.getReader();
491
+ const decoder = new TextDecoder();
492
+ let fullResponse = '';
493
+
494
+ while (true) {
495
+ const { done, value } = await reader.read();
496
+ if (done) break;
497
+
498
+ const chunk = decoder.decode(value);
499
+ const lines = chunk.split('\n');
500
+
501
+ for (const line of lines) {
502
+ if (line.startsWith('data: ')) {
503
+ const data = line.slice(6);
504
+ if (data === '[DONE]') continue;
505
+
506
+ try {
507
+ const parsed = JSON.parse(data);
508
+ const content = parsed.choices?.[0]?.delta?.content;
509
+ if (content) {
510
+ fullResponse += content;
511
+ contentDiv.innerHTML = marked.parse(fullResponse);
512
+ // Auto-scroll to bottom
513
+ messagesList.scrollTop = messagesList.scrollHeight;
514
+ }
515
+ } catch (e) {
516
+ // Ignore parsing errors for incomplete chunks
517
+ }
518
+ }
519
+ }
520
+ }
521
+
522
+ // Update conversation history
523
+ conversationHistory.push({ role: "user", content: message });
524
+ conversationHistory.push({ role: "assistant", content: fullResponse });
525
+
526
+ // Keep conversation history manageable (last 20 messages)
527
+ if (conversationHistory.length > 20) {
528
+ conversationHistory = conversationHistory.slice(-20);
529
+ }
530
+
531
+ } catch (error) {
532
+ console.error('Error:', error);
533
+ hideTypingIndicator();
534
+ addMessageToChat('assistant', `❌ **Error**: ${error.message}\n\nPlease try again or check your connection.`);
535
+ showCustomAlert('Failed to send message. Please try again.', 'error');
536
+ } finally {
537
+ isGenerating = false;
538
+ sendButton.disabled = false;
539
+ }
540
+ }
541
+
542
+ function addMessageToChat(role, content) {
543
+ const messageDiv = document.createElement('div');
544
+ messageDiv.className = 'chat-message flex items-start space-x-3';
545
+
546
+ const isUser = role === 'user';
547
+ const avatarBg = isUser ? 'bg-gray-400' : 'trinomic-gradient';
548
+ const avatarText = isUser ? 'Y' : 'U';
549
+ const messageBg = isUser ? 'bg-gray-100 dark:bg-gray-700' : 'bg-white dark:bg-gray-800';
550
+ const senderName = isUser ? 'You' : 'Uno';
551
+
552
+ messageDiv.innerHTML = `
553
+ <div class="w-10 h-10 ${avatarBg} rounded-full flex items-center justify-center flex-shrink-0">
554
+ <span class="text-white font-bold text-sm">${avatarText}</span>
555
+ </div>
556
+ <div class="flex-1 min-w-0">
557
+ <div class="flex items-center space-x-2 mb-1">
558
+ <span class="font-semibold text-sm text-gray-700 dark:text-gray-300">${senderName}</span>
559
+ <span class="text-xs text-gray-500 dark:text-gray-400">${new Date().toLocaleTimeString()}</span>
560
+ </div>
561
+ <div class="${messageBg} rounded-2xl px-4 py-3 shadow-sm border border-gray-200 dark:border-gray-600">
562
+ <div class="message-content text-gray-800 dark:text-gray-200">${isUser ? content : marked.parse(content)}</div>
563
+ </div>
564
+ </div>
565
+ `;
566
+
567
+ messagesList.appendChild(messageDiv);
568
+ messagesList.scrollTop = messagesList.scrollHeight;
569
+ return messageDiv;
570
+ }
571
+
572
+ function showTypingIndicator() {
573
+ typingIndicator.classList.remove('hidden');
574
+ messagesList.scrollTop = messagesList.scrollHeight;
575
+ }
576
+
577
+ function hideTypingIndicator() {
578
+ typingIndicator.classList.add('hidden');
579
+ }
580
+
581
+ function clearChatHistory() {
582
+ showCustomConfirm('Are you sure you want to clear all chat history?', () => {
583
+ conversationHistory = [];
584
+ messagesList.innerHTML = '';
585
+ messagesContainer.classList.add('hidden');
586
+ welcomeMessage.classList.remove('hidden');
587
+ showCustomAlert('Chat history cleared successfully.', 'success');
588
+ });
589
+ }
590
+
591
+ // Initialize the application
592
+ document.addEventListener('DOMContentLoaded', () => {
593
+ messageInput.focus();
594
+ showCustomAlert('Welcome to Bigkas Uno! Start chatting with our uncensored AI.', 'success');
595
+ });
596
+ </script>
597
+ </body>
598
  </html>