File size: 16,800 Bytes
e55eba5
 
 
 
 
0988607
e7d4ceb
0988607
5af34e1
e55eba5
 
b8c8803
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e55eba5
0c15b5f
 
 
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
 
e6dde18
0c15b5f
62bc6da
 
482da08
 
 
 
8208487
 
e6dde18
0c15b5f
 
 
 
 
 
e6dde18
0c15b5f
 
 
e6dde18
0c15b5f
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
e6dde18
0c15b5f
 
 
 
 
 
e6dde18
0c15b5f
 
 
e6dde18
0c15b5f
 
 
 
 
 
 
 
 
8e81625
e55eba5
e6dde18
e55eba5
 
 
 
e6dde18
 
5af34e1
 
e6dde18
 
 
5af34e1
e6dde18
 
 
5af34e1
 
e6dde18
 
 
 
5af34e1
e6dde18
 
 
 
5af34e1
e6dde18
 
 
5af34e1
e6dde18
 
 
 
0cc72e3
e6dde18
0cc72e3
e6dde18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5af34e1
e6dde18
 
 
 
 
5af34e1
291a848
 
 
 
 
 
 
 
 
 
e6366a7
291a848
 
 
 
 
e6366a7
291a848
 
 
5af34e1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6366a7
 
9dcc472
 
 
 
 
 
 
 
 
 
e6366a7
9dcc472
 
 
e6366a7
9dcc472
 
 
 
 
 
 
 
 
 
457f472
 
 
 
 
8c96dee
 
 
 
7d2f886
 
 
 
 
 
 
 
 
 
8c96dee
e55eba5
 
 
e6dde18
0cc72e3
 
 
68a5462
 
 
 
 
 
 
 
 
 
 
 
 
2f1f969
f54a441
357b77d
e6bc20a
68a5462
875f42d
 
 
 
 
 
 
 
 
 
bb03ceb
e6dde18
 
 
 
 
 
291a848
e6dde18
 
 
0cc72e3
e6dde18
291a848
e6dde18
0cc72e3
e55eba5
0cc72e3
 
 
 
 
 
e55eba5
0cc72e3
 
e55eba5
 
0cc72e3
 
 
 
 
 
 
 
 
 
be06ec3
0cc72e3
 
 
 
 
 
 
9091819
0cc72e3
 
 
 
 
 
 
 
e6dde18
0cc72e3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e6dde18
0cc72e3
 
 
 
 
 
 
 
e55eba5
0cc72e3
 
 
 
 
 
 
 
 
 
 
 
 
e55eba5
e6dde18
0cc72e3
5ba99b7
 
0cc72e3
 
 
 
 
 
a087588
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0cc72e3
 
291a848
e6366a7
 
 
 
 
 
 
 
 
 
 
 
 
2f1f969
67bfed7
2f1f969
5ba99b7
e55eba5
0cc72e3
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="og:image" content="https://cdn.sazumi.moe/file/t1p7od.jpg">
    <meta name="og:description" content="Revolutionize your daily conversations with Lumin AI, a powerful chatbot that helps you with tasks, answers questions, and even generates creative content. From scheduling appointments to writing emails, Lumin AI is your personal assistant in a chat.">
    <link rel="icon" href="https://cdn.sazumi.moe/file/08kry0.webp" type="image/x-icon">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&family=Playfair+Display:wght@700&display=swap" rel="stylesheet">
    <title>LuminAI API Client</title>
    <style>
      .toggle-switch {
      position: absolute;
      top: 10px;
      right: 10px;
      display: flex;
      align-items: center;
    }

    #theme-switch {
      display: none;
    }

    .toggle-container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background-color: #ccc;
      border-radius: 34px;
      width: 60px;
      height: 30px;
      padding: 3px;
      position: relative;
      transition: background-color 0.3s ease;
    }

    .dot {
      background-color: #fff;
      border-radius: 50%;
      width: 24px;
      height: 24px;
      position: absolute;
      top: 3px;
      left: 3px;
      transition: left 0.3s ease;
    }

    .toggle-container .sun,
    .toggle-container .moon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      position: absolute;
      top: 3px;
    }

    .toggle-container .sun {
      left: 3px;
    }

    .toggle-container .moon {
      right: 3px;
    }

    #theme-switch:checked + .toggle-container {
      background-color: #4a90e2;
    }

    #theme-switch:checked + .toggle-container .dot {
      left: calc(100% - 3px - 24px);
    }
        body {
  font-family: 'Roboto', sans-serif;
  background-color: #f5f7fa;
  color: #444;
  margin: 0;
  padding: 0;
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

.container {
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 20px;
}

header {
  background: linear-gradient(90deg, #4a90e2, #007aff);
  color: #fff;
  padding: 40px 0;
  text-align: center;
  border-bottom: 3px solid #005f9e;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


header h1 {
  margin: 0;
  font-size: 2.5em;
  font-weight: 700;
  font-family: 'Playfair Display', serif;
}

.main {
  margin-top: 20px;
}

h2, h3 {
  color: #4a90e2;
  font-weight: 500;
}

.code-block {
  background: #eef7ff;
  padding: 15px;
  border-left: 5px solid #4a90e2;
  margin: 20px 0;
  position: relative;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.9em;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

.copy-btn img {
  width: 24px;
  height: 24px;
}

.stats-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 40px;
}

.stat-box {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

.stat-box:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.stat-box h3 {
  margin: 0;
  font-size: 1.2em;
  color: #4a90e2;
  font-weight: 500;
}

.stat-box p {
  margin: 10px 0 0;
  font-size: 2.5em;
  font-weight: bold;
  color: #333;
}

.stat-box.full-width {
  grid-column: span 2;
}

footer {
  background: linear-gradient(90deg, #4a90e2, #007aff);
  color: #fff;
  text-align: center;
  padding: 20px 0;
  position: relative;
  bottom: 0;
  width: 100%;
  margin-top: 40px
            box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        }

        footer p {
            margin: 0;
            font-size: 0.9em;
        }

        .dark-mode {
            background-color: #1c1c1c;
            color: #cfcfcf;
        }

        .dark-mode header {
            background: linear-gradient(90deg, #333, #444);
        }

        .dark-mode .code-block {
            background: #2b2b2b;
            border-left-color: #4a90e2;
            color: #ccc;
        }

        .dark-mode .stat-box {
            background: #2b2b2b;
            color: #ccc;
        }

        .dark-mode footer {
            background: linear-gradient(90deg, #333, #444);
        }

        .dark-mode h2, .dark-mode h3 {
            color: #4a90e2;
        }

        .toggle-switch {
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 20px 0;
        }

        .toggle-switch input {
            display: none;
        }

        .toggle-switch label {
            background-color: #ccc;
            border-radius: 34px;
            cursor: pointer;
            display: inline-block;
            height: 26px;
            position: relative;
            width: 50px;
        }

        .toggle-switch label:before {
            background-color: #fff;
            border-radius: 50%;
            content: '';
            height: 22px;
            left: 2px;
            position: absolute;
            top: 2px;
            transition: 0.3s;
            width: 22px;
        }

        .toggle-switch input:checked + label {
            background-color: #4a90e2;
        }

        .toggle-switch input:checked + label:before {
            transform: translateX(24px);
        }

        .toggle-switch .sun, .toggle-switch .moon {
            position: absolute;
            width: 22px;
            height: 22px;
            top: 2px;
            transition: 0.3s;
        }

        .toggle-switch .sun {
            left: 2px;
            background: url('https://upload.wikimedia.org/wikipedia/commons/e/e1/Full_Sun_Clipart.svg') no-repeat center;
            background-size: cover;
        }

        .toggle-switch .moon {
            right: 2px;
            background: url('https://upload.wikimedia.org/wikipedia/commons/3/3a/Moon_clipart.svg') no-repeat center;
            background-size: cover;
        }

        .button {
            background-color: #007aff;
            border: none;
            color: white;
            padding: 10px 20px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
            border-radius: 8px;
            transition: background-color 0.3s, transform 0.3s;
        }

        .button:hover {
            background-color: #005bb5;
            transform: translateY(-2px);
        }

        .button:active {
            background-color: #004080;
        }

        /* Added styles for copy button animation */
        .copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    outline: none;
    color: #fff; /* Ganti warna teks */
}

.copy-btn:hover {
    background-color: #007aff; /* Ganti warna latar belakang saat tombol dihover */
}

/* Added styles for copy button animation */
.copy-btn img {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease-in-out;
}

.copy-btn:hover img {
    transform: rotate(360deg);
}

      .stats-container {
            color: #333; /* Darker text color */
        }

        .dark-mode .stats-container .stat-box h3,
.dark-mode .stats-container .stat-box p {
    color: #ccc; /* Lighter text color in dark mode */
}
      .dark-mode .button {
    background-color: #4a90e2; /* Ganti warna latar belakang */
    color: white; /* Ganti warna teks */
    border: 2px solid #4a90e2; /* Ganti warna border */
}

.dark-mode .button:hover {
    background-color: #007aff; /* Ganti warna latar belakang saat tombol dihover */
    border: 2px solid #007aff; /* Ganti warna border saat tombol dihover */
}

    </style>
</head>
<body>
    <header>
        <h1>LuminAI API Client</h1>
    </header>
    <div class="container">
<div class="toggle-switch" style="position: absolute; top: 10px; right: 10px;">
  <input type="checkbox" id="theme-switch">
  <label for="theme-switch" style="display: flex; align-items: center; justify-content: space-between; padding: 2px;">
    <div class="sun">
      <!-- Ganti dengan kode SVG untuk ikon matahari -->
    </div>
    <div class="slider" style="background-color: #ccc; border-radius: 34px; width: 50px; height: 26px; position: relative;">
      <div class="dot" style="background-color: #fff; border-radius: 50%; width: 22px; height: 22px; position: absolute; top: 2px; left: 2px; transition: 0.3s;"></div>
    </div>
    <div class="moon">
      <!-- Ganti dengan kode SVG untuk ikon bulan -->
    </div>
  </label>
</div>




<script>
  document.getElementById('theme-switch').addEventListener('change', function() {
    var dot = document.querySelector('.dot');
    if (this.checked) {
      dot.style.transform = 'translateX(24px)';
    } else {
      dot.style.transform = 'translateX(0)';
    }
  });
</script>

        <div class="main">
            <h2>Introduction</h2>
            <p>This document provides a simple JavaScript client for interacting with the LuminAI API. The client allows you to send requests with various parameters and receive results from the API.</p>
            <h2>Installation</h2>
            <p>First, make sure you have Node.js installed. Then, install the necessary dependencies:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>npm install axios</code></pre>
            </div>
            <h2>Usage</h2>
            <p>Create a file named <code>lumin.js</code> with the following content:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const axios = require('axios');
async function lumin(q, username = null, logic = null, webSearchMode = false) {
    try {
        const payload = { content: q };
        if (username !== null) payload.user = username;
        if (logic !== null) payload.prompt = logic;
        payload.webSearchMode = webSearchMode;
        const response = await axios.post("https://ilhamdev-luminai.hf.space/", payload);
        return response.data.result;
    } catch (error) {
        console.error('Error fetching:', error);
        throw error;
    }
}
module.exports = { lumin };</code></pre>
            </div>
            <h2>Example Usage</h2>
            <p>Below are some examples of how to use the <code>lumin</code> function.</p>
            <h3>Basic Usage</h3>
            <p>Send a query to the LuminAI API using GET:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const axios = require('axios');
function getLuminaiResponse(q) {
    const url = `https://ilhamdev-luminai.hf.space/api/ai?content=${encodeURIComponent(q)}`;
    return axios.get(url)
        .then(response => response.data)
        .catch(error => {
            console.error(`Error fetching data from ${url}:`, error);
            throw error;
        });
}

// Example usage:
getLuminaiResponse('example query')
    .then(data => {
        console.log('Data:', data);
    })
    .catch(error => {
        console.error('Error:', error);
    });</code></pre>
            </div>
            <p>Send a query to the LuminAI API:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const { lumin } = require('./lumin');
lumin("query")
    .then(result => console.log(result))
    .catch(error => console.error(error));</code></pre>
            </div>
            <h3>Usage with Query and Username</h3>
            <p>Send a query along with a username:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const { lumin } = require('./lumin');
lumin("query", "username")
    .then(result => console.log(result))
    .catch(error => console.error(error));</code></pre>
            </div>
            <h3>Usage with Query, Username, and Logic</h3>
            <p>Send a query with a username and additional logic:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const { lumin } = require('./lumin');
lumin("query", "username", "logic")
    .then(result => console.log(result))
    .catch(error => console.error(error));</code></pre>
            </div>
            <h3>Usage with Query, Username, Logic, and Web Search Mode</h3>
            <p>Send a query with a username, additional logic, and enable web search mode:</p>
            <div class="code-block">
                <button class="copy-btn" onclick="copyToClipboard(this)"><img src="https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png" alt="Copy"></button>
                <pre><code>const { lumin } = require('./lumin');
lumin("query", "username", "logic", true)
    .then(result => console.log(result))
    .catch(error => console.error(error));</code></pre>
            </div>
            <h2>Closing</h2>
            <p>Thank you to everyone who has used LuminAI. We hope this API will continue to provide positive impacts to its users.</p>
            <h2>Special Thanks</h2>
            <p>This API leverages the Blackbox.ai platform. We extend our deepest gratitude to the Blackbox.ai team for their incredible work.</p>
            <div class="stats-container">
                <div class="stat-box">
                    <h3>Rps</h3>
                    <p id="rps">0</p>
                </div>
                <div class="stat-box">
                    <h3>Total Requests</h3>
                    <p id="total-requests">0</p>
                </div>
    </div>
    <footer>
        <p>LuminAI API Client &copy; 2024</p>
    </footer>
    <script>
        const themeSwitch = document.getElementById('theme-switch');
        themeSwitch.addEventListener('change', () => {
            document.body.classList.toggle('dark-mode', themeSwitch.checked);
        });

        async function fetchStats() {
    // Restore dark mode preference from local storage
    const isDarkMode = localStorage.getItem('darkMode') === 'true';
    document.body.classList.toggle('dark-mode', isDarkMode);
    themeSwitch.checked = isDarkMode;

    const response = await fetch('/api/stats');
    const data = await response.json();
    document.getElementById('rps').textContent = data.rps;
    document.getElementById('total-requests').textContent = data.totalRequests;
}

// Update dark mode preference when theme switch is toggled
themeSwitch.addEventListener('change', () => {
    const isDarkMode = themeSwitch.checked;
    document.body.classList.toggle('dark-mode', isDarkMode);
    localStorage.setItem('darkMode', isDarkMode);
});

        fetchStats();

        function copyToClipboard(button) {
            const codeBlock = button.nextElementSibling.innerText;
            navigator.clipboard.writeText(codeBlock).then(() => {
                button.querySelector('img').src = 'https://cdn.iconscout.com/icon/free/png-256/check-1781599-1518574.png';
                button.style.transform = 'scale(1.2)'; // Add a scale transform
                button.style.transition = 'transform 0.3s ease'; // Add a smooth transition
                setTimeout(() => {
                    button.querySelector('img').src = 'https://cdn.iconscout.com/icon/free/png-256/copy-1781607-1518582.png';
                    button.style.transform = 'scale(1)'; // Reset the transform
                }, 2000);
            }).catch(err => {
                console.error('Failed to copy: ', err);
            });
        }


      
    </script>
</body>
</html>