@openk9ui/openk9-chatbot 3.0.1 → 3.1.1-SNAPSHOT
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/dist/{SingleMessage-Dyc7W2JZ.js → SingleMessage-D59l6K_M.js} +196 -182
- package/dist/components/Chatbot.js +1 -1
- package/dist/components/SingleMessage.js +1 -1
- package/dist/lib/components/Chatbot.js +40 -51
- package/dist/lib/components/LanguageContext.js +3 -14
- package/dist/lib/components/Search.js +11 -22
- package/dist/lib/components/SingleMessage.js +46 -58
- package/dist/lib/components/Translate.js +11 -12
- package/dist/lib/components/client.js +46 -20
- package/dist/lib/components/styled.js +3 -3
- package/dist/lib/components/useFocusTrap.js +5 -6
- package/dist/lib/components/useGenerateResponse.js +14 -13
- package/dist/lib/components/useLanguage.js +2 -2
- package/dist/lib/main.js +2 -2
- package/dist/src/theme.js +12 -12
- package/dist/types/lib/components/SingleMessage.d.ts +0 -1
- package/dist/types/lib/components/client.d.ts +10 -14
- package/dist/types/lib/components/styled.d.ts +2 -3
- package/dist/types/lib/components/useFocusTrap.d.ts +0 -1
- package/package.json +9 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
exports.Translate =
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Translate = Translate;
|
|
4
4
|
var useLanguage_1 = require("./useLanguage");
|
|
5
5
|
function Translate(_a) {
|
|
6
6
|
var _b;
|
|
@@ -10,62 +10,61 @@ function Translate(_a) {
|
|
|
10
10
|
var translation = (_b = translations[label]) === null || _b === void 0 ? void 0 : _b[htmlLang];
|
|
11
11
|
return translation || label;
|
|
12
12
|
}
|
|
13
|
-
exports.Translate = Translate;
|
|
14
13
|
var translations = {
|
|
15
14
|
closeChatbot: {
|
|
16
15
|
it_IT: "Chiudi il chatbot",
|
|
17
16
|
en_US: "Close the chatbot",
|
|
18
17
|
fr_FR: "Fermez le chatbot",
|
|
19
18
|
es_ES: "Cerrar el chatbot",
|
|
20
|
-
de_DE: "Schließen Sie den Chatbot"
|
|
19
|
+
de_DE: "Schließen Sie den Chatbot",
|
|
21
20
|
},
|
|
22
21
|
openChatbot: {
|
|
23
22
|
it_IT: "Apri il chatbot",
|
|
24
23
|
en_US: "Open the chatbot",
|
|
25
24
|
fr_FR: "Ouvrir le chatbot",
|
|
26
25
|
es_ES: "Abrir el chatbot",
|
|
27
|
-
de_DE: "Öffnen Sie den Chatbot"
|
|
26
|
+
de_DE: "Öffnen Sie den Chatbot",
|
|
28
27
|
},
|
|
29
28
|
clearChat: {
|
|
30
29
|
it_IT: "Svuota la chat",
|
|
31
30
|
en_US: "Clear the chat",
|
|
32
31
|
fr_FR: "Effacer le chat",
|
|
33
32
|
es_ES: "Borrar el chat",
|
|
34
|
-
de_DE: "Leeren Sie den Chat"
|
|
33
|
+
de_DE: "Leeren Sie den Chat",
|
|
35
34
|
},
|
|
36
35
|
startQuestion: {
|
|
37
36
|
it_IT: "Fai partire una domanda",
|
|
38
37
|
en_US: "Start a question",
|
|
39
38
|
fr_FR: "Commencez une question",
|
|
40
39
|
es_ES: "Iniciar una pregunta",
|
|
41
|
-
de_DE: "Starten Sie eine Frage"
|
|
40
|
+
de_DE: "Starten Sie eine Frage",
|
|
42
41
|
},
|
|
43
42
|
youSendMessage: {
|
|
44
43
|
it_IT: "tu hai mandato un messaggio alle ",
|
|
45
44
|
en_US: "you sent a message at ",
|
|
46
45
|
fr_FR: "vous avez envoyé un message à ",
|
|
47
46
|
es_ES: "tú enviaste un mensaje a las ",
|
|
48
|
-
de_DE: "du hast eine Nachricht um "
|
|
47
|
+
de_DE: "du hast eine Nachricht um ",
|
|
49
48
|
},
|
|
50
49
|
sendMessage: {
|
|
51
50
|
it_IT: "ha mandato un messaggio alle ",
|
|
52
51
|
en_US: "sent a message at ",
|
|
53
52
|
fr_FR: "a envoyé un message à ",
|
|
54
53
|
es_ES: "envió un mensaje a las ",
|
|
55
|
-
de_DE: "hat eine Nachricht um "
|
|
54
|
+
de_DE: "hat eine Nachricht um ",
|
|
56
55
|
},
|
|
57
56
|
customPlaceholder: {
|
|
58
57
|
it_IT: "scrivi il tuo messaggio...",
|
|
59
58
|
en_US: "write your message...",
|
|
60
59
|
fr_FR: "écris ton message...",
|
|
61
60
|
es_ES: "escribe tu mensaje...",
|
|
62
|
-
de_DE: "Schreiben Sie Ihre Nachricht..."
|
|
61
|
+
de_DE: "Schreiben Sie Ihre Nachricht...",
|
|
63
62
|
},
|
|
64
63
|
searchLabel: {
|
|
65
64
|
it_IT: "Cerca nel chatbot",
|
|
66
65
|
en_US: "Search in the chatbot",
|
|
67
66
|
fr_FR: "Rechercher dans le chatbot",
|
|
68
67
|
es_ES: "Buscar en el chatbot",
|
|
69
|
-
de_DE: "Im Chatbot suchen"
|
|
70
|
-
}
|
|
68
|
+
de_DE: "Im Chatbot suchen",
|
|
69
|
+
},
|
|
71
70
|
};
|
|
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g =
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -49,20 +49,21 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
49
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
51
|
};
|
|
52
|
-
exports
|
|
53
|
-
exports.
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.OpenK9ClientContext = void 0;
|
|
54
|
+
exports.default = Client;
|
|
55
|
+
exports.OpenK9Client = OpenK9Client;
|
|
54
56
|
var react_1 = __importDefault(require("react"));
|
|
55
|
-
exports.OpenK9ClientContext = react_1
|
|
57
|
+
exports.OpenK9ClientContext = react_1.default.createContext(null /* must break app if not provided */);
|
|
56
58
|
function Client() {
|
|
57
59
|
return null;
|
|
58
60
|
}
|
|
59
|
-
exports["default"] = Client;
|
|
60
61
|
function OpenK9Client(_a) {
|
|
61
62
|
var callbackAuthorization = _a.callbackAuthorization;
|
|
62
|
-
function authFetch(
|
|
63
|
-
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
+
function authFetch(route_1) {
|
|
64
|
+
return __awaiter(this, arguments, void 0, function (route, init) {
|
|
65
65
|
var authorization, headers;
|
|
66
|
+
if (init === void 0) { init = {}; }
|
|
66
67
|
return __generator(this, function (_a) {
|
|
67
68
|
authorization = callbackAuthorization && callbackAuthorization();
|
|
68
69
|
headers = __assign(__assign({}, init.headers), (authorization ? { authorization: authorization } : {}));
|
|
@@ -125,9 +126,9 @@ function OpenK9Client(_a) {
|
|
|
125
126
|
method: "POST",
|
|
126
127
|
headers: {
|
|
127
128
|
accept: "application/json",
|
|
128
|
-
"Content-Type": "application/json"
|
|
129
|
+
"Content-Type": "application/json",
|
|
129
130
|
},
|
|
130
|
-
body: JSON.stringify(searchQuery)
|
|
131
|
+
body: JSON.stringify(searchQuery),
|
|
131
132
|
})];
|
|
132
133
|
case 1:
|
|
133
134
|
response = _a.sent();
|
|
@@ -144,27 +145,52 @@ function OpenK9Client(_a) {
|
|
|
144
145
|
});
|
|
145
146
|
},
|
|
146
147
|
GenerateResponse: function (_a) {
|
|
147
|
-
|
|
148
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
149
149
|
var response;
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
var url = _b.url, searchQuery = _b.searchQuery, controller = _b.controller;
|
|
151
|
+
return __generator(this, function (_c) {
|
|
152
|
+
switch (_c.label) {
|
|
152
153
|
case 0: return [4 /*yield*/, authFetch(url, {
|
|
153
154
|
method: "POST",
|
|
154
155
|
headers: {
|
|
155
156
|
accept: "application/json",
|
|
156
|
-
"Content-Type": "application/json"
|
|
157
|
+
"Content-Type": "application/json",
|
|
157
158
|
},
|
|
158
159
|
body: JSON.stringify(searchQuery),
|
|
159
|
-
signal: controller.signal
|
|
160
|
+
signal: controller.signal,
|
|
160
161
|
})];
|
|
161
162
|
case 1:
|
|
162
|
-
response =
|
|
163
|
+
response = _c.sent();
|
|
163
164
|
return [2 /*return*/, response];
|
|
164
165
|
}
|
|
165
166
|
});
|
|
166
167
|
});
|
|
167
|
-
}
|
|
168
|
+
},
|
|
169
|
+
// async deleteChat(chatId: string) {
|
|
170
|
+
// const response = await authFetch(`/api/rag/chat/${chatId}`, {
|
|
171
|
+
// method: "DELETE",
|
|
172
|
+
// headers: {
|
|
173
|
+
// accept: "application/json"
|
|
174
|
+
// }
|
|
175
|
+
// });
|
|
176
|
+
// if (!response.ok) {
|
|
177
|
+
// throw new Error("Errore durante l'eliminazione della chat");
|
|
178
|
+
// }
|
|
179
|
+
// return response;
|
|
180
|
+
// },
|
|
181
|
+
// async renameChat(chatId: string, newTitle: string) {
|
|
182
|
+
// const response = await authFetch(`/api/rag/chat/${chatId}`, {
|
|
183
|
+
// method: "PATCH",
|
|
184
|
+
// headers: {
|
|
185
|
+
// accept: "application/json",
|
|
186
|
+
// "Content-Type": "application/json",
|
|
187
|
+
// },
|
|
188
|
+
// body: JSON.stringify({ newTitle })
|
|
189
|
+
// });
|
|
190
|
+
// if (!response.ok) {
|
|
191
|
+
// throw new Error("Errore durante la rinomina della chat");
|
|
192
|
+
// }
|
|
193
|
+
// return response;
|
|
194
|
+
// }
|
|
168
195
|
};
|
|
169
196
|
}
|
|
170
|
-
exports.OpenK9Client = OpenK9Client;
|
|
@@ -6,9 +6,9 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
6
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
8
|
};
|
|
9
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ParagraphMessage = exports.ParagraphTime = void 0;
|
|
11
11
|
var styled_1 = __importDefault(require("@emotion/styled"));
|
|
12
|
-
exports.ParagraphTime = styled_1
|
|
13
|
-
exports.ParagraphMessage = styled_1
|
|
12
|
+
exports.ParagraphTime = styled_1.default.p(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n margin: 0px;\n align-self: end;\n font-size: 10px;\n font-weight: 500;\n line-height: 11.72px;\n"], ["\n color: ", ";\n margin: 0px;\n align-self: end;\n font-size: 10px;\n font-weight: 500;\n line-height: 11.72px;\n"])), function (props) { return props.$color; });
|
|
13
|
+
exports.ParagraphMessage = styled_1.default.p(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n color:", ";\n margin: 0px;\n fontSize: \"12px\",\n fontWeight: \"400\",\n lineHeight: \"18.25px\",\n textAlign: \"left\",\n "], ["\n color:", ";\n margin: 0px;\n fontSize: \"12px\",\n fontWeight: \"400\",\n lineHeight: \"18.25px\",\n textAlign: \"left\",\n "])), function (props) { return props.$color; });
|
|
14
14
|
var templateObject_1, templateObject_2;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
exports.
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToIntOrFallback = convertToIntOrFallback;
|
|
4
|
+
exports.getTabIndexOfNode = getTabIndexOfNode;
|
|
5
|
+
exports.sortByTabIndex = sortByTabIndex;
|
|
6
|
+
exports.useFocusTrap = useFocusTrap;
|
|
4
7
|
var react_1 = require("react");
|
|
5
8
|
function convertToIntOrFallback(stringToConvert) {
|
|
6
9
|
var parsed = parseInt(stringToConvert !== null && stringToConvert !== void 0 ? stringToConvert : "");
|
|
7
10
|
return isNaN(parsed) ? 0 : parsed;
|
|
8
11
|
}
|
|
9
|
-
exports.convertToIntOrFallback = convertToIntOrFallback;
|
|
10
12
|
function getTabIndexOfNode(targetNode) {
|
|
11
13
|
return convertToIntOrFallback(targetNode.getAttribute("tabindex"));
|
|
12
14
|
}
|
|
13
|
-
exports.getTabIndexOfNode = getTabIndexOfNode;
|
|
14
15
|
function sanitizeTabIndexInput(tabIndex, highestPositiveTabIndex) {
|
|
15
16
|
if (tabIndex < 0) {
|
|
16
17
|
throw new Error("Unable to sort given input. A negative value is not part of the tab order: ".concat(tabIndex));
|
|
@@ -27,7 +28,6 @@ function sortByTabIndex(firstNode, secondNode) {
|
|
|
27
28
|
})
|
|
28
29
|
.reduce(function (previousValue, currentValue) { return previousValue - currentValue; });
|
|
29
30
|
}
|
|
30
|
-
exports.sortByTabIndex = sortByTabIndex;
|
|
31
31
|
var focusableElementsSelector = "a[href], area[href], input:not([disabled]):not([type=hidden]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]";
|
|
32
32
|
var TAB_KEY = 9;
|
|
33
33
|
function useFocusTrap(isActive) {
|
|
@@ -82,4 +82,3 @@ function useFocusTrap(isActive) {
|
|
|
82
82
|
}, [isActive, trapper]);
|
|
83
83
|
return [trapRef];
|
|
84
84
|
}
|
|
85
|
-
exports.useFocusTrap = useFocusTrap;
|
|
@@ -43,8 +43,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
});
|
|
44
44
|
};
|
|
45
45
|
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
-
return g =
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
47
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
48
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
49
|
function step(op) {
|
|
50
50
|
if (f) throw new TypeError("Generator is already executing.");
|
|
@@ -78,7 +78,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
78
78
|
}
|
|
79
79
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
80
|
};
|
|
81
|
-
exports
|
|
81
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
82
82
|
var react_1 = __importStar(require("react"));
|
|
83
83
|
var uuid_1 = require("uuid");
|
|
84
84
|
var useLanguage_1 = require("./useLanguage");
|
|
@@ -90,7 +90,7 @@ var useGenerateResponse = function (_a) {
|
|
|
90
90
|
var _c = (0, react_1.useState)(new Map()), abortControllers = _c[0], setAbortControllers = _c[1];
|
|
91
91
|
var _d = (0, react_1.useState)(false), isChatting = _d[0], setIsChatting = _d[1];
|
|
92
92
|
var _e = (0, react_1.useState)(null), isLoading = _e[0], setIsLoading = _e[1];
|
|
93
|
-
var client = react_1
|
|
93
|
+
var client = react_1.default.useMemo(function () { return (0, client_1.OpenK9Client)({ callbackAuthorization: callbackAuthorization }); }, [callbackAuthorization]);
|
|
94
94
|
var generateResponse = (0, react_1.useCallback)(function (query) { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
95
|
var id, timestamp, nonLoggedUserId, chatHistory, controller, url, searchQuery, response_1, reader, decoder, done, buffer, _a, value, readerDone, boundaryIndex, _loop_1, error_1;
|
|
96
96
|
var _b, _c;
|
|
@@ -106,9 +106,9 @@ var useGenerateResponse = function (_a) {
|
|
|
106
106
|
answer: msg.answer,
|
|
107
107
|
title: "",
|
|
108
108
|
sources: msg.sources || [],
|
|
109
|
-
chat_id: nonLoggedUserId,
|
|
109
|
+
chat_id: nonLoggedUserId, //keycloak.authenticated ? chatId : nonLoggedUserId,
|
|
110
110
|
timestamp: msg.timestamp || "",
|
|
111
|
-
chat_sequence_number: msg.chat_sequence_number
|
|
111
|
+
chat_sequence_number: msg.chat_sequence_number,
|
|
112
112
|
}); });
|
|
113
113
|
setMessages(function (prevMessages) {
|
|
114
114
|
var _a;
|
|
@@ -122,7 +122,7 @@ var useGenerateResponse = function (_a) {
|
|
|
122
122
|
status: "CHUNK",
|
|
123
123
|
sources: [],
|
|
124
124
|
chat_sequence_number: chat_sequence_number,
|
|
125
|
-
timestamp: timestamp
|
|
125
|
+
timestamp: timestamp,
|
|
126
126
|
};
|
|
127
127
|
return __spreadArray(__spreadArray([], prevMessages, true), [newMessage], false);
|
|
128
128
|
});
|
|
@@ -142,7 +142,8 @@ var useGenerateResponse = function (_a) {
|
|
|
142
142
|
searchText: query,
|
|
143
143
|
chatSequenceNumber: ((_b = messages[messages.length - 1]) === null || _b === void 0 ? void 0 : _b.chat_sequence_number) + 1 || 1,
|
|
144
144
|
timestamp: timestamp,
|
|
145
|
-
chatHistory: chatHistory
|
|
145
|
+
chatHistory: chatHistory,
|
|
146
|
+
// language,
|
|
146
147
|
};
|
|
147
148
|
_d.label = 1;
|
|
148
149
|
case 1:
|
|
@@ -150,7 +151,7 @@ var useGenerateResponse = function (_a) {
|
|
|
150
151
|
return [4 /*yield*/, client.GenerateResponse({
|
|
151
152
|
controller: controller,
|
|
152
153
|
searchQuery: searchQuery,
|
|
153
|
-
url: url
|
|
154
|
+
url: url,
|
|
154
155
|
})];
|
|
155
156
|
case 2:
|
|
156
157
|
response_1 = _d.sent();
|
|
@@ -251,7 +252,7 @@ var useGenerateResponse = function (_a) {
|
|
|
251
252
|
case 9:
|
|
252
253
|
setAbortControllers(function (prev) {
|
|
253
254
|
var updated = new Map(prev);
|
|
254
|
-
updated
|
|
255
|
+
updated.delete(id);
|
|
255
256
|
return updated;
|
|
256
257
|
});
|
|
257
258
|
return [2 /*return*/];
|
|
@@ -271,7 +272,7 @@ var useGenerateResponse = function (_a) {
|
|
|
271
272
|
});
|
|
272
273
|
setAbortControllers(function (prev) {
|
|
273
274
|
var updated = new Map(prev);
|
|
274
|
-
updated
|
|
275
|
+
updated.delete(id);
|
|
275
276
|
return updated;
|
|
276
277
|
});
|
|
277
278
|
setIsChatting(abortControllers.size > 0);
|
|
@@ -304,7 +305,7 @@ var useGenerateResponse = function (_a) {
|
|
|
304
305
|
cancelAllResponses: cancelAllResponses,
|
|
305
306
|
isChatting: isChatting,
|
|
306
307
|
isLoading: isLoading,
|
|
307
|
-
resetMessage: resetMessage
|
|
308
|
+
resetMessage: resetMessage,
|
|
308
309
|
};
|
|
309
310
|
};
|
|
310
|
-
exports
|
|
311
|
+
exports.default = useGenerateResponse;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.useLanguage = void 0;
|
|
7
7
|
var react_1 = require("react");
|
|
8
8
|
var LanguageContext_1 = __importDefault(require("./LanguageContext"));
|
|
9
9
|
var useLanguage = function () {
|
|
10
|
-
var context = (0, react_1.useContext)(LanguageContext_1
|
|
10
|
+
var context = (0, react_1.useContext)(LanguageContext_1.default);
|
|
11
11
|
if (!context) {
|
|
12
12
|
throw new Error("useLanguage must used to LanguageProvider");
|
|
13
13
|
}
|
package/dist/lib/main.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Chatbot = void 0;
|
|
7
7
|
var Chatbot_1 = __importDefault(require("./components/Chatbot"));
|
|
8
|
-
exports.Chatbot = Chatbot_1
|
|
8
|
+
exports.Chatbot = Chatbot_1.default;
|
package/dist/src/theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultThemeK9 = void 0;
|
|
4
4
|
var styles_1 = require("@mui/material/styles");
|
|
5
5
|
exports.defaultThemeK9 = (0, styles_1.createTheme)({
|
|
@@ -9,44 +9,44 @@ exports.defaultThemeK9 = (0, styles_1.createTheme)({
|
|
|
9
9
|
sm: 576,
|
|
10
10
|
md: 768,
|
|
11
11
|
lg: 992,
|
|
12
|
-
xl: 1200
|
|
13
|
-
}
|
|
12
|
+
xl: 1200,
|
|
13
|
+
},
|
|
14
14
|
},
|
|
15
15
|
palette: {
|
|
16
16
|
primary: {
|
|
17
17
|
main: "#C0272B",
|
|
18
18
|
contrastText: "#FFF",
|
|
19
19
|
dark: "#b10707",
|
|
20
|
-
light: "#e77979"
|
|
20
|
+
light: "#e77979",
|
|
21
21
|
},
|
|
22
22
|
text: {
|
|
23
23
|
primary: "#000000",
|
|
24
|
-
secondary: "#666666"
|
|
25
|
-
}
|
|
24
|
+
secondary: "#666666",
|
|
25
|
+
},
|
|
26
26
|
},
|
|
27
27
|
typography: {
|
|
28
28
|
allVariants: {
|
|
29
|
-
fontFamily: "Titillium Web"
|
|
29
|
+
fontFamily: "Titillium Web",
|
|
30
30
|
},
|
|
31
31
|
fontFamily: "Titillium Web",
|
|
32
32
|
body1: {
|
|
33
33
|
fontWeight: 400,
|
|
34
34
|
fontSize: "12px",
|
|
35
|
-
lineHeight: "19px"
|
|
35
|
+
lineHeight: "19px",
|
|
36
36
|
},
|
|
37
37
|
body2: {
|
|
38
38
|
fontFamily: "Roboto",
|
|
39
39
|
font: "Roboto",
|
|
40
40
|
fontWeight: 500,
|
|
41
41
|
fontSize: "10px",
|
|
42
|
-
lineHeight: "12px"
|
|
42
|
+
lineHeight: "12px",
|
|
43
43
|
},
|
|
44
44
|
h5: {
|
|
45
45
|
fontWeight: 400,
|
|
46
46
|
fontSize: "12px",
|
|
47
|
-
lineHeight: "22px"
|
|
48
|
-
}
|
|
47
|
+
lineHeight: "22px",
|
|
48
|
+
},
|
|
49
49
|
},
|
|
50
50
|
spacing: 2,
|
|
51
|
-
shape: { borderRadius: 2 }
|
|
51
|
+
shape: { borderRadius: 2 },
|
|
52
52
|
});
|
|
@@ -2,13 +2,11 @@ import React from "react";
|
|
|
2
2
|
export declare const OpenK9ClientContext: React.Context<{
|
|
3
3
|
getInitialMessages(chatId: string): Promise<{
|
|
4
4
|
chat_id: string;
|
|
5
|
-
messages: [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
];
|
|
5
|
+
messages: [{
|
|
6
|
+
question: string;
|
|
7
|
+
answer: string;
|
|
8
|
+
chat_sequence_number: string;
|
|
9
|
+
}];
|
|
12
10
|
}>;
|
|
13
11
|
getHistoryChat(searchQuery: jsonObjPost): Promise<{
|
|
14
12
|
result: ChatHistory[];
|
|
@@ -39,13 +37,11 @@ export declare function OpenK9Client({ callbackAuthorization, }: {
|
|
|
39
37
|
}): {
|
|
40
38
|
getInitialMessages(chatId: string): Promise<{
|
|
41
39
|
chat_id: string;
|
|
42
|
-
messages: [
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
];
|
|
40
|
+
messages: [{
|
|
41
|
+
question: string;
|
|
42
|
+
answer: string;
|
|
43
|
+
chat_sequence_number: string;
|
|
44
|
+
}];
|
|
49
45
|
}>;
|
|
50
46
|
getHistoryChat(searchQuery: jsonObjPost): Promise<{
|
|
51
47
|
result: ChatHistory[];
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare const ParagraphTime: import("@emotion/styled").StyledComponent<{
|
|
3
2
|
theme?: import("@emotion/react").Theme;
|
|
4
|
-
as?:
|
|
3
|
+
as?: React.ElementType;
|
|
5
4
|
} & {
|
|
6
5
|
$color?: string;
|
|
7
6
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
8
7
|
export declare const ParagraphMessage: import("@emotion/styled").StyledComponent<{
|
|
9
8
|
theme?: import("@emotion/react").Theme;
|
|
10
|
-
as?:
|
|
9
|
+
as?: React.ElementType;
|
|
11
10
|
} & {
|
|
12
11
|
$color?: string;
|
|
13
12
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare function convertToIntOrFallback(stringToConvert: string | null): number;
|
|
3
2
|
export declare function getTabIndexOfNode(targetNode: HTMLElement): number;
|
|
4
3
|
export declare function sortByTabIndex(firstNode: HTMLElement, secondNode: HTMLElement): number;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openk9ui/openk9-chatbot",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.1-SNAPSHOT",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/main.js",
|
|
8
|
-
"types": "dist/types/main.d.ts",
|
|
8
|
+
"types": "dist/types/lib/main.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
@@ -17,9 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@emotion/react": "^11.13.3",
|
|
20
|
-
"@emotion/styled": "^
|
|
21
|
-
"@fontsource/roboto": "^5.1.0",
|
|
22
|
-
"@fontsource/titillium-web": "^5.1.0",
|
|
20
|
+
"@emotion/styled": "^5.1.14",
|
|
23
21
|
"@mui/material": "^6.1.6",
|
|
24
22
|
"@mui/icons-material": "^6.1.6",
|
|
25
23
|
"@mui/system": "^6.1.6",
|
|
@@ -27,16 +25,18 @@
|
|
|
27
25
|
"react": "^18.0.0",
|
|
28
26
|
"react-dom": "^18.0.0",
|
|
29
27
|
"react-markdown": "^9.0.1",
|
|
30
|
-
"styled-components": "^
|
|
28
|
+
"styled-components": "^5.1.14",
|
|
29
|
+
"@types/react": "^18.3.12",
|
|
30
|
+
"@types/styled-components": "^5.1.14",
|
|
31
|
+
"@types/react-dom": "^18.3.1",
|
|
31
32
|
"uuid": "^11.0.2"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@eslint/js": "^9.13.0",
|
|
35
36
|
"@rollup/plugin-commonjs": "^28.0.1",
|
|
37
|
+
"@fontsource/roboto": "^5.1.0",
|
|
38
|
+
"@fontsource/titillium-web": "^5.1.0",
|
|
36
39
|
"@types/node": "^22.8.6",
|
|
37
|
-
"@types/react": "^18.3.12",
|
|
38
|
-
"@types/react-dom": "^18.3.1",
|
|
39
|
-
"@types/styled-components": "^5.1.34",
|
|
40
40
|
"@types/uuid": "^10.0.0",
|
|
41
41
|
"@vitejs/plugin-react": "^4.3.3",
|
|
42
42
|
"eslint": "^9.13.0",
|
|
@@ -50,8 +50,6 @@
|
|
|
50
50
|
"vite": "^5.4.10",
|
|
51
51
|
"vite-plugin-commonjs": "^0.10.3",
|
|
52
52
|
"vite-plugin-dts": "^4.3.0",
|
|
53
|
-
"@fontsource/roboto": "^5.1.0",
|
|
54
|
-
"@fontsource/titillium-web": "^5.1.0",
|
|
55
53
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
56
54
|
},
|
|
57
55
|
"resolutions": {
|