KRAbbzunlocks commited on
Commit
1e90aee
·
verified ·
1 Parent(s): 06ccb63

MAKE ALL BUTTON RESPONSIVE - Initial Deployment

Browse files
Files changed (2) hide show
  1. README.md +7 -5
  2. index.html +955 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Challenger
3
- emoji: 😻
4
- colorFrom: indigo
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: challenger
3
+ emoji: 🐳
4
+ colorFrom: green
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,955 @@
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
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Expert AI Agent</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ :root {
11
+ --bg-color: #f3f4f6;
12
+ --text-color: #111827;
13
+ --header-bg: linear-gradient(to right, #2563eb, #4f46e5);
14
+ --card-bg: #ffffff;
15
+ --input-bg: #ffffff;
16
+ --border-color: #e5e7eb;
17
+ }
18
+
19
+ .dark-mode {
20
+ --bg-color: #1f2937;
21
+ --text-color: #f3f4f6;
22
+ --header-bg: linear-gradient(to right, #1e40af, #3730a3);
23
+ --card-bg: #374151;
24
+ --input-bg: #4b5563;
25
+ --border-color: #4b5563;
26
+ }
27
+
28
+ body {
29
+ background-color: var(--bg-color);
30
+ color: var(--text-color);
31
+ transition: background-color 0.3s, color 0.3s;
32
+ }
33
+
34
+ .chat-container {
35
+ height: calc(100vh - 200px);
36
+ }
37
+ @media (max-width: 768px) {
38
+ .chat-container {
39
+ height: calc(100vh - 250px);
40
+ }
41
+ }
42
+ .typing-indicator:after {
43
+ content: '...';
44
+ animation: typing 1.5s infinite;
45
+ }
46
+ @keyframes typing {
47
+ 0% { content: '.'; }
48
+ 33% { content: '..'; }
49
+ 66% { content: '...'; }
50
+ }
51
+ .citation-tooltip {
52
+ display: none;
53
+ position: absolute;
54
+ background-color: #1f2937;
55
+ color: white;
56
+ padding: 8px;
57
+ border-radius: 4px;
58
+ z-index: 10;
59
+ width: 300px;
60
+ font-size: 14px;
61
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
62
+ }
63
+ .citation:hover .citation-tooltip {
64
+ display: block;
65
+ }
66
+ </style>
67
+ </head>
68
+ <body class="bg-gray-100">
69
+ <div class="container mx-auto px-4 py-8 max-w-6xl">
70
+ <!-- Header -->
71
+ <header class="bg-gradient-to-r from-blue-600 to-indigo-800 text-white rounded-xl shadow-lg p-6 mb-8" style="background: var(--header-bg);">
72
+ <div class="flex flex-col md:flex-row justify-between items-center">
73
+ <div>
74
+ <h1 class="text-3xl font-bold">Expert AI Agent</h1>
75
+ <p class="mt-2">Professional-grade research and writing assistant</p>
76
+ </div>
77
+ <div class="mt-4 md:mt-0 flex items-center space-x-4">
78
+ <button id="newChatBtn" class="bg-white text-blue-600 px-4 py-2 rounded-lg font-medium hover:bg-gray-100 transition">
79
+ <i class="fas fa-plus mr-2"></i>New Chat
80
+ </button>
81
+ <button id="themeToggleBtn" class="bg-blue-800 text-white px-1 py-2 rounded-lg font-medium hover:bg-blue-900 transition mr-2 flex items-center">
82
+ <span class="px-2 sm:px-3 py-1 rounded-l ${darkMode ? 'bg-blue-700' : 'bg-blue-800'}">
83
+ <i class="fas fa-moon text-sm sm:text-base"></i>
84
+ </span>
85
+ <span class="px-2 sm:px-3 py-1 rounded-r ${darkMode ? 'bg-blue-800' : 'bg-blue-700'}">
86
+ <i class="fas fa-sun text-sm sm:text-base"></i>
87
+ </span>
88
+ </button>
89
+ <button id="settingsBtn" class="bg-blue-800 text-white px-4 py-2 rounded-lg font-medium hover:bg-blue-900 transition">
90
+ <i class="fas fa-cog mr-2"></i>Settings
91
+ </button>
92
+ </div>
93
+ </div>
94
+ </header>
95
+
96
+ <!-- Main Content -->
97
+ <div class="flex flex-col lg:flex-row gap-8">
98
+ <!-- Sidebar -->
99
+ <div class="w-full lg:w-1/4 rounded-xl shadow-md p-6" style="background-color: var(--card-bg);">
100
+ <h2 class="text-xl font-bold mb-4 text-gray-800">Profession Selection</h2>
101
+ <div class="mb-6">
102
+ <label for="professionSelect" class="block text-sm font-medium text-gray-700 mb-2">Choose a profession:</label>
103
+ <select id="professionSelect" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
104
+ <option value="">Select a profession...</option>
105
+ <option value="pastor">Pastor/Theologian</option>
106
+ <option value="lawyer">Lawyer</option>
107
+ <option value="doctor">Medical Doctor</option>
108
+ <option value="engineer">Engineer</option>
109
+ <option value="professor">University Professor</option>
110
+ <option value="researcher">Research Scientist</option>
111
+ <option value="psychologist">Psychologist</option>
112
+ <option value="business">Business Consultant</option>
113
+ <option value="architect">Architect</option>
114
+ <option value="accountant">Accountant</option>
115
+ <option value="journalist">Journalist</option>
116
+ <option value="programmer">Software Developer</option>
117
+ <option value="designer">Graphic Designer</option>
118
+ <option value="chef">Chef</option>
119
+ <option value="artist">Artist</option>
120
+ <option value="musician">Musician</option>
121
+ <option value="pilot">Pilot</option>
122
+ <option value="military">Military Officer</option>
123
+ <option value="politician">Politician</option>
124
+ <option value="economist">Economist</option>
125
+ <option value="historian">Historian</option>
126
+ <option value="philosopher">Philosopher</option>
127
+ </select>
128
+ </div>
129
+
130
+
131
+ <div class="mb-6">
132
+ <label for="expertiseLevel" class="block text-sm font-medium text-gray-700 mb-2">Expertise Level:</label>
133
+ <select id="expertiseLevel" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
134
+ <option value="5">Senior Expert (20+ years experience)</option>
135
+ <option value="4">Experienced Professional (10-20 years)</option>
136
+ <option value="3">Mid-career (5-10 years)</option>
137
+ <option value="2">Early career (1-5 years)</option>
138
+ <option value="1">Student/Trainee</option>
139
+ </select>
140
+ </div>
141
+
142
+ <div class="mb-6">
143
+ <label class="block text-sm font-medium text-gray-700 mb-2">Document Type:</label>
144
+ <div class="space-y-2">
145
+ <div class="flex items-center">
146
+ <input id="notes" name="documentType" type="radio" class="h-4 w-4 text-blue-600 focus:ring-blue-500" checked>
147
+ <label for="notes" class="ml-3 block text-sm font-medium text-gray-700">Notes</label>
148
+ </div>
149
+ <div class="flex items-center">
150
+ <input id="researchProposal" name="documentType" type="radio" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
151
+ <label for="researchProposal" class="ml-3 block text-sm font-medium text-gray-700">Research Proposal</label>
152
+ </div>
153
+ <div class="flex items-center">
154
+ <input id="dissertation" name="documentType" type="radio" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
155
+ <label for="dissertation" class="ml-3 block text-sm font-medium text-gray-700">Dissertation</label>
156
+ </div>
157
+ <div class="flex items-center">
158
+ <input id="article" name="documentType" type="radio" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
159
+ <label for="article" class="ml-3 block text-sm font-medium text-gray-700">Article/Paper</label>
160
+ </div>
161
+ </div>
162
+ </div>
163
+
164
+ <div class="mb-6">
165
+ <label for="citationStyle" class="block text-sm font-medium text-gray-700 mb-2">Citation Style:</label>
166
+ <select id="citationStyle" class="w-full p-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
167
+ <option value="apa">APA</option>
168
+ <option value="mla">MLA</option>
169
+ <option value="chicago">Chicago</option>
170
+ <option value="harvard">Harvard</option>
171
+ <option value="ieee">IEEE</option>
172
+ </select>
173
+ </div>
174
+
175
+ <div class="mb-6">
176
+ <label class="block text-sm font-medium text-gray-700 mb-2">AI API Configuration</label>
177
+ <select id="apiProvider" class="w-full p-3 border border-gray-300 rounded-lg mb-3 focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
178
+ <option value="openai">OpenAI (Free Tier)</option>
179
+ <option value="huggingface">Hugging Face (Free)</option>
180
+ <option value="cohere">Cohere (Free Tier)</option>
181
+ </select>
182
+ <input type="text" id="apiKey" class="w-full p-3 border border-gray-300 rounded-lg mb-3 focus:ring-2 focus:ring-blue-500 focus:border-blue-500" placeholder="API Key (if required)">
183
+
184
+ <label class="block text-sm font-medium text-gray-700 mb-2">AI Detection Bypass:</label>
185
+ <div class="flex items-center">
186
+ <input id="aiBypassToggle" type="checkbox" class="h-4 w-4 text-blue-600 focus:ring-blue-500">
187
+ <label for="aiBypassToggle" class="ml-3 block text-sm font-medium text-gray-700">Humanize content</label>
188
+ </div>
189
+ <p class="mt-1 text-xs text-gray-500">Makes content appear more human-written to detection tools</p>
190
+ </div>
191
+
192
+ <button id="applySettingsBtn" class="w-full bg-blue-600 text-white py-2 sm:py-3 rounded-lg font-medium hover:bg-blue-700 transition flex items-center justify-center text-sm sm:text-base">
193
+ <i class="fas fa-check-circle mr-1 sm:mr-2"></i> Apply Settings
194
+ </button>
195
+ </div>
196
+
197
+ <!-- Chat Area -->
198
+ <div class="w-full lg:w-3/4 rounded-xl shadow-md overflow-hidden" style="background-color: var(--card-bg);">
199
+ <div class="p-6 border-b border-gray-200">
200
+ <div class="flex items-center">
201
+ <div id="currentProfessionBadge" class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full text-sm font-medium hidden">
202
+ <i class="fas fa-user-tie mr-1"></i>
203
+ <span id="professionDisplay"></span>
204
+ </div>
205
+ <div id="currentDocumentBadge" class="bg-green-100 text-green-800 px-3 py-1 rounded-full text-sm font-medium ml-2 hidden">
206
+ <i class="fas fa-file-alt mr-1"></i>
207
+ <span id="documentTypeDisplay"></span>
208
+ </div>
209
+ </div>
210
+ </div>
211
+
212
+ <!-- Chat Messages -->
213
+ <div id="chatMessages" class="chat-container overflow-y-auto p-6 space-y-4">
214
+ <div class="text-center py-10 text-gray-500">
215
+ <i class="fas fa-robot text-4xl mb-4 text-blue-500"></i>
216
+ <h3 class="text-xl font-medium">Select a profession and start your conversation</h3>
217
+ <p class="mt-2">I'll adapt to your selected expertise level and document requirements</p>
218
+ </div>
219
+ </div>
220
+
221
+ <!-- Input Area -->
222
+ <div class="p-6 border-t border-gray-200">
223
+ <div class="flex items-start space-x-4">
224
+ <div class="flex-1">
225
+ <textarea id="userInput" rows="3" class="w-full p-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none" placeholder="Enter your topic or question..." style="background-color: var(--input-bg); border-color: var(--border-color); color: var(--text-color);"></textarea>
226
+ <div class="mt-2 flex justify-between items-center">
227
+ <div class="flex space-x-2">
228
+ <button id="attachFileBtn" class="text-gray-500 hover:text-gray-700">
229
+ <i class="fas fa-paperclip"></i>
230
+ </button>
231
+ <button id="citationBtn" class="text-gray-500 hover:text-gray-700">
232
+ <i class="fas fa-quote-right"></i>
233
+ </button>
234
+ </div>
235
+ <button id="sendBtn" class="bg-blue-600 text-white px-4 sm:px-6 py-2 rounded-lg font-medium hover:bg-blue-700 transition text-sm sm:text-base">
236
+ <i class="fas fa-paper-plane mr-1 sm:mr-2"></i> Send
237
+ </button>
238
+ </div>
239
+ </div>
240
+ </div>
241
+ </div>
242
+ </div>
243
+ </div>
244
+
245
+ <!-- Document Tools Modal -->
246
+ <div id="documentToolsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50">
247
+ <div class="bg-white rounded-xl p-6 w-full max-w-3xl max-h-[90vh] overflow-y-auto">
248
+ <div class="flex justify-between items-center mb-4">
249
+ <h3 class="text-xl font-bold text-gray-800">Document Tools</h3>
250
+ <button id="closeToolsModalBtn" class="text-gray-500 hover:text-gray-700">
251
+ <i class="fas fa-times"></i>
252
+ </button>
253
+ </div>
254
+
255
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
256
+ <div class="bg-gray-50 p-4 rounded-lg">
257
+ <h4 class="font-medium text-gray-800 mb-3">Edit Current Document</h4>
258
+ <div class="space-y-3">
259
+ <button id="editContentBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded text-sm sm:text-base">
260
+ <i class="fas fa-edit text-blue-500 mr-1 sm:mr-2"></i> Edit Content
261
+ </button>
262
+ <button id="addSectionBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded">
263
+ <i class="fas fa-plus-circle text-green-500 mr-2"></i> Add Section
264
+ </button>
265
+ <button id="rephraseBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded">
266
+ <i class="fas fa-paragraph text-purple-500 mr-2"></i> Rephrase Section
267
+ </button>
268
+ </div>
269
+ </div>
270
+
271
+ <div class="bg-gray-50 p-4 rounded-lg">
272
+ <h4 class="font-medium text-gray-800 mb-3">Export Options</h4>
273
+ <div class="space-y-3">
274
+ <button id="exportWordBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded text-sm sm:text-base">
275
+ <i class="fas fa-file-word text-blue-600 mr-1 sm:mr-2"></i> Export as Word
276
+ </button>
277
+ <button id="exportPDFBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded">
278
+ <i class="fas fa-file-pdf text-red-500 mr-2"></i> Export as PDF
279
+ </button>
280
+ <button id="exportMarkdownBtn" class="w-full text-left p-2 hover:bg-gray-100 rounded">
281
+ <i class="fab fa-markdown text-gray-700 mr-2"></i> Export as Markdown
282
+ </button>
283
+ </div>
284
+ </div>
285
+
286
+ <div class="bg-gray-50 p-4 rounded-lg md:col-span-2">
287
+ <h4 class="font-medium text-gray-800 mb-3">Research Tools</h4>
288
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-3">
289
+ <button id="findSourcesBtn" class="text-left p-2 hover:bg-gray-100 rounded text-sm sm:text-base">
290
+ <i class="fas fa-search text-indigo-500 mr-1 sm:mr-2"></i> Find Academic Sources
291
+ </button>
292
+ <button id="generateCitationsBtn" class="text-left p-2 hover:bg-gray-100 rounded">
293
+ <i class="fas fa-book text-green-500 mr-2"></i> Generate Bibliography
294
+ </button>
295
+ <button id="checkPlagiarismBtn" class="text-left p-2 hover:bg-gray-100 rounded">
296
+ <i class="fas fa-copy text-yellow-500 mr-2"></i> Check for Plagiarism
297
+ </button>
298
+ <button id="summarizeBtn" class="text-left p-2 hover:bg-gray-100 rounded">
299
+ <i class="fas fa-compress-alt text-blue-400 mr-2"></i> Summarize Content
300
+ </button>
301
+ <button id="generateCodeNotesBtn" class="text-left p-2 hover:bg-gray-100 rounded">
302
+ <i class="fas fa-code text-purple-500 mr-2"></i> Generate Code Notes
303
+ </button>
304
+ </div>
305
+ </div>
306
+ </div>
307
+ </div>
308
+ </div>
309
+ </div>
310
+
311
+ <script>
312
+ document.addEventListener('DOMContentLoaded', function() {
313
+ // DOM Elements
314
+ const themeToggleBtn = document.getElementById('themeToggleBtn');
315
+ const professionSelect = document.getElementById('professionSelect');
316
+ const customProfessionContainer = document.getElementById('customProfessionContainer');
317
+ const customProfession = document.getElementById('customProfession');
318
+ const applySettingsBtn = document.getElementById('applySettingsBtn');
319
+ const chatMessages = document.getElementById('chatMessages');
320
+ const userInput = document.getElementById('userInput');
321
+ const sendBtn = document.getElementById('sendBtn');
322
+ const newChatBtn = document.getElementById('newChatBtn');
323
+ const currentProfessionBadge = document.getElementById('currentProfessionBadge');
324
+ const professionDisplay = document.getElementById('professionDisplay');
325
+ const currentDocumentBadge = document.getElementById('currentDocumentBadge');
326
+ const documentTypeDisplay = document.getElementById('documentTypeDisplay');
327
+ const documentToolsModal = document.getElementById('documentToolsModal');
328
+ const closeToolsModalBtn = document.getElementById('closeToolsModalBtn');
329
+ const citationBtn = document.getElementById('citationBtn');
330
+
331
+ // Variables to store current settings
332
+ let currentProfession = '';
333
+ let currentExpertiseLevel = '5';
334
+ let currentDocumentType = 'notes';
335
+ let currentCitationStyle = 'apa';
336
+ let bypassAI = false;
337
+ let apiProvider = 'openai';
338
+ let apiKey = '';
339
+
340
+ // Theme Management
341
+ let darkMode = localStorage.getItem('darkMode') === 'true';
342
+ updateTheme();
343
+
344
+ // Event Listeners
345
+ themeToggleBtn.addEventListener('click', toggleTheme);
346
+ professionSelect.addEventListener('change', function() {
347
+ if (this.value === 'custom') {
348
+ customProfessionContainer.classList.remove('hidden');
349
+ } else {
350
+ customProfessionContainer.classList.add('hidden');
351
+ }
352
+ });
353
+
354
+ applySettingsBtn.addEventListener('click', applySettings);
355
+ sendBtn.addEventListener('click', sendMessage);
356
+ userInput.addEventListener('keypress', function(e) {
357
+ if (e.key === 'Enter' && !e.shiftKey) {
358
+ e.preventDefault();
359
+ sendMessage();
360
+ }
361
+ });
362
+
363
+ newChatBtn.addEventListener('click', startNewChat);
364
+ citationBtn.addEventListener('click', toggleDocumentTools);
365
+ closeToolsModalBtn.addEventListener('click', toggleDocumentTools);
366
+
367
+ // Radio buttons for document type
368
+ document.querySelectorAll('input[name="documentType"]').forEach(radio => {
369
+ radio.addEventListener('change', function() {
370
+ currentDocumentType = this.id;
371
+ });
372
+ });
373
+
374
+ // Citation style select
375
+ document.getElementById('citationStyle').addEventListener('change', function() {
376
+ currentCitationStyle = this.value;
377
+ });
378
+
379
+ // Expertise level select
380
+ document.getElementById('expertiseLevel').addEventListener('change', function() {
381
+ currentExpertiseLevel = this.value;
382
+ });
383
+
384
+ // API configuration
385
+ document.getElementById('apiProvider').addEventListener('change', function() {
386
+ apiProvider = this.value;
387
+ });
388
+
389
+ document.getElementById('apiKey').addEventListener('input', function() {
390
+ apiKey = this.value.trim();
391
+ });
392
+
393
+ // AI bypass toggle
394
+ document.getElementById('aiBypassToggle').addEventListener('change', function() {
395
+ bypassAI = this.checked;
396
+ });
397
+
398
+ // Functions
399
+ function applySettings() {
400
+ currentProfession = professionSelect.options[professionSelect.selectedIndex].text;
401
+
402
+ // Update UI
403
+ professionDisplay.textContent = currentProfession;
404
+ currentProfessionBadge.classList.remove('hidden');
405
+
406
+ documentTypeDisplay.textContent = document.querySelector('input[name="documentType"]:checked').nextElementSibling.textContent;
407
+ currentDocumentBadge.classList.remove('hidden');
408
+
409
+ // Add welcome message based on profession
410
+ chatMessages.innerHTML = '';
411
+ addBotMessage(getWelcomeMessage(currentProfession, currentExpertiseLevel, currentDocumentType));
412
+ }
413
+
414
+ function getWelcomeMessage(profession, expertiseLevel, docType) {
415
+ const expertiseText = getExpertiseText(expertiseLevel);
416
+ const docTypeText = getDocTypeText(docType);
417
+
418
+ return `Hello! I'm your AI ${profession} assistant with ${expertiseText} experience. I'm currently configured to help you with ${docTypeText}. How can I assist you today?`;
419
+ }
420
+
421
+ function getExpertiseText(level) {
422
+ const levels = {
423
+ '1': 'student/trainee-level',
424
+ '2': '1-5 years',
425
+ '3': '5-10 years',
426
+ '4': '10-20 years',
427
+ '5': '20+ years'
428
+ };
429
+ return levels[level] || 'professional';
430
+ }
431
+
432
+ function getDocTypeText(type) {
433
+ const types = {
434
+ 'notes': 'note-taking',
435
+ 'researchProposal': 'research proposals',
436
+ 'dissertation': 'dissertations',
437
+ 'article': 'academic articles/papers'
438
+ };
439
+ return types[type] || 'your document';
440
+ }
441
+
442
+ function sendMessage() {
443
+ const message = userInput.value.trim();
444
+ if (message === '') return;
445
+
446
+ if (currentProfession === '') {
447
+ alert('Please select a profession first');
448
+ return;
449
+ }
450
+
451
+ // Add user message to chat
452
+ addUserMessage(message);
453
+ userInput.value = '';
454
+
455
+ // Show typing indicator
456
+ const typingId = showTypingIndicator();
457
+
458
+ // Get bot response from API
459
+ try {
460
+ const response = await generateResponse(message, currentProfession, currentExpertiseLevel, currentDocumentType);
461
+ removeTypingIndicator(typingId);
462
+ addBotMessage(response);
463
+ } catch (error) {
464
+ removeTypingIndicator(typingId);
465
+ addBotMessage(`Error: ${error.message}`);
466
+ }
467
+ }
468
+
469
+ async function generateResponse(message, profession, expertiseLevel, docType) {
470
+ // Prepare prompt based on settings
471
+ const prompt = `Act as a ${getExpertiseText(expertiseLevel)} ${profession} helping with ${docType}.
472
+ Respond to: "${message}". Use ${currentCitationStyle} citations if needed.
473
+ ${bypassAI ? 'Make the response sound human-written with natural variations.' : ''}`;
474
+
475
+ try {
476
+ let response;
477
+
478
+ switch(apiProvider) {
479
+ case 'openai':
480
+ response = await callOpenAI(prompt);
481
+ break;
482
+ case 'huggingface':
483
+ response = await callHuggingFace(prompt);
484
+ break;
485
+ case 'cohere':
486
+ response = await callCohere(prompt);
487
+ break;
488
+ default:
489
+ response = "Please select an API provider";
490
+ }
491
+
492
+ return response;
493
+ } catch (error) {
494
+ console.error('API Error:', error);
495
+ return `Sorry, I encountered an error: ${error.message}`;
496
+ }
497
+ }
498
+
499
+ async function callOpenAI(prompt) {
500
+ const response = await fetch('https://api.openai.com/v1/chat/completions', {
501
+ method: 'POST',
502
+ headers: {
503
+ 'Content-Type': 'application/json',
504
+ 'Authorization': `Bearer ${apiKey || 'free-tier-key'}`,
505
+ },
506
+ body: JSON.stringify({
507
+ model: 'gpt-3.5-turbo',
508
+ messages: [{role: 'user', content: prompt}],
509
+ temperature: 0.7,
510
+ }),
511
+ });
512
+
513
+ const data = await response.json();
514
+ return data.choices[0]?.message?.content || "No response from OpenAI";
515
+ }
516
+
517
+ async function callHuggingFace(prompt) {
518
+ const response = await fetch('https://api-inference.huggingface.co/models/facebook/blenderbot-400M-distill', {
519
+ method: 'POST',
520
+ headers: {
521
+ 'Content-Type': 'application/json',
522
+ 'Authorization': `Bearer ${apiKey || 'free-key'}`,
523
+ },
524
+ body: JSON.stringify({inputs: prompt}),
525
+ });
526
+
527
+ const data = await response.json();
528
+ return data.generated_text || "No response from Hugging Face";
529
+ }
530
+
531
+ async function callCohere(prompt) {
532
+ const response = await fetch('https://api.cohere.ai/v1/generate', {
533
+ method: 'POST',
534
+ headers: {
535
+ 'Content-Type': 'application/json',
536
+ 'Authorization': `Bearer ${apiKey || 'free-key'}`,
537
+ 'Cohere-Version': '2022-12-06',
538
+ },
539
+ body: JSON.stringify({
540
+ prompt: prompt,
541
+ max_tokens: 200,
542
+ temperature: 0.7,
543
+ }),
544
+ });
545
+
546
+ const data = await response.json();
547
+ return data.generations[0]?.text || "No response from Cohere";
548
+ }
549
+
550
+ // Humanization techniques
551
+ const humanize = bypassAI ? {
552
+ addTypos: () => Math.random() < 0.05 ? 'teh' : 'the',
553
+ varySentenceLength: (text) => {
554
+ const sentences = text.split('. ');
555
+ return sentences.map(s => {
556
+ if (Math.random() < 0.3) {
557
+ return s + (Math.random() < 0.5 ? '...' : '');
558
+ }
559
+ return s;
560
+ }).join('. ');
561
+ },
562
+ addConversationalElements: (text) => {
563
+ const phrases = ['You know,', 'I mean,', 'Basically,', 'So,', 'Well,'];
564
+ if (Math.random() < 0.4) {
565
+ return phrases[Math.floor(Math.random() * phrases.length)] + ' ' + text;
566
+ }
567
+ return text;
568
+ }
569
+ } : null;
570
+
571
+ const expertise = getExpertiseText(expertiseLevel);
572
+ const isAcademic = ['researchProposal', 'dissertation', 'article'].includes(docType);
573
+
574
+ let response = '';
575
+
576
+ // Profession-specific responses
577
+ if (profession.toLowerCase().includes('pastor') || profession.toLowerCase().includes('theologian')) {
578
+ response = `As a ${expertise} ${profession}, I would approach "${message}" with careful theological consideration. `;
579
+ if (isAcademic) {
580
+ response += `For your ${docType.replace(/([A-Z])/g, ' $1').toLowerCase()}, I recommend examining scriptural foundations in ${getRandomBook()}, alongside contemporary theological perspectives like those from ${getRandomTheologian()}. `;
581
+ response += addCitation();
582
+ } else {
583
+ response += `This topic reminds me of ${getRandomBibleVerse()}, which offers profound insight. `;
584
+ }
585
+ }
586
+ else if (profession.toLowerCase().includes('lawyer')) {
587
+ response = `From my ${expertise} legal perspective as a ${profession}, "${message}" raises several important considerations. `;
588
+ if (isAcademic) {
589
+ response += `For your ${docType.replace(/([A-Z])/g, ' $1').toLowerCase()}, you should review ${getRandomLegalCase()}, which established relevant precedent. `;
590
+ response += addCitation();
591
+ } else {
592
+ response += `You might want to consider the implications of ${getRandomLaw()} in this context. `;
593
+ }
594
+ }
595
+ else {
596
+ // Generic professional response
597
+ response = `As a ${expertise} ${profession}, my analysis of "${message}" leads me to several key observations. `;
598
+ if (isAcademic) {
599
+ response += `For your ${docType.replace(/([A-Z])/g, ' $1').toLowerCase()}, I recommend reviewing the work of ${getRandomResearcher()} in this field. `;
600
+ response += addCitation();
601
+ } else {
602
+ response += `This aligns with current ${profession.toLowerCase()} best practices, particularly regarding ${getRandomTopic()}. `;
603
+ }
604
+ }
605
+
606
+ // Add document-specific guidance
607
+ if (docType === 'researchProposal') {
608
+ response += `\n\nFor a strong research proposal, ensure you include:\n1. Clear research questions\n2. Literature review\n3. Methodology\n4. Expected contributions\n5. Timeline and resources needed`;
609
+ }
610
+ else if (docType === 'dissertation') {
611
+ response += `\n\nFor your dissertation, consider structuring it with:\n1. Introduction (problem statement, objectives)\n2. Literature review\n3. Methodology\n4. Results\n5. Discussion\n6. Conclusion and recommendations`;
612
+ }
613
+
614
+ // Add action items
615
+ response += `\n\nWould you like me to:\n1. Expand on any particular aspect?\n2. Provide references for specific claims?\n3. Help structure this as a formal document?`;
616
+
617
+ // Apply humanization if enabled
618
+ if (humanize) {
619
+ response = humanize.addConversationalElements(response);
620
+ response = humanize.varySentenceLength(response);
621
+ response = response.replace(/ the /g, humanize.addTypos());
622
+ }
623
+
624
+ return response;
625
+ }
626
+
627
+ function addCitation() {
628
+ const authors = [
629
+ 'Smith, J., & Johnson, A. (2022)',
630
+ 'Lee, M. et al. (2021)',
631
+ 'Brown, R., Davis, K., and Wilson, P. (2020)',
632
+ 'Garcia, S. (2019)',
633
+ 'Anderson, L. and White, T. (2018)'
634
+ ];
635
+
636
+ const journals = [
637
+ 'Journal of Professional Studies',
638
+ 'International Review of Applied Research',
639
+ 'Academic Perspectives Quarterly',
640
+ 'Interdisciplinary Research Journal',
641
+ 'Global Studies Review'
642
+ ];
643
+
644
+ const randomAuthor = authors[Math.floor(Math.random() * authors.length)];
645
+ const randomJournal = journals[Math.floor(Math.random() * journals.length)];
646
+ const randomPages = Math.floor(Math.random() * 50) + 1;
647
+ const randomVolume = Math.floor(Math.random() * 20) + 1;
648
+ const randomIssue = Math.floor(Math.random() * 4) + 1;
649
+
650
+ let citation = '';
651
+
652
+ if (currentCitationStyle === 'apa') {
653
+ citation = ` (${randomAuthor.split('(')[0].trim()}, ${randomAuthor.split('(')[1].replace(')', '')})`;
654
+ }
655
+ else if (currentCitationStyle === 'mla') {
656
+ citation = ` (${randomAuthor.split('(')[0].trim()} ${randomAuthor.split('(')[1].replace(')', '')})`;
657
+ }
658
+ else if (currentCitationStyle === 'chicago') {
659
+ citation = ` (${randomAuthor.split('(')[0].trim()} ${randomAuthor.split('(')[1].replace(')', '')})`;
660
+ }
661
+
662
+ // Create a citation element with tooltip
663
+ return `<span class="citation inline-block relative cursor-pointer bg-yellow-100 px-1 rounded">${citation}<span class="citation-tooltip">${randomAuthor}. "${getRandomPaperTitle()}." <em>${randomJournal}</em>, ${randomVolume}(${randomIssue}), ${randomPages}-${randomPages + 5}.</span></span>`;
664
+ }
665
+
666
+ function getRandomBook() {
667
+ const books = ['Genesis', 'Exodus', 'Romans', 'John', 'Psalms', 'Proverbs', 'Isaiah', 'Matthew', 'Hebrews'];
668
+ return books[Math.floor(Math.random() * books.length)];
669
+ }
670
+
671
+ function getRandomTheologian() {
672
+ const theologians = ['Karl Barth', 'Augustine of Hippo', 'Thomas Aquinas', 'John Calvin', 'Martin Luther', 'Dietrich Bonhoeffer', 'C.S. Lewis', 'N.T. Wright'];
673
+ return theologians[Math.floor(Math.random() * theologians.length)];
674
+ }
675
+
676
+ function getRandomBibleVerse() {
677
+ const verses = [
678
+ 'John 3:16 ("For God so loved the world...")',
679
+ 'Romans 8:28 ("And we know that in all things God works for the good...")',
680
+ 'Philippians 4:13 ("I can do all things through Christ who strengthens me.")',
681
+ 'Jeremiah 29:11 ("For I know the plans I have for you...")',
682
+ 'Proverbs 3:5-6 ("Trust in the Lord with all your heart...")'
683
+ ];
684
+ return verses[Math.floor(Math.random() * verses.length)];
685
+ }
686
+
687
+ function getRandomLegalCase() {
688
+ const cases = [
689
+ 'Marbury v. Madison (1803)',
690
+ 'Brown v. Board of Education (1954)',
691
+ 'Roe v. Wade (1973)',
692
+ 'Miranda v. Arizona (1966)',
693
+ 'Citizens United v. FEC (2010)'
694
+ ];
695
+ return cases[Math.floor(Math.random() * cases.length)];
696
+ }
697
+
698
+ function getRandomLaw() {
699
+ const laws = [
700
+ 'the First Amendment',
701
+ 'contract law principles',
702
+ 'tort liability standards',
703
+ 'intellectual property protections',
704
+ 'constitutional due process'
705
+ ];
706
+ return laws[Math.floor(Math.random() * laws.length)];
707
+ }
708
+
709
+ function getRandomResearcher() {
710
+ const researchers = [
711
+ 'Dr. Emily Chen',
712
+ 'Professor James Wilson',
713
+ 'the research team led by Dr. Rodriguez',
714
+ 'the groundbreaking work of Dr. Patel',
715
+ 'the longitudinal studies by Dr. Kim'
716
+ ];
717
+ return researchers[Math.floor(Math.random() * researchers.length)];
718
+ }
719
+
720
+ function getRandomTopic() {
721
+ const topics = [
722
+ 'emerging trends',
723
+ 'industry standards',
724
+ 'ethical considerations',
725
+ 'best practices',
726
+ 'innovative approaches'
727
+ ];
728
+ return topics[Math.floor(Math.random() * topics.length)];
729
+ }
730
+
731
+ function getRandomPaperTitle() {
732
+ const prefixes = [
733
+ 'Exploring the Impact of',
734
+ 'A Comprehensive Review of',
735
+ 'New Perspectives on',
736
+ 'Quantitative Analysis of',
737
+ 'The Role of'
738
+ ];
739
+
740
+ const subjects = [
741
+ 'Contemporary Methodologies',
742
+ 'Cross-Disciplinary Approaches',
743
+ 'Emerging Technologies',
744
+ 'Policy Implications',
745
+ 'Theoretical Frameworks'
746
+ ];
747
+
748
+ return `${prefixes[Math.floor(Math.random() * prefixes.length)]} ${subjects[Math.floor(Math.random() * subjects.length)]}`;
749
+ }
750
+
751
+ function addUserMessage(message) {
752
+ const messageDiv = document.createElement('div');
753
+ messageDiv.className = 'flex justify-end';
754
+ messageDiv.innerHTML = `
755
+ <div class="max-w-[80%] bg-blue-600 text-white p-4 rounded-lg rounded-tr-none">
756
+ <p>${message}</p>
757
+ </div>
758
+ `;
759
+ chatMessages.appendChild(messageDiv);
760
+ chatMessages.scrollTop = chatMessages.scrollHeight;
761
+ }
762
+
763
+ function addBotMessage(message) {
764
+ const messageDiv = document.createElement('div');
765
+ messageDiv.className = 'flex justify-start';
766
+ messageDiv.innerHTML = `
767
+ <div class="max-w-[80%] bg-gray-200 text-gray-800 p-4 rounded-lg rounded-tl-none">
768
+ <div class="flex items-center mb-2">
769
+ <div class="bg-blue-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-2">
770
+ <i class="fas fa-robot"></i>
771
+ </div>
772
+ <span class="font-medium">Expert ${currentProfession}</span>
773
+ </div>
774
+ <div class="prose">${message}</div>
775
+ </div>
776
+ `;
777
+ chatMessages.appendChild(messageDiv);
778
+ chatMessages.scrollTop = chatMessages.scrollHeight;
779
+ }
780
+
781
+ function showTypingIndicator() {
782
+ const typingId = 'typing-' + Date.now();
783
+ const typingDiv = document.createElement('div');
784
+ typingDiv.className = 'flex justify-start';
785
+ typingDiv.id = typingId;
786
+ typingDiv.innerHTML = `
787
+ <div class="max-w-[80%] bg-gray-200 text-gray-800 p-4 rounded-lg rounded-tl-none">
788
+ <div class="flex items-center">
789
+ <div class="bg-blue-500 text-white rounded-full w-8 h-8 flex items-center justify-center mr-2">
790
+ <i class="fas fa-robot"></i>
791
+ </div>
792
+ <span class="typing-indicator">Thinking</span>
793
+ </div>
794
+ </div>
795
+ `;
796
+ chatMessages.appendChild(typingDiv);
797
+ chatMessages.scrollTop = chatMessages.scrollHeight;
798
+ return typingId;
799
+ }
800
+
801
+ function removeTypingIndicator(id) {
802
+ const element = document.getElementById(id);
803
+ if (element) {
804
+ element.remove();
805
+ }
806
+ }
807
+
808
+ function startNewChat() {
809
+ if (confirm('Start a new conversation? Your current chat will be cleared.')) {
810
+ chatMessages.innerHTML = `
811
+ <div class="text-center py-10 text-gray-500">
812
+ <i class="fas fa-robot text-4xl mb-4 text-blue-500"></i>
813
+ <h3 class="text-xl font-medium">Select a profession and start your conversation</h3>
814
+ <p class="mt-2">I'll adapt to your selected expertise level and document requirements</p>
815
+ </div>
816
+ `;
817
+ currentProfession = '';
818
+ currentProfessionBadge.classList.add('hidden');
819
+ currentDocumentBadge.classList.add('hidden');
820
+ }
821
+ }
822
+
823
+ function toggleDocumentTools() {
824
+ documentToolsModal.classList.toggle('hidden');
825
+ }
826
+
827
+ function toggleTheme() {
828
+ darkMode = !darkMode;
829
+ localStorage.setItem('darkMode', darkMode);
830
+ updateTheme();
831
+ }
832
+
833
+ function updateTheme() {
834
+ if (darkMode) {
835
+ document.documentElement.classList.add('dark-mode');
836
+ themeToggleBtn.querySelector('span').classList.add('translate-x-8');
837
+ themeToggleBtn.querySelector('span').classList.remove('translate-x-0');
838
+ } else {
839
+ document.documentElement.classList.remove('dark-mode');
840
+ themeToggleBtn.querySelector('span').classList.add('translate-x-0');
841
+ themeToggleBtn.querySelector('span').classList.remove('translate-x-8');
842
+ }
843
+ }
844
+
845
+ function generateCodeNotes() {
846
+ if (!currentProfession.toLowerCase().includes('programmer') &&
847
+ !currentProfession.toLowerCase().includes('developer') &&
848
+ !currentProfession.toLowerCase().includes('engineer')) {
849
+ addBotMessage("I notice you're not in a technical profession. Would you still like code notes?");
850
+ return;
851
+ }
852
+
853
+ const languages = ['JavaScript', 'Python', 'Java', 'C#', 'PHP', 'Ruby', 'Go'];
854
+ const frameworks = {
855
+ 'JavaScript': ['React', 'Angular', 'Vue', 'Node.js', 'Express'],
856
+ 'Python': ['Django', 'Flask', 'FastAPI'],
857
+ 'Java': ['Spring', 'Hibernate'],
858
+ 'C#': ['.NET', 'ASP.NET'],
859
+ 'PHP': ['Laravel', 'Symfony'],
860
+ 'Ruby': ['Ruby on Rails'],
861
+ 'Go': ['Gin', 'Echo']
862
+ };
863
+
864
+ const selectedLang = languages[Math.floor(Math.random() * languages.length)];
865
+ const selectedFramework = frameworks[selectedLang][Math.floor(Math.random() * frameworks[selectedLang].length)];
866
+
867
+ const note = `
868
+ Here are some professional code notes for ${selectedLang} with ${selectedFramework}:
869
+
870
+ <pre><code class="language-${selectedLang.toLowerCase()}">// ${selectedLang} best practices
871
+ function ${getRandomFunctionName()}(${getRandomParams()}) {
872
+ ${getRandomCodeSnippet(selectedLang)}
873
+ }
874
+
875
+ ${getRandomComment(selectedLang)}
876
+ ${getRandomCodeSnippet(selectedLang)}
877
+ </code></pre>
878
+
879
+ Key points:
880
+ - ${getRandomTip(selectedLang)}
881
+ - ${getRandomTip(selectedLang)}
882
+ - Always ${getRandomBestPractice(selectedLang)}
883
+
884
+ Would you like me to:
885
+ 1. Explain any part in more detail?
886
+ 2. Generate notes for a different language?
887
+ 3. Provide implementation examples?
888
+ `;
889
+
890
+ addBotMessage(note);
891
+ }
892
+
893
+ function getRandomFunctionName() {
894
+ const prefixes = ['handle', 'process', 'calculate', 'generate', 'validate'];
895
+ const suffixes = ['User', 'Data', 'Request', 'Input', 'Result'];
896
+ return prefixes[Math.floor(Math.random() * prefixes.length)] + suffixes[Math.floor(Math.random() * suffixes.length)];
897
+ }
898
+
899
+ function getRandomParams() {
900
+ const params = ['input', 'data', 'options', 'config', 'params'];
901
+ return params.slice(0, Math.floor(Math.random() * params.length) + 1).join(', ');
902
+ }
903
+
904
+ function getRandomCodeSnippet(lang) {
905
+ const snippets = {
906
+ 'JavaScript': [
907
+ 'const result = data.map(item => item * 2);',
908
+ 'return await fetch(url, { method: "POST" });',
909
+ 'if (typeof input !== "string") throw new Error("Invalid input");'
910
+ ],
911
+ 'Python': [
912
+ 'result = [x*2 for x in data if x > 0]',
913
+ 'with open(filename) as f:\n content = f.read()',
914
+ 'return sum(x for x in values if x % 2 == 0)'
915
+ ],
916
+ 'Java': [
917
+ 'List<String> filtered = list.stream().filter(s -> s.length() > 3).collect(Collectors.toList());',
918
+ 'if (input == null) throw new IllegalArgumentException();',
919
+ 'return new ResponseEntity<>(service.getData(), HttpStatus.OK);'
920
+ ]
921
+ };
922
+
923
+ return snippets[lang]?.[Math.floor(Math.random() * snippets[lang]?.length)] || '// Implementation goes here';
924
+ }
925
+
926
+ function getRandomComment(lang) {
927
+ const comments = {
928
+ 'JavaScript': '// This handles the core business logic',
929
+ 'Python': '# Important: This performs data validation',
930
+ 'Java': '/* Cache this result for better performance */'
931
+ };
932
+ return comments[lang] || '// Important implementation note';
933
+ }
934
+
935
+ function getRandomTip(lang) {
936
+ const tips = {
937
+ 'JavaScript': 'Use const/let instead of var for block scoping',
938
+ 'Python': 'Prefer list comprehensions over loops for simple transformations',
939
+ 'Java': 'Use Optional to avoid NullPointerException'
940
+ };
941
+ return tips[lang] || 'Always handle edge cases';
942
+ }
943
+
944
+ function getRandomBestPractice(lang) {
945
+ const practices = {
946
+ 'JavaScript': 'validate input parameters',
947
+ 'Python': 'write docstrings for public functions',
948
+ 'Java': 'follow SOLID principles'
949
+ };
950
+ return practices[lang] || 'write clean, maintainable code';
951
+ }
952
+ });
953
+ </script>
954
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=KRAbbzunlocks/challenger" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
955
+ </html>