Skip to content

Commit da9584a

Browse files
committed
transfer search to ai query
1 parent b3e9c11 commit da9584a

File tree

4 files changed

+29
-64
lines changed

4 files changed

+29
-64
lines changed

hugo_stats.json

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
"classes": [
55
"--mount",
66
"--tmpfs",
7-
"-mt-0.5",
87
"-mt-8",
98
"-top-10",
109
"-top-16",
1110
"-v",
1211
"-z-10",
1312
".NET",
1413
"2xl:flex",
15-
":",
1614
"AWS-Route-53",
1715
"Admin-Console",
1816
"After",
@@ -161,7 +159,6 @@
161159
"admonition-tip",
162160
"admonition-title",
163161
"admonition-warning",
164-
"align-middle",
165162
"aspect-video",
166163
"bake-action",
167164
"bg-amber-500",
@@ -170,11 +167,7 @@
170167
"bg-black/100",
171168
"bg-black/50",
172169
"bg-blue",
173-
"bg-blue-300",
174170
"bg-blue-400",
175-
"bg-blue-400/30",
176-
"bg-blue-400/7",
177-
"bg-blue-400/70",
178171
"bg-blue-400/95",
179172
"bg-blue-500",
180173
"bg-gradient-to-br",
@@ -190,18 +183,15 @@
190183
"bg-pattern-purple",
191184
"bg-pattern-verde",
192185
"bg-red-500",
193-
"bg-transparent",
194186
"bg-violet-500",
195187
"bg-white",
196-
"bg-white/10",
197188
"block",
198189
"border",
199190
"border-0",
200191
"border-b",
201192
"border-b-4",
202193
"border-blue",
203194
"border-blue-300",
204-
"border-blue-400",
205195
"border-divider-light",
206196
"border-gray-200",
207197
"border-gray-400",
@@ -210,7 +200,6 @@
210200
"border-l-magenta-light",
211201
"border-none",
212202
"border-transparent",
213-
"border-white",
214203
"bottom-0",
215204
"breadcrumbs",
216205
"build-push-action",
@@ -263,7 +252,6 @@
263252
"dark:hover:bg-blue-500",
264253
"dark:hover:bg-blue-700",
265254
"dark:hover:bg-gray-600",
266-
"dark:hover:bg-gray-800",
267255
"dark:hover:bg-gray-900",
268256
"dark:hover:text-blue",
269257
"dark:outline-gray-800",
@@ -322,7 +310,6 @@
322310
"gap-20",
323311
"gap-3",
324312
"gap-4",
325-
"gap-42",
326313
"gap-8",
327314
"goat",
328315
"grid",
@@ -348,26 +335,20 @@
348335
"highlight",
349336
"hover:bg-blue",
350337
"hover:bg-blue-400",
351-
"hover:bg-blue-400/70",
352-
"hover:bg-blue-400/80",
353338
"hover:bg-blue-400/90",
354339
"hover:bg-blue-500",
355340
"hover:bg-gray-100",
356341
"hover:bg-gray-200",
357342
"hover:bg-gray-50",
358-
"hover:bg-white/20",
359-
"hover:border-blue-400",
360343
"hover:border-white/20",
361344
"hover:dark:bg-blue-500",
362345
"hover:dark:bg-gray-800",
363346
"hover:dark:text-blue-400",
364347
"hover:dark:text-blue-700",
365348
"hover:opacity-90",
366349
"hover:text-blue",
367-
"hover:text-white",
368350
"hover:underline",
369351
"icon-lg",
370-
"icon-m",
371352
"icon-sm",
372353
"icon-svg",
373354
"icon-svg-stroke",
@@ -377,7 +358,6 @@
377358
"inset-0",
378359
"invertible",
379360
"italic",
380-
"items-baseline",
381361
"items-center",
382362
"items-start",
383363
"items-stretch",
@@ -398,20 +378,12 @@
398378
"lg:grid-cols-3",
399379
"lg:grid-cols-4",
400380
"lg:hidden",
401-
"lg:items-center",
402381
"lg:no-underline",
403382
"lg:pb-2",
404383
"lg:scale-100",
405-
"lg:w-[100px]",
406-
"lg:w-[150px]",
407-
"lg:w-[170px]",
408-
"lg:w-[200px]",
409-
"lg:w-[300px]",
410-
"lg:w-[80px]",
411384
"link",
412385
"lntable",
413386
"lntd",
414-
"m:w-[100px]",
415387
"macOS",
416388
"max-h-full",
417389
"max-w-4xl",
@@ -436,20 +408,14 @@
436408
"md:h-[334px]",
437409
"md:h-[calc(100vh-64px)]",
438410
"md:hidden",
439-
"md:items-center",
440411
"md:max-w-[66%]",
441412
"md:scale-100",
442413
"md:sticky",
443414
"md:text-base",
444415
"md:text-sm",
445416
"md:top-16",
446-
"md:w-[100px]",
447-
"md:w-[170px]",
448-
"md:w-[180px]",
449-
"md:w-[200px]",
450417
"md:w-[300px]",
451418
"md:w-[320px]",
452-
"md:w-[50px]",
453419
"md:z-auto",
454420
"min-h-screen",
455421
"min-w-0",
@@ -460,9 +426,6 @@
460426
"ml-3",
461427
"ml-4",
462428
"ml-auto",
463-
"mr-15",
464-
"mr-24",
465-
"mr-4",
466429
"mt-1",
467430
"mt-1.5",
468431
"mt-2",
@@ -499,7 +462,6 @@
499462
"outline-offset-[-1px]",
500463
"overflow-clip",
501464
"overflow-hidden",
502-
"overflow-visible",
503465
"overflow-x-auto",
504466
"overflow-x-hidden",
505467
"overflow-y-auto",
@@ -520,10 +482,7 @@
520482
"pl-3",
521483
"pl-4",
522484
"pl-5",
523-
"place-items-baseline",
524485
"place-items-center",
525-
"place-items-end",
526-
"placeholder:text-white",
527486
"pr-2",
528487
"prose",
529488
"pt-10",
@@ -566,13 +525,9 @@
566525
"shadow-lg",
567526
"shadow-md",
568527
"sm:block",
569-
"sm:flex",
570528
"sm:flex-row",
571529
"sm:hidden",
572530
"sm:items-center",
573-
"sm:w-[100px]",
574-
"sm:w-[80px]",
575-
"sm:w-full",
576531
"space-y-2",
577532
"space-y-4",
578533
"sticky",
@@ -613,45 +568,28 @@
613568
"top-1",
614569
"top-16",
615570
"top-6",
616-
"top-full",
617571
"topbar-button",
618572
"transition",
619573
"transition-colors",
620574
"transition-transform",
621575
"truncate",
622576
"underline-offset-2",
623-
"w-1.5",
624-
"w-100",
625577
"w-2",
626-
"w-3",
627-
"w-30",
628578
"w-32",
629-
"w-35",
630-
"w-3items-center",
631-
"w-40",
632579
"w-5",
633-
"w-50",
634580
"w-65",
635581
"w-8",
636582
"w-[1200px]",
637-
"w-fit",
638583
"w-full",
639-
"w-screen",
640584
"whitespace-nowrap",
641-
"x",
642585
"xl:flex",
643586
"xl:flex-row",
644587
"xl:grid-cols-3",
645588
"xl:grid-cols-4",
646589
"xl:mb-0",
647590
"xl:w-[1200px]",
648-
"xl:w-[300px]",
649-
"xl:w-[340px]",
650-
"xl:w-[350px]",
651-
"xl:w-[400px]",
652591
"youtube-video",
653592
"z-10",
654-
"z-140",
655593
"z-20",
656594
"z-30",
657595
"z-40",

layouts/_default/search.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h1 class="py-4">{{ .Title }}</h1>
1313
placeholder="Search…" tabindex="0" />
1414
<div class="flex min-w-fit flex-grow flex-col items-center">
1515
<p class="mb-1">Not finding what you're looking for? Try</p>
16-
<button class="topbar-button open-kapa-widget bg-blue-400/95 border-blue-300 hover:bg-blue-400/90">
16+
<button onclick="askAI('search-page-input')" class="topbar-button bg-blue-400/95 border-blue-300 hover:bg-blue-400/90">
1717
<span>Ask&nbsp;AI</span>
1818
<span class="icon-svg">
1919
{{ partial "utils/svg.html" "/icons/sparkle.svg" }}

layouts/partials/head.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,33 @@
7676
data-website-id="{{ site.Params.kapa.id }}"
7777
data-modal-open-on-command-k="true"
7878
></script>
79+
<script>
80+
// Define askAI function to work with search-page-input
81+
window.askAI = function(inputId = "search-page-input") {
82+
const searchInput = document.querySelector("#" + inputId);
83+
const query = searchInput ? searchInput.value.trim() : "";
84+
85+
if (query && window.Kapa) {
86+
window.Kapa.open({
87+
mode: "ai",
88+
query: query,
89+
submit: false
90+
});
91+
} else if (window.Kapa) {
92+
window.Kapa.open({
93+
mode: "ai"
94+
});
95+
}
96+
};
97+
98+
// Add event listener for the Ask AI button
99+
document.addEventListener('click', function(event) {
100+
if (event.target.closest('.open-kapa-widget')) {
101+
event.preventDefault();
102+
window.askAI("search-page-input");
103+
}
104+
});
105+
</script>
79106
{{/* preload Roboto Flex as it's a critical font: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload */}}
80107
<link
81108
href="/assets/fonts/RobotoFlex.woff2"

layouts/partials/search-bar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
class="bg-background-light dark:bg-background-dark fixed z-[999] max-w-xl rounded-sm px-6 py-4 shadow-lg"
5656
>
5757
<div id="search-bar-results">
58-
{{- $emptyState := `<div class="p-2 text-gray-500 dark:text-gray-400">Start typing to search or try <button @click="open=false" class="open-kapa-widget link">Ask AI</button></div>` }}
58+
{{- $emptyState := `<div class="p-2 text-gray-500 dark:text-gray-400">Start typing to search or try <button onclick="askAI('search-bar-input')" class="link">Ask AI</button></div>` }}
5959
{{- $emptyState | safe.HTML }}
6060
<!-- results -->
6161
</div>

0 commit comments

Comments
 (0)