ai12z 0.0.1-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/cjs/ai12z-chat_3.cjs.entry.js +395 -0
- package/dist/cjs/ai12z-chat_3.cjs.entry.js.map +1 -0
- package/dist/cjs/ai12z-spinner.cjs.entry.js +22 -0
- package/dist/cjs/ai12z-spinner.cjs.entry.js.map +1 -0
- package/dist/cjs/index-6be98462.js +1967 -0
- package/dist/cjs/index-6be98462.js.map +1 -0
- package/dist/cjs/index.cjs.js +4 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/library.cjs.js +25 -0
- package/dist/cjs/library.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +15 -0
- package/dist/collection/components/ai12z-cta/ai12z-cta.css +1 -0
- package/dist/collection/components/ai12z-cta/ai12z-cta.js +340 -0
- package/dist/collection/components/ai12z-cta/ai12z-cta.js.map +1 -0
- package/dist/collection/components/ai12z-cta/components/Chat.js +112 -0
- package/dist/collection/components/ai12z-cta/components/Chat.js.map +1 -0
- package/dist/collection/components/ai12z-cta/components/Form.js +32 -0
- package/dist/collection/components/ai12z-cta/components/Form.js.map +1 -0
- package/dist/collection/components/ai12z-cta/components/SearchResult.js +8 -0
- package/dist/collection/components/ai12z-cta/components/SearchResult.js.map +1 -0
- package/dist/collection/components/ai12z-cta/components/ai12z-chat.css +1 -0
- package/dist/collection/components/input/Input.js +130 -0
- package/dist/collection/components/input/Input.js.map +1 -0
- package/dist/collection/components/input/input.css +1 -0
- package/dist/collection/components/spinner/Spinner.js +44 -0
- package/dist/collection/components/spinner/Spinner.js.map +1 -0
- package/dist/collection/components/spinner/spinner.css +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/utils/utils.js +86 -0
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/collection/utils/utils.spec.js +16 -0
- package/dist/collection/utils/utils.spec.js.map +1 -0
- package/dist/esm/ai12z-chat_3.entry.js +389 -0
- package/dist/esm/ai12z-chat_3.entry.js.map +1 -0
- package/dist/esm/ai12z-spinner.entry.js +18 -0
- package/dist/esm/ai12z-spinner.entry.js.map +1 -0
- package/dist/esm/index-4dc12b55.js +1938 -0
- package/dist/esm/index-4dc12b55.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/library.js +20 -0
- package/dist/esm/library.js.map +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/library/index.esm.js +2 -0
- package/dist/library/index.esm.js.map +1 -0
- package/dist/library/library.esm.js +2 -0
- package/dist/library/library.esm.js.map +1 -0
- package/dist/library/p-65468fcf.entry.js +2 -0
- package/dist/library/p-65468fcf.entry.js.map +1 -0
- package/dist/library/p-b31186dc.js +3 -0
- package/dist/library/p-b31186dc.js.map +1 -0
- package/dist/library/p-f08d8e98.entry.js +2 -0
- package/dist/library/p-f08d8e98.entry.js.map +1 -0
- package/dist/types/components/ai12z-cta/ai12z-cta.d.ts +32 -0
- package/dist/types/components/ai12z-cta/components/Chat.d.ts +14 -0
- package/dist/types/components/ai12z-cta/components/Form.d.ts +1 -0
- package/dist/types/components/ai12z-cta/components/SearchResult.d.ts +1 -0
- package/dist/types/components/input/Input.d.ts +16 -0
- package/dist/types/components/spinner/Spinner.d.ts +4 -0
- package/dist/types/components.d.ts +130 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1681 -0
- package/dist/types/utils/utils.d.ts +5 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +11 -0
- package/package.json +42 -0
- package/readme.md +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6be98462.js');
|
|
6
|
+
|
|
7
|
+
const ai12zChatCss = "/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.absolute{position:absolute}.relative{position:relative}.right-0{right:0}.top-0{top:0}.mt-5{margin-top:1.25rem}.flex{display:flex}.h-16{height:4rem}.h-6{height:1.5rem}.h-8{height:2rem}.max-h-\\[600px\\]{max-height:600px}.w-16{width:4rem}.w-6{width:1.5rem}.w-8{width:2rem}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.items-end{align-items:flex-end}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.overflow-y-auto{overflow-y:auto}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.bg-slate-100{--tw-bg-opacity:1;background-color:rgb(241 245 249/var(--tw-bg-opacity))}.p-4{padding:1rem}.p-5{padding:1.25rem}.pe-10{padding-inline-end:2.5rem}.pr-2{padding-right:.5rem}.ps-20{padding-inline-start:5rem}.leading-7{line-height:1.75rem}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity))}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}";
|
|
8
|
+
|
|
9
|
+
const MyChat = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.feedback = index.createEvent(this, "feedback", 7);
|
|
13
|
+
this.scrollToBottom = () => {
|
|
14
|
+
this.scrollBottom = this.element.shadowRoot.querySelector(".scroll-bottom");
|
|
15
|
+
this.scrollBottom.scrollIntoView({ behavior: "smooth" });
|
|
16
|
+
};
|
|
17
|
+
this.disableFeedback = (id) => {
|
|
18
|
+
const thumbsUp = this.element.shadowRoot.querySelector(`#thumbsUp_${id}`);
|
|
19
|
+
const thumbsDown = this.element.shadowRoot.querySelector(`#thumbsDown_${id}`);
|
|
20
|
+
thumbsUp.classList.add("cursor-not-allowed");
|
|
21
|
+
thumbsUp.setAttribute("disabled", "true");
|
|
22
|
+
thumbsDown.classList.add("cursor-not-allowed");
|
|
23
|
+
thumbsDown.setAttribute("disabled", "true");
|
|
24
|
+
};
|
|
25
|
+
this.thumbsUp = (id) => {
|
|
26
|
+
const thumbsUp = this.element.shadowRoot.querySelector(`#thumbsUp_${id}`);
|
|
27
|
+
thumbsUp.classList.add("text-gray-700");
|
|
28
|
+
this.disableFeedback(id);
|
|
29
|
+
this.feedback.emit({ insightId: id, feedback: 1 });
|
|
30
|
+
};
|
|
31
|
+
this.thumbsDown = (id) => {
|
|
32
|
+
const thumbsDown = this.element.shadowRoot.querySelector(`#thumbsDown_${id}`);
|
|
33
|
+
thumbsDown.classList.add("text-gray-700");
|
|
34
|
+
this.disableFeedback(id);
|
|
35
|
+
this.feedback.emit({ insightId: id, feedback: -1 });
|
|
36
|
+
};
|
|
37
|
+
this.chats = undefined;
|
|
38
|
+
this.scrollBottom = undefined;
|
|
39
|
+
}
|
|
40
|
+
componentDidLoad() {
|
|
41
|
+
this.scrollToBottom();
|
|
42
|
+
}
|
|
43
|
+
componentDidUpdate() {
|
|
44
|
+
this.scrollToBottom();
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
var _a;
|
|
48
|
+
return (index.h("ul", { class: "flex flex-col max-h-[600px] overflow-y-auto mt-5" }, (_a = this.chats) === null || _a === void 0 ? void 0 :
|
|
49
|
+
_a.map(chat => {
|
|
50
|
+
return (index.h("li", { class: {
|
|
51
|
+
"p-4": true,
|
|
52
|
+
"flex": true,
|
|
53
|
+
"justify-start": chat.type === "user",
|
|
54
|
+
"justify-end": chat.type !== "user",
|
|
55
|
+
"pe-10": chat.type === "user",
|
|
56
|
+
"ps-20": chat.type !== "user",
|
|
57
|
+
"text-md": true,
|
|
58
|
+
"text-slate-900": true,
|
|
59
|
+
"relative": true,
|
|
60
|
+
} }, chat.type === "user" && (index.h("div", { class: "flex items-end pr-2" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-8 h-8" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z" })))), index.h("div", { class: "border p-5 bg-slate-100 leading-7 rounded-lg", innerHTML: chat.message }), chat.type !== "user" && (index.h("div", { class: "absolute top-0 right-0 w-16 h-16" }, index.h("button", { id: `thumbsUp_${chat.insightId}`, onClick: () => this.thumbsUp(chat.insightId), class: "text-gray-500" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z" }))), index.h("button", { id: `thumbsDown_${chat.insightId}`, onClick: () => this.thumbsDown(chat.insightId), class: "text-gray-500" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54" })))))));
|
|
61
|
+
}), index.h("div", { class: "scroll-bottom" })));
|
|
62
|
+
}
|
|
63
|
+
get element() { return index.getElement(this); }
|
|
64
|
+
};
|
|
65
|
+
MyChat.style = ai12zChatCss;
|
|
66
|
+
|
|
67
|
+
function getEndpoint(env) {
|
|
68
|
+
switch (env) {
|
|
69
|
+
case "local":
|
|
70
|
+
return `http://127.0.0.1:5000/api`;
|
|
71
|
+
case "dev":
|
|
72
|
+
return `https://dev-api.ai12z.net/api`;
|
|
73
|
+
case "prod":
|
|
74
|
+
return `https://api.ai12z.net/api`;
|
|
75
|
+
default:
|
|
76
|
+
return `https://api.ai12z.net/api`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function apiFetch(url, payload) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
try {
|
|
82
|
+
const meta = {
|
|
83
|
+
origin: (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin,
|
|
84
|
+
title: document === null || document === void 0 ? void 0 : document.title,
|
|
85
|
+
userAgent: navigator === null || navigator === void 0 ? void 0 : navigator.userAgent,
|
|
86
|
+
referrer: document === null || document === void 0 ? void 0 : document.referrer,
|
|
87
|
+
language: navigator === null || navigator === void 0 ? void 0 : navigator.language,
|
|
88
|
+
description: (_b = document.querySelector('meta[name="description"]')) === null || _b === void 0 ? void 0 : _b.getAttribute("content"),
|
|
89
|
+
};
|
|
90
|
+
payload = Object.assign(Object.assign({}, payload), { meta });
|
|
91
|
+
const response = await fetch(url, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: {
|
|
94
|
+
"Content-Type": "application/json",
|
|
95
|
+
},
|
|
96
|
+
body: JSON.stringify(payload),
|
|
97
|
+
});
|
|
98
|
+
if (!response.ok) {
|
|
99
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
100
|
+
}
|
|
101
|
+
const jsonResponse = await response.json();
|
|
102
|
+
return await jsonResponse;
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function search(apiKey, env, terms) {
|
|
109
|
+
if (!terms)
|
|
110
|
+
return [];
|
|
111
|
+
if (!apiKey)
|
|
112
|
+
throw new Error(`Public Key is required. Please provide using attribute "data-key".`);
|
|
113
|
+
const endpoint = `${getEndpoint(env)}/search`;
|
|
114
|
+
const data = {
|
|
115
|
+
apiKey,
|
|
116
|
+
query: terms,
|
|
117
|
+
num_docs: 4,
|
|
118
|
+
};
|
|
119
|
+
return await apiFetch(endpoint, data);
|
|
120
|
+
}
|
|
121
|
+
async function askAI(apiKey, env, question, conversationId) {
|
|
122
|
+
const endpoint = `${getEndpoint(env)}/askai`;
|
|
123
|
+
const data = {
|
|
124
|
+
apiKey,
|
|
125
|
+
query: question,
|
|
126
|
+
conversation_id: conversationId,
|
|
127
|
+
format: "html",
|
|
128
|
+
};
|
|
129
|
+
return await apiFetch(endpoint, data);
|
|
130
|
+
}
|
|
131
|
+
async function sendFeedback(apiKey, env, insightId, feedback) {
|
|
132
|
+
const endpoint = `${getEndpoint(env)}/feedback`;
|
|
133
|
+
const data = {
|
|
134
|
+
apiKey,
|
|
135
|
+
insight_id: insightId,
|
|
136
|
+
feedback,
|
|
137
|
+
};
|
|
138
|
+
return await apiFetch(endpoint, data);
|
|
139
|
+
}
|
|
140
|
+
function debounce(func, timeout = 300) {
|
|
141
|
+
let timer;
|
|
142
|
+
return (...args) => {
|
|
143
|
+
clearTimeout(timer);
|
|
144
|
+
timer = setTimeout(() => {
|
|
145
|
+
func.apply(this, args);
|
|
146
|
+
}, timeout);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function SearchResult(props) {
|
|
151
|
+
const results = props.results;
|
|
152
|
+
return (index.h("div", { class: "results" },
|
|
153
|
+
index.h("ul", { role: "list", class: "divide-y divide-gray-100" }, results === null || results === void 0 ? void 0 : results.map(result => {
|
|
154
|
+
return (index.h("li", { key: result.title, class: "relative py-5 hover:bg-gray-50" },
|
|
155
|
+
index.h("div", { class: "px-4 sm:px-6 lg:px-8" },
|
|
156
|
+
index.h("div", { class: "mx-auto flex max-w-4xl justify-between gap-x-6" },
|
|
157
|
+
index.h("div", { class: "flex min-w-0 gap-x-4" },
|
|
158
|
+
index.h("div", null,
|
|
159
|
+
index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "w-6 h-6" },
|
|
160
|
+
index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5" }))),
|
|
161
|
+
index.h("div", { class: "min-w-0 flex-auto" },
|
|
162
|
+
index.h("p", { class: "text-sm font-semibold leading-6 text-gray-900" },
|
|
163
|
+
index.h("a", { href: result.link },
|
|
164
|
+
index.h("span", { class: "absolute inset-x-0 -top-px bottom-0" }),
|
|
165
|
+
result.title)),
|
|
166
|
+
index.h("p", { class: "mt-1 flex text-xs leading-5 text-gray-500" },
|
|
167
|
+
index.h("a", { href: result.link, class: "relative truncate hover:underline" }, result.description)))),
|
|
168
|
+
index.h("div", { class: "flex shrink-0 items-center gap-x-4" },
|
|
169
|
+
index.h("svg", { class: "h-5 w-5 flex-none text-gray-400", viewBox: "0 0 20 20", fill: "currentColor", "aria-hidden": "true" },
|
|
170
|
+
index.h("path", { "fill-rule": "evenodd", d: "M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z", "clip-rule": "evenodd" })))))));
|
|
171
|
+
}))));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const ai12zCtaCss = "/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.fixed{position:fixed}.flex{display:flex}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-filter{backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}:host{--bg-smoke-light:rgba(0,0,0,.5)}.bg-smoke-light{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:#0003;cursor:auto;display:flex;flex-direction:column;height:100vh;left:0;position:fixed;top:0;transition:opacity .3s ease-in-out;width:100vw;z-index:200}.modal-content{opacity:0;transform:scale(.9);transition:transform .3s ease-in-out,opacity .3s ease-in-out}:host(.show-modal) .bg-smoke-light{opacity:1}:host(.show-modal) .modal-content{opacity:1;transform:scale(1)}.model-wrapper{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);background-color:#0003;cursor:auto;display:flex;flex-direction:column;height:100vh;left:0;padding:1rem;position:fixed;top:0;width:100vw;z-index:200}.static{position:static}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.right-0{right:0}.top-0{top:0}.m-auto{margin:auto}.mb-2{margin-bottom:.5rem}.mt-12{margin-top:3rem}.hidden{display:none}.h-12{height:3rem}.h-6{height:1.5rem}.w-6{width:1.5rem}.w-72{width:18rem}.w-full{width:100%}.max-w-xl{max-width:36rem}.flex-auto{flex:1 1 auto}.flex-none{flex:none}@keyframes ping{75%,to{opacity:0;transform:scale(2)}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.75rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.75rem*var(--tw-space-x-reverse))}.overflow-auto{overflow:auto}.rounded-lg{border-radius:.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.p-10{padding:2.5rem}.p-4{padding:1rem}.p-8{padding:2rem}.px-4{padding-left:1rem;padding-right:1rem}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.font-semibold{font-weight:600}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}.text-slate-700{--tw-text-opacity:1;color:rgb(51 65 85/var(--tw-text-opacity))}.no-underline{text-decoration-line:none}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.shadow,.shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.ring-1{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.ring-slate-900\\/10{--tw-ring-color:rgba(15,23,42,.1)}.hover\\:text-gray-800:hover{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.hover\\:ring-slate-300:hover{--tw-ring-opacity:1;--tw-ring-color:rgb(203 213 225/var(--tw-ring-opacity))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-sky-500:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(14 165 233/var(--tw-ring-opacity))}@media (min-width:640px){.sm\\:flex{display:flex}}@media (prefers-color-scheme:dark){.dark\\:text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity))}.dark\\:text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity))}}.inset-x-0{left:0;right:0}.-top-px{top:-1px}.bottom-0{bottom:0}.mx-auto{margin-left:auto;margin-right:auto}.mt-1{margin-top:.25rem}.h-5{height:1.25rem}.w-5{width:1.25rem}.min-w-0{min-width:0}.max-w-4xl{max-width:56rem}.shrink-0{flex-shrink:0}.justify-between{justify-content:space-between}.gap-x-4{column-gap:1rem}.gap-x-6{column-gap:1.5rem}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.divide-gray-100>:not([hidden])~:not([hidden]){--tw-divide-opacity:1;border-color:rgb(243 244 246/var(--tw-divide-opacity))}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.hover\\:bg-gray-50:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity))}.hover\\:underline:hover{text-decoration-line:underline}@media (min-width:640px){.sm\\:px-6{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width:1024px){.lg\\:px-8{padding-left:2rem;padding-right:2rem}}";
|
|
175
|
+
|
|
176
|
+
const MyModal = class {
|
|
177
|
+
constructor(hostRef) {
|
|
178
|
+
index.registerInstance(this, hostRef);
|
|
179
|
+
this.dirty = false;
|
|
180
|
+
this.isSubmitted = false;
|
|
181
|
+
this.pButtonText = "Ask AI";
|
|
182
|
+
this.handleSubmit = async (event, value, type) => {
|
|
183
|
+
this.dirty = true;
|
|
184
|
+
this.isSubmitted = true;
|
|
185
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
|
186
|
+
this.formData = Object.assign(Object.assign({}, this.formData), { search: value });
|
|
187
|
+
if (!this.formData.search && this.formData.search.length < 3)
|
|
188
|
+
return;
|
|
189
|
+
try {
|
|
190
|
+
let response = null;
|
|
191
|
+
if (type === "ask-ai" || this.isChat) {
|
|
192
|
+
this.isChat = true;
|
|
193
|
+
this.chatHistory.push({
|
|
194
|
+
message: this.formData.search,
|
|
195
|
+
status: "success",
|
|
196
|
+
type: "user",
|
|
197
|
+
});
|
|
198
|
+
this.chatHistory.push({
|
|
199
|
+
message: `<div class="animate-ping">...</div>`,
|
|
200
|
+
type: "ai",
|
|
201
|
+
status: "pending",
|
|
202
|
+
});
|
|
203
|
+
response = await askAI(this.dataKey, this.dataMode, this.formData.search, this.conversationId);
|
|
204
|
+
this.conversationId = response.conversation_Id;
|
|
205
|
+
this.chatHistory.pop();
|
|
206
|
+
const lastMessage = { message: response.answer, type: "ai", status: "success", insightId: response.insight_id };
|
|
207
|
+
this.chatHistory = [...this.chatHistory, lastMessage];
|
|
208
|
+
// this.chatHistory.push({
|
|
209
|
+
// message: response.answer,
|
|
210
|
+
// type: "ai",
|
|
211
|
+
// status: "success",
|
|
212
|
+
// })
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
response = await search(this.dataKey, this.dataMode, this.formData.search);
|
|
216
|
+
this.displaySearchResults(response);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.error(error);
|
|
221
|
+
this.error = error;
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
this.isSubmitted = false;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
this.displaySearchResults = results => {
|
|
228
|
+
this.searchResults = results.docs;
|
|
229
|
+
this.isSubmitted = false;
|
|
230
|
+
};
|
|
231
|
+
this.showModal = false;
|
|
232
|
+
this.formData = { search: "" };
|
|
233
|
+
this.searchResults = [];
|
|
234
|
+
this.error = null;
|
|
235
|
+
this.conversationId = null;
|
|
236
|
+
this.chatHistory = [
|
|
237
|
+
// {
|
|
238
|
+
// message: "Hi, I am AI12z, your AI assistant. How can I help you?",
|
|
239
|
+
// type: "user",
|
|
240
|
+
// status: "pending",
|
|
241
|
+
// },
|
|
242
|
+
// {
|
|
243
|
+
// message: `<div class="animate-ping">...</div>`,
|
|
244
|
+
// type: "ai",
|
|
245
|
+
// status: "pending",
|
|
246
|
+
// },
|
|
247
|
+
];
|
|
248
|
+
this.isChat = false;
|
|
249
|
+
this.heading = undefined;
|
|
250
|
+
this.placeholder = undefined;
|
|
251
|
+
this.dataKey = undefined;
|
|
252
|
+
this.dataMode = undefined;
|
|
253
|
+
this.buttonText = "Ask AI";
|
|
254
|
+
}
|
|
255
|
+
watchButtonText(newValue, oldValue) {
|
|
256
|
+
if (newValue === oldValue) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
this.pButtonText = newValue;
|
|
260
|
+
}
|
|
261
|
+
watchPlaceHolder(newValue, oldValue) {
|
|
262
|
+
if (newValue === oldValue) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.pPlaceholder = newValue;
|
|
266
|
+
}
|
|
267
|
+
async openModal() {
|
|
268
|
+
this.showModal = true;
|
|
269
|
+
this.dirty = false;
|
|
270
|
+
requestAnimationFrame(() => {
|
|
271
|
+
const searchInput = this.el.shadowRoot.querySelector("ai12z-input-form").shadowRoot.querySelector("input");
|
|
272
|
+
searchInput.focus();
|
|
273
|
+
this.el.shadowRoot.querySelector(".modal-wrapper").classList.add("show-modal");
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
async closeModal() {
|
|
277
|
+
this.el.shadowRoot.querySelector(".modal-wrapper").classList.remove("show-modal");
|
|
278
|
+
setTimeout(() => (this.showModal = false), 300); // Assuming 300ms is your transition duration
|
|
279
|
+
}
|
|
280
|
+
handleKeyDown(ev) {
|
|
281
|
+
if (ev.metaKey && ev.key === "k") {
|
|
282
|
+
this.openModal();
|
|
283
|
+
}
|
|
284
|
+
if (ev.key === "Escape") {
|
|
285
|
+
this.closeModal();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
handleOutsideClick(ev) {
|
|
289
|
+
const outsideContent = ev.target.classList.contains("modal-wrapper");
|
|
290
|
+
if (outsideContent) {
|
|
291
|
+
this.closeModal();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// componentWillLoad() {
|
|
295
|
+
// console.log("this.buttonText", this.buttonText)
|
|
296
|
+
// }
|
|
297
|
+
// componentDidLoad() {
|
|
298
|
+
// console.log("Component has been rendered")
|
|
299
|
+
// }
|
|
300
|
+
// componentWillUpdate() {
|
|
301
|
+
// console.log("Component will update and re-render")
|
|
302
|
+
// }
|
|
303
|
+
defaultTemplate() {
|
|
304
|
+
return (index.h("button", { type: "button", class: "hidden sm:flex items-center w-72 text-left space-x-3 px-4 h-12 bg-white ring-1 ring-slate-900/10 hover:ring-slate-300 focus:outline-none focus:ring-2 focus:ring-sky-500 shadow-sm rounded-lg text-slate-400" }, index.h("svg", { width: "24", height: "24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", class: "flex-none text-slate-300 dark:text-slate-400", "aria-hidden": "true" }, index.h("path", { d: "m19 19-3.5-3.5" }), index.h("circle", { cx: "11", cy: "11", r: "6" })), index.h("span", { class: "flex-auto" }, "Quick search..."), index.h("kbd", { class: "font-sans font-semibold dark:text-slate-500" }, index.h("abbr", { title: "Command", class: "no-underline text-slate-300 dark:text-slate-500" }, "\u2318"), "K")));
|
|
305
|
+
}
|
|
306
|
+
displayMessage() {
|
|
307
|
+
var _a;
|
|
308
|
+
let message = null;
|
|
309
|
+
if (this.error) {
|
|
310
|
+
message = index.h("p", { class: "text-red-500" }, "Errored please try again!");
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
if (this.isSubmitted) {
|
|
314
|
+
message = (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor", class: "animate-spin w-6 h-6" }, index.h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" })));
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
if (this.dirty) {
|
|
318
|
+
message = "No results found";
|
|
319
|
+
}
|
|
320
|
+
message = "Enter text to get started";
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (((_a = this.searchResults) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
return index.h("p", { class: "text-center p-10 text-slate-500 flex justify-center" }, message);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
render() {
|
|
331
|
+
const slot = this.el.shadowRoot.host;
|
|
332
|
+
const slotHasContent = slot && slot.children.length > 0;
|
|
333
|
+
return (index.h(index.Host, null, index.h("div", { onClick: () => this.openModal() }, !slotHasContent && this.defaultTemplate(), slotHasContent && index.h("slot", null)), index.h("div", { class: { "modal-wrapper": true, "hidden": !this.showModal, "fixed": true, "inset-0": true, "overflow-auto": true, "bg-smoke-light": true, "flex": true }, onClick: ev => this.handleOutsideClick(ev) }, index.h("div", { class: "model-content relative p-8 bg-white w-full max-w-xl m-auto flex-col rounded-lg shadow-m z-250 mt-12" }, index.h("span", { class: "absolute top-0 right-0 p-4" }, index.h("button", { onClick: () => this.closeModal(), class: "text-black hover:text-gray-800" }, "\u00D7")), index.h("h1", { class: "text-slate-700 text-2xl mb-2" }, this.heading), index.h("ai12z-input-form", { onAction: async (event) => {
|
|
334
|
+
const { value, type } = event.detail;
|
|
335
|
+
await this.handleSubmit(event, value, type);
|
|
336
|
+
}, isChat: this.isChat, placeholder: this.pPlaceholder, buttonText: this.pButtonText }), this.displayMessage(), !this.isChat && index.h(SearchResult, { results: this.searchResults }), this.isChat && (index.h("ai12z-chat", { chats: this.chatHistory, onFeedback: async (event) => {
|
|
337
|
+
const { feedback, insightId } = event.detail;
|
|
338
|
+
sendFeedback(this.dataKey, this.dataMode, insightId, feedback);
|
|
339
|
+
} }))))));
|
|
340
|
+
}
|
|
341
|
+
get el() { return index.getElement(this); }
|
|
342
|
+
static get watchers() { return {
|
|
343
|
+
"buttonText": ["watchButtonText"],
|
|
344
|
+
"placeholder": ["watchPlaceHolder"]
|
|
345
|
+
}; }
|
|
346
|
+
};
|
|
347
|
+
MyModal.style = ai12zCtaCss;
|
|
348
|
+
|
|
349
|
+
const inputCss = "/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.flex,.input-form{display:flex}.input-form{flex-direction:column;margin-bottom:1rem;width:100%}.relative{position:relative}.block{display:block}.flex{display:flex}.w-full{width:100%}.flex-grow{flex-grow:1}.items-center{align-items:center}.items-stretch{align-items:stretch}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.border{border-width:1px}.border-0{border-width:0}.border-l{border-left-width:1px}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity))}.p-3{padding:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.hover\\:bg-indigo-300:hover{--tw-bg-opacity:1;background-color:rgb(165 180 252/var(--tw-bg-opacity))}.hover\\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-0:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}";
|
|
350
|
+
|
|
351
|
+
const InputForm = class {
|
|
352
|
+
constructor(hostRef) {
|
|
353
|
+
index.registerInstance(this, hostRef);
|
|
354
|
+
this.action = index.createEvent(this, "action", 7);
|
|
355
|
+
this.handleInputChange = (e) => {
|
|
356
|
+
this.searchInput = this.searchInputElem.value;
|
|
357
|
+
if (this.isChat) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const value = this.searchInputElem.value;
|
|
361
|
+
if (value.length > 3) {
|
|
362
|
+
this.action.emit({ event: e, value: value, type: "search" });
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
this.handleFormSubmit = (e) => {
|
|
366
|
+
e.preventDefault();
|
|
367
|
+
if (this.searchInput.length > 3) {
|
|
368
|
+
this.action.emit({ event: e, value: this.searchInput, type: "search" });
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
this.handleAskAI = (e) => {
|
|
372
|
+
e.preventDefault();
|
|
373
|
+
this.submitted = true;
|
|
374
|
+
this.action.emit({ event: e, value: this.searchInput, type: "ask-ai" });
|
|
375
|
+
this.submitted = false;
|
|
376
|
+
this.searchInput = "";
|
|
377
|
+
};
|
|
378
|
+
this.isChat = undefined;
|
|
379
|
+
this.placeholder = undefined;
|
|
380
|
+
this.buttonText = undefined;
|
|
381
|
+
this.searchInput = "";
|
|
382
|
+
this.submitted = false;
|
|
383
|
+
}
|
|
384
|
+
render() {
|
|
385
|
+
return (index.h("form", { onSubmit: this.handleFormSubmit }, index.h("div", { ref: el => (this.searchFormElem = el), class: "relative flex items-center rounded rounded-md border border-grey-light items-stretch" }, index.h("div", { class: "flex-grow p-3" }, index.h("input", { readOnly: this.submitted, ref: el => (this.searchInputElem = el), required: true, type: "text", placeholder: this.placeholder, autoComplete: "off", class: "block w-full border-0 focus:ring-0 focus:outline-none", value: this.searchInput, onInput: debounce(e => this.handleInputChange(e), 500), onFocus: () => this.searchFormElem.classList.add("border-blue-500"), onBlur: () => this.searchFormElem.classList.remove("border-blue-500") })), index.h("button", { disabled: this.submitted, onClick: this.handleAskAI, class: "border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white" }, this.buttonText))));
|
|
386
|
+
}
|
|
387
|
+
get el() { return index.getElement(this); }
|
|
388
|
+
};
|
|
389
|
+
InputForm.style = inputCss;
|
|
390
|
+
|
|
391
|
+
exports.ai12z_chat = MyChat;
|
|
392
|
+
exports.ai12z_cta = MyModal;
|
|
393
|
+
exports.ai12z_input_form = InputForm;
|
|
394
|
+
|
|
395
|
+
//# sourceMappingURL=ai12z-chat_3.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ai12z-chat.ai12z-cta.ai12z-input-form.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,YAAY,GAAG,szIAAszI;;MCO9zI,MAAM;;;;QAejB,mBAAc,GAAG;YACf,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAA;YAC3E,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;SACzD,CAAA;QACD,oBAAe,GAAG,CAAC,EAAU;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YACzE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,eAAe,EAAE,EAAE,CAAC,CAAA;YAC7E,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;YAC5C,QAAQ,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;YACzC,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAA;YAC9C,UAAU,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;SAC5C,CAAA;QAED,aAAQ,GAAG,CAAC,EAAU;YACpB,MAAM,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AE,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,GACrE,CACE,EACNA,oBAAQ,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAC,sEAAsE,IACtI,IAAI,CAAC,UAAU,CACT,CACL,CASD,EACR;KACF;;;;;;;;;","names":["h","Host"],"sources":["src/components/ai12z-cta/components/ai12z-chat.css?tag=ai12z-chat&encapsulation=shadow","src/components/ai12z-cta/components/Chat.tsx","src/utils/utils.ts","src/components/ai12z-cta/components/SearchResult.tsx","src/components/ai12z-cta/ai12z-cta.css?tag=ai12z-cta&encapsulation=shadow","src/components/ai12z-cta/ai12z-cta.tsx","src/components/input/input.css?tag=ai12z-input-form&encapsulation=shadow","src/components/input/Input.tsx"],"sourcesContent":["","import { Component, h, Prop, Element, State, Event, EventEmitter } from \"@stencil/core\"\n\n@Component({\n tag: \"ai12z-chat\",\n styleUrl: \"ai12z-chat.css\",\n shadow: true,\n})\nexport class MyChat {\n @Element() private element: HTMLElement\n @Prop() chats: any\n @State() scrollBottom: any\n\n @Event() feedback: EventEmitter\n\n componentDidLoad() {\n this.scrollToBottom()\n }\n\n componentDidUpdate() {\n this.scrollToBottom()\n }\n\n scrollToBottom = () => {\n this.scrollBottom = this.element.shadowRoot.querySelector(\".scroll-bottom\")\n this.scrollBottom.scrollIntoView({ behavior: \"smooth\" })\n }\n disableFeedback = (id: string): void => {\n const thumbsUp = this.element.shadowRoot.querySelector(`#thumbsUp_${id}`)\n const thumbsDown = this.element.shadowRoot.querySelector(`#thumbsDown_${id}`)\n thumbsUp.classList.add(\"cursor-not-allowed\")\n thumbsUp.setAttribute(\"disabled\", \"true\")\n thumbsDown.classList.add(\"cursor-not-allowed\")\n thumbsDown.setAttribute(\"disabled\", \"true\")\n }\n\n thumbsUp = (id: string): void => {\n const thumbsUp = this.element.shadowRoot.querySelector(`#thumbsUp_${id}`)\n thumbsUp.classList.add(\"text-gray-700\")\n this.disableFeedback(id)\n this.feedback.emit({ insightId: id, feedback: 1 })\n }\n\n thumbsDown = (id: string): void => {\n const thumbsDown = this.element.shadowRoot.querySelector(`#thumbsDown_${id}`)\n thumbsDown.classList.add(\"text-gray-700\")\n this.disableFeedback(id)\n this.feedback.emit({ insightId: id, feedback: -1 })\n }\n\n render() {\n return (\n <ul class=\"flex flex-col max-h-[600px] overflow-y-auto mt-5\">\n {this.chats?.map(chat => {\n return (\n <li\n class={{\n \"p-4\": true,\n \"flex\": true,\n \"justify-start\": chat.type === \"user\",\n \"justify-end\": chat.type !== \"user\",\n \"pe-10\": chat.type === \"user\",\n \"ps-20\": chat.type !== \"user\",\n \"text-md\": true,\n \"text-slate-900\": true,\n \"relative\": true,\n }}\n >\n {chat.type === \"user\" && (\n <div class=\"flex items-end pr-2\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-8 h-8\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M17.982 18.725A7.488 7.488 0 0 0 12 15.75a7.488 7.488 0 0 0-5.982 2.975m11.963 0a9 9 0 1 0-11.963 0m11.963 0A8.966 8.966 0 0 1 12 21a8.966 8.966 0 0 1-5.982-2.275M15 9.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z\"\n />\n </svg>\n </div>\n )}\n <div class=\"border p-5 bg-slate-100 leading-7 rounded-lg\" innerHTML={chat.message}></div>\n {chat.type !== \"user\" && (\n <div class=\"absolute top-0 right-0 w-16 h-16\">\n <button id={`thumbsUp_${chat.insightId}`} onClick={() => this.thumbsUp(chat.insightId)} class={\"text-gray-500\"}>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M6.633 10.25c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 0 1 2.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 0 0 .322-1.672V2.75a.75.75 0 0 1 .75-.75 2.25 2.25 0 0 1 2.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282m0 0h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 0 1-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-1.04a4.501 4.501 0 0 0-1.423-.23H5.904m10.598-9.75H14.25M5.904 18.5c.083.205.173.405.27.602.197.4-.078.898-.523.898h-.908c-.889 0-1.713-.518-1.972-1.368a12 12 0 0 1-.521-3.507c0-1.553.295-3.036.831-4.398C3.387 9.953 4.167 9.5 5 9.5h1.053c.472 0 .745.556.5.96a8.958 8.958 0 0 0-1.302 4.665c0 1.194.232 2.333.654 3.375Z\"\n />\n </svg>\n </button>\n\n <button id={`thumbsDown_${chat.insightId}`} onClick={() => this.thumbsDown(chat.insightId)} class={\"text-gray-500\"}>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M7.498 15.25H4.372c-1.026 0-1.945-.694-2.054-1.715a12.137 12.137 0 0 1-.068-1.285c0-2.848.992-5.464 2.649-7.521C5.287 4.247 5.886 4 6.504 4h4.016a4.5 4.5 0 0 1 1.423.23l3.114 1.04a4.5 4.5 0 0 0 1.423.23h1.294M7.498 15.25c.618 0 .991.724.725 1.282A7.471 7.471 0 0 0 7.5 19.75 2.25 2.25 0 0 0 9.75 22a.75.75 0 0 0 .75-.75v-.633c0-.573.11-1.14.322-1.672.304-.76.93-1.33 1.653-1.715a9.04 9.04 0 0 0 2.86-2.4c.498-.634 1.226-1.08 2.032-1.08h.384m-10.253 1.5H9.7m8.075-9.75c.01.05.027.1.05.148.593 1.2.925 2.55.925 3.977 0 1.487-.36 2.89-.999 4.125m.023-8.25c-.076-.365.183-.75.575-.75h.908c.889 0 1.713.518 1.972 1.368.339 1.11.521 2.287.521 3.507 0 1.553-.295 3.036-.831 4.398-.306.774-1.086 1.227-1.918 1.227h-1.053c-.472 0-.745-.556-.5-.96a8.95 8.95 0 0 0 .303-.54\"\n />\n </svg>\n </button>\n </div>\n )}\n </li>\n )\n })}\n <div class=\"scroll-bottom\" />\n </ul>\n )\n }\n}\n","function getEndpoint(env: string) {\n switch (env) {\n case \"local\":\n return `http://127.0.0.1:5000/api`\n case \"dev\":\n return `https://dev-api.ai12z.net/api`\n case \"prod\":\n return `https://api.ai12z.net/api`\n default:\n return `https://api.ai12z.net/api`\n }\n}\n\nasync function apiFetch(url: string, payload: any) {\n try {\n const meta = {\n origin: window?.location?.origin,\n title: document?.title,\n userAgent: navigator?.userAgent,\n referrer: document?.referrer,\n language: navigator?.language,\n description: document.querySelector('meta[name=\"description\"]')?.getAttribute(\"content\"),\n }\n payload = { ...payload, meta }\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(payload),\n })\n\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`)\n }\n\n const jsonResponse = await response.json()\n\n return await jsonResponse\n } catch (error) {\n throw error\n }\n}\n\nexport function format(first: string, middle: string, last: string): string {\n return (first || \"\") + (middle ? ` ${middle}` : \"\") + (last ? ` ${last}` : \"\")\n}\n\nexport async function search(apiKey: string, env: string, terms: string) {\n if (!terms) return []\n if (!apiKey) throw new Error(`Public Key is required. Please provide using attribute \"data-key\".`)\n const endpoint = `${getEndpoint(env)}/search`\n const data = {\n apiKey,\n query: terms,\n num_docs: 4,\n }\n return await apiFetch(endpoint, data)\n}\n\nexport async function askAI(apiKey: string, env: string, question: string, conversationId: string) {\n const endpoint = `${getEndpoint(env)}/askai`\n const data = {\n apiKey,\n query: question,\n conversation_id: conversationId,\n format: \"html\",\n }\n\n return await apiFetch(endpoint, data)\n}\n\nexport async function sendFeedback(apiKey: string, env: string, insightId: string, feedback: 1 | -1) {\n const endpoint = `${getEndpoint(env)}/feedback`\n const data = {\n apiKey,\n insight_id: insightId,\n feedback,\n }\n\n return await apiFetch(endpoint, data)\n}\n\nexport function debounce(func, timeout = 300) {\n let timer\n return (...args) => {\n clearTimeout(timer)\n timer = setTimeout(() => {\n func.apply(this, args)\n }, timeout)\n }\n}\n","import { h } from \"@stencil/core\"\nexport default function SearchResult(props: any) {\n const results = props.results\n\n return (\n <div class=\"results\">\n <ul role=\"list\" class=\"divide-y divide-gray-100\">\n {results?.map(result => {\n return (\n <li key={result.title} class=\"relative py-5 hover:bg-gray-50\">\n {/* <div class=\"result\">\n <h2>{result.title}</h2>\n <p>{result.description}</p>\n </div> */}\n <div class=\"px-4 sm:px-6 lg:px-8\">\n <div class=\"mx-auto flex max-w-4xl justify-between gap-x-6\">\n <div class=\"flex min-w-0 gap-x-4\">\n <div>\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"w-6 h-6\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5\" />\n </svg>\n </div>\n <div class=\"min-w-0 flex-auto\">\n <p class=\"text-sm font-semibold leading-6 text-gray-900\">\n <a href={result.link}>\n <span class=\"absolute inset-x-0 -top-px bottom-0\"></span>\n {result.title}\n </a>\n </p>\n <p class=\"mt-1 flex text-xs leading-5 text-gray-500\">\n <a href={result.link} class=\"relative truncate hover:underline\">\n {result.description}\n </a>\n </p>\n </div>\n </div>\n <div class=\"flex shrink-0 items-center gap-x-4\">\n <svg class=\"h-5 w-5 flex-none text-gray-400\" viewBox=\"0 0 20 20\" fill=\"currentColor\" aria-hidden=\"true\">\n <path\n fill-rule=\"evenodd\"\n d=\"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z\"\n clip-rule=\"evenodd\"\n />\n </svg>\n </div>\n </div>\n </div>\n </li>\n )\n })}\n </ul>\n </div>\n )\n}\n",":host {\n --bg-smoke-light: rgba(0, 0, 0, 0.5);\n}\n\n.bg-smoke-light {\n /* background-color: var(--bg-smoke-light); */\n transition: opacity 300ms ease-in-out;\n position: fixed;\n top: 0;\n left: 0;\n z-index: 200;\n display: flex;\n height: 100vh;\n width: 100vw;\n cursor: auto;\n flex-direction: column;\n background-color: #0003;\n --tw-backdrop-blur: blur(4px);\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate)\n var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n}\n\n.modal-content {\n transition:\n transform 300ms ease-in-out,\n opacity 300ms ease-in-out;\n transform: scale(0.9);\n opacity: 0;\n}\n\n:host(.show-modal) .bg-smoke-light {\n opacity: 1;\n}\n\n:host(.show-modal) .modal-content {\n transform: scale(1);\n opacity: 1;\n}\n\n.model-wrapper {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 200;\n display: flex;\n height: 100vh;\n width: 100vw;\n cursor: auto;\n flex-direction: column;\n background-color: #0003;\n padding: 1rem;\n --tw-backdrop-blur: blur(4px);\n -webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate)\n var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate)\n var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);\n}\n","import { Component, h, Method, State, Listen, Element, Prop, Host, Watch } from \"@stencil/core\"\nimport { search, askAI, sendFeedback } from \"../../utils/utils\"\n// import InputForm from \"./components/Form\"\nimport SearchResult from \"./components/SearchResult\"\n@Component({\n tag: \"ai12z-cta\",\n styleUrl: \"./ai12z-cta.css\",\n shadow: true,\n})\nexport class MyModal {\n private dirty: boolean = false\n private isSubmitted = false\n private pButtonText: string = \"Ask AI\"\n private pPlaceholder: string\n\n @Element() el!: HTMLElement\n @State() showModal: boolean = false\n @State() formData = { search: \"\" }\n @State() searchResults = []\n @State() error = null\n @State() conversationId = null\n @State() chatHistory = [\n // {\n // message: \"Hi, I am AI12z, your AI assistant. How can I help you?\",\n // type: \"user\",\n // status: \"pending\",\n // },\n // {\n // message: `<div class=\"animate-ping\">...</div>`,\n // type: \"ai\",\n // status: \"pending\",\n // },\n ]\n @State() isChat = false\n\n @Prop({ reflect: true }) heading: string\n @Prop({ reflect: true }) placeholder: string\n @Prop({ reflect: true }) dataKey: string\n @Prop({ reflect: true }) dataMode: string\n @Prop({ reflect: true }) buttonText: string = \"Ask AI\"\n\n @Watch(\"buttonText\")\n watchButtonText(newValue: string, oldValue: string) {\n if (newValue === oldValue) {\n return\n }\n this.pButtonText = newValue\n }\n\n @Watch(\"placeholder\")\n watchPlaceHolder(newValue: string, oldValue: string) {\n if (newValue === oldValue) {\n return\n }\n this.pPlaceholder = newValue\n }\n\n @Method()\n async openModal() {\n this.showModal = true\n this.dirty = false\n\n requestAnimationFrame(() => {\n const searchInput = this.el.shadowRoot.querySelector(\"ai12z-input-form\").shadowRoot.querySelector(\"input\")\n searchInput.focus()\n this.el.shadowRoot.querySelector(\".modal-wrapper\").classList.add(\"show-modal\")\n })\n }\n\n @Method()\n async closeModal() {\n this.el.shadowRoot.querySelector(\".modal-wrapper\").classList.remove(\"show-modal\")\n setTimeout(() => (this.showModal = false), 300) // Assuming 300ms is your transition duration\n }\n\n @Listen(\"keydown\", { target: \"window\" })\n handleKeyDown(ev: KeyboardEvent) {\n if (ev.metaKey && ev.key === \"k\") {\n this.openModal()\n }\n if (ev.key === \"Escape\") {\n this.closeModal()\n }\n }\n\n handleOutsideClick(ev: MouseEvent) {\n const outsideContent = (ev.target as any).classList.contains(\"modal-wrapper\")\n if (outsideContent) {\n this.closeModal()\n }\n }\n\n handleSubmit = async (event, value, type) => {\n this.dirty = true\n this.isSubmitted = true\n event?.preventDefault()\n this.formData = { ...this.formData, search: value }\n\n if (!this.formData.search && this.formData.search.length < 3) return\n try {\n let response = null\n if (type === \"ask-ai\" || this.isChat) {\n this.isChat = true\n this.chatHistory.push({\n message: this.formData.search,\n status: \"success\",\n type: \"user\",\n })\n this.chatHistory.push({\n message: `<div class=\"animate-ping\">...</div>`,\n type: \"ai\",\n status: \"pending\",\n })\n response = await askAI(this.dataKey, this.dataMode, this.formData.search, this.conversationId)\n this.conversationId = response.conversation_Id\n this.chatHistory.pop()\n const lastMessage = { message: response.answer, type: \"ai\", status: \"success\", insightId: response.insight_id }\n this.chatHistory = [...this.chatHistory, lastMessage]\n\n // this.chatHistory.push({\n // message: response.answer,\n // type: \"ai\",\n // status: \"success\",\n // })\n } else {\n response = await search(this.dataKey, this.dataMode, this.formData.search)\n this.displaySearchResults(response)\n }\n } catch (error) {\n console.error(error)\n this.error = error\n } finally {\n this.isSubmitted = false\n }\n }\n\n displaySearchResults = results => {\n this.searchResults = results.docs\n this.isSubmitted = false\n }\n\n // componentWillLoad() {\n // console.log(\"this.buttonText\", this.buttonText)\n // }\n\n // componentDidLoad() {\n // console.log(\"Component has been rendered\")\n // }\n\n // componentWillUpdate() {\n // console.log(\"Component will update and re-render\")\n // }\n\n defaultTemplate() {\n return (\n <button\n type=\"button\"\n class=\"hidden sm:flex items-center w-72 text-left space-x-3 px-4 h-12 bg-white ring-1 ring-slate-900/10 hover:ring-slate-300 focus:outline-none focus:ring-2 focus:ring-sky-500 shadow-sm rounded-lg text-slate-400\"\n >\n <svg\n width=\"24\"\n height=\"24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n class=\"flex-none text-slate-300 dark:text-slate-400\"\n aria-hidden=\"true\"\n >\n <path d=\"m19 19-3.5-3.5\"></path>\n <circle cx=\"11\" cy=\"11\" r=\"6\"></circle>\n </svg>\n <span class=\"flex-auto\">Quick search...</span>\n <kbd class=\"font-sans font-semibold dark:text-slate-500\">\n <abbr title=\"Command\" class=\"no-underline text-slate-300 dark:text-slate-500\">\n ⌘\n </abbr>\n K\n </kbd>\n </button>\n )\n }\n\n displayMessage() {\n let message = null\n if (this.error) {\n message = <p class=\"text-red-500\">Errored please try again!</p>\n } else {\n if (this.isSubmitted) {\n message = (\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" class=\"animate-spin w-6 h-6\">\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\"\n />\n </svg>\n )\n } else {\n if (this.dirty) {\n message = \"No results found\"\n }\n message = \"Enter text to get started\"\n }\n }\n if (this.searchResults?.length > 0) {\n return null\n } else {\n return <p class=\"text-center p-10 text-slate-500 flex justify-center\">{message}</p>\n }\n }\n\n render() {\n const slot = this.el.shadowRoot.host\n const slotHasContent = slot && slot.children.length > 0\n\n return (\n <Host>\n <div onClick={() => this.openModal()}>\n {!slotHasContent && this.defaultTemplate()}\n {slotHasContent && <slot />}\n </div>\n\n <div\n class={{ \"modal-wrapper\": true, \"hidden\": !this.showModal, \"fixed\": true, \"inset-0\": true, \"overflow-auto\": true, \"bg-smoke-light\": true, \"flex\": true }}\n onClick={ev => this.handleOutsideClick(ev)}\n >\n <div class=\"model-content relative p-8 bg-white w-full max-w-xl m-auto flex-col rounded-lg shadow-m z-250 mt-12\">\n <span class=\"absolute top-0 right-0 p-4\">\n <button onClick={() => this.closeModal()} class=\"text-black hover:text-gray-800\">\n ×\n </button>\n </span>\n <h1 class=\"text-slate-700 text-2xl mb-2\">{this.heading}</h1>\n <ai12z-input-form\n onAction={async event => {\n const { value, type } = event.detail\n await this.handleSubmit(event, value, type)\n }}\n isChat={this.isChat}\n placeholder={this.pPlaceholder}\n buttonText={this.pButtonText}\n />\n {/* <InputForm isChat={this.isChat} placeholder={this.pPlaceholder} formData={this.formData} buttonText={this.pButtonText} onsubmit={this.handleSubmit} /> */}\n {this.displayMessage()}\n {!this.isChat && <SearchResult results={this.searchResults} />}\n {this.isChat && (\n <ai12z-chat\n chats={this.chatHistory}\n onFeedback={async event => {\n const { feedback, insightId } = event.detail\n sendFeedback(this.dataKey, this.dataMode, insightId, feedback)\n }}\n />\n )}\n </div>\n </div>\n </Host>\n )\n }\n}\n","/* Input Form Styles */\n.input-form {\n display: flex;\n flex-direction: column;\n width: 100%;\n margin-bottom: 1rem;\n}\n","import { Component, h, Prop, State, Event, EventEmitter, Element } from \"@stencil/core\"\nimport { debounce } from \"../../utils/utils\"\n\n@Component({\n tag: \"ai12z-input-form\",\n styleUrl: \"./input.css\",\n shadow: true,\n})\nexport class InputForm {\n private searchFormElem: HTMLDivElement\n private searchInputElem: HTMLInputElement\n\n @Element() el!: HTMLElement\n\n @Prop() isChat: boolean\n @Prop() placeholder: string\n @Prop() buttonText: string\n\n @Event() action: EventEmitter\n\n @State() searchInput: string = \"\"\n @State() submitted: boolean = false\n\n handleInputChange = (e: Event) => {\n this.searchInput = this.searchInputElem.value\n if (this.isChat) {\n return\n }\n const value = this.searchInputElem.value\n if (value.length > 3) {\n this.action.emit({ event: e, value: value, type: \"search\" })\n }\n }\n\n handleFormSubmit = (e: Event) => {\n e.preventDefault()\n if (this.searchInput.length > 3) {\n this.action.emit({ event: e, value: this.searchInput, type: \"search\" })\n }\n }\n\n handleAskAI = (e: Event) => {\n e.preventDefault()\n this.submitted = true\n this.action.emit({ event: e, value: this.searchInput, type: \"ask-ai\" })\n this.submitted = false\n this.searchInput = \"\"\n }\n\n render() {\n return (\n <form onSubmit={this.handleFormSubmit}>\n <div ref={el => (this.searchFormElem = el)} class=\"relative flex items-center rounded rounded-md border border-grey-light items-stretch\">\n <div class=\"flex-grow p-3\">\n <input\n readOnly={this.submitted}\n ref={el => (this.searchInputElem = el as HTMLInputElement)}\n required\n type=\"text\"\n placeholder={this.placeholder}\n autoComplete=\"off\"\n class=\"block w-full border-0 focus:ring-0 focus:outline-none\"\n value={this.searchInput}\n onInput={debounce(e => this.handleInputChange(e), 500)}\n onFocus={() => this.searchFormElem.classList.add(\"border-blue-500\")}\n onBlur={() => this.searchFormElem.classList.remove(\"border-blue-500\")}\n />\n </div>\n <button disabled={this.submitted} onClick={this.handleAskAI} class=\"border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white\">\n {this.buttonText}\n </button>\n </div>\n {/* <div ref={el => (this.searchForm = el)} class=\"relative flex items-center rounded rounded-md border border-grey-light items-stretch\">\n <div class=\"flex-grow p-3\">\n <input type=\"text\" onInput={this.handleInputChange} value={this.searchInput} placeholder={this.placeholder} />\n </div>\n <button onClick={this.handleAskAI} class=\"border-l px-4 whitespace-nowrap hover:bg-indigo-300 hover:text-white\">\n {this.buttonText}\n </button>\n </div> */}\n </form>\n )\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-6be98462.js');
|
|
6
|
+
|
|
7
|
+
const spinnerCss = "/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:\"\"}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.border{border-width:1px}.loader{animation:spin 2s linear infinite;border:16px solid #f3f3f3;border-radius:75%;border-top-color:#3498db;height:120px;width:120px}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.h-6{height:1.5rem}.w-6{width:1.5rem}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}";
|
|
8
|
+
|
|
9
|
+
const Spinner = class {
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.class = "w-6 h-6";
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return index.h("div", { class: "loader " + this.class });
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
Spinner.style = spinnerCss;
|
|
19
|
+
|
|
20
|
+
exports.ai12z_spinner = Spinner;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=ai12z-spinner.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"ai12z-spinner.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,UAAU,GAAG,owHAAowH;;MCO1wH,OAAO;;;qBACM,SAAS;;IAEjC,MAAM;QACJ,OAAOA,iBAAK,KAAK,EAAE,SAAS,GAAG,IAAI,CAAC,KAAK,GAAQ,CAAA;KAClD;;;;;;","names":["h"],"sources":["src/components/spinner/spinner.css?tag=ai12z-spinner&encapsulation=shadow","src/components/spinner/Spinner.tsx"],"sourcesContent":[".loader {\n border: 16px solid #f3f3f3;\n border-radius: 75%;\n border-top: 16px solid #3498db;\n width: 120px;\n height: 120px;\n -webkit-animation: spin 2s linear infinite; /* Safari */\n animation: spin 2s linear infinite;\n}\n\n/* Safari */\n@-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n }\n}\n\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n","import { Component, h, Prop } from \"@stencil/core\"\n\n@Component({\n tag: \"ai12z-spinner\",\n styleUrl: \"./spinner.css\",\n shadow: true,\n})\nexport class Spinner {\n @Prop() class: string = \"w-6 h-6\"\n\n render() {\n return <div class={\"loader \" + this.class}></div>\n }\n}\n"],"version":3}
|