@djangocfg/ext-knowbase 1.0.0 → 1.0.1

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/hooks.js DELETED
@@ -1,1486 +0,0 @@
1
- import { getKnowbaseAdminChatList, createKnowbaseAdminChatCreate, getKnowbaseAdminChatRetrieve, updateKnowbaseAdminChatUpdate, partialUpdateKnowbaseAdminChatPartialUpdate, deleteKnowbaseAdminChatDestroy, getKnowbaseAdminChatHistoryRetrieve, createKnowbaseAdminChatQueryCreate, getKnowbaseAdminDocumentsList, createKnowbaseAdminDocumentsCreate, getKnowbaseAdminDocumentsRetrieve, updateKnowbaseAdminDocumentsUpdate, partialUpdateKnowbaseAdminDocumentsPartialUpdate, deleteKnowbaseAdminDocumentsDestroy, createKnowbaseAdminDocumentsReprocessCreate, getKnowbaseAdminDocumentsStatusRetrieve, getKnowbaseAdminDocumentsStatsRetrieve, getKnowbaseAdminSessionsList, createKnowbaseAdminSessionsCreate, getKnowbaseAdminSessionsRetrieve, updateKnowbaseAdminSessionsUpdate, partialUpdateKnowbaseAdminSessionsPartialUpdate, deleteKnowbaseAdminSessionsDestroy, createKnowbaseAdminSessionsActivateCreate, createKnowbaseAdminSessionsArchiveCreate, getKnowbaseCategoriesList, getKnowbaseCategoriesRetrieve, getKnowbaseDocumentsList, getKnowbaseDocumentsRetrieve, getKnowbaseSystemArchivesList, createKnowbaseSystemArchivesCreate, getKnowbaseSystemArchivesRetrieve, updateKnowbaseSystemArchivesUpdate, partialUpdateKnowbaseSystemArchivesPartialUpdate, deleteKnowbaseSystemArchivesDestroy, getKnowbaseSystemArchivesFileTreeRetrieve, getKnowbaseSystemArchivesItemsList, createKnowbaseSystemArchivesSearchCreate, createKnowbaseSystemArchivesRevectorizeCreate, getKnowbaseSystemArchivesStatisticsRetrieve, getKnowbaseSystemArchivesVectorizationStatsRetrieve, getKnowbaseSystemChunksList, createKnowbaseSystemChunksCreate, getKnowbaseSystemChunksRetrieve, updateKnowbaseSystemChunksUpdate, partialUpdateKnowbaseSystemChunksPartialUpdate, deleteKnowbaseSystemChunksDestroy, getKnowbaseSystemChunksContextRetrieve, createKnowbaseSystemChunksVectorizeCreate, getKnowbaseSystemItemsList, createKnowbaseSystemItemsCreate, getKnowbaseSystemItemsRetrieve, updateKnowbaseSystemItemsUpdate, partialUpdateKnowbaseSystemItemsPartialUpdate, deleteKnowbaseSystemItemsDestroy, getKnowbaseSystemItemsChunksList, getKnowbaseSystemItemsContentRetrieve, apiKnowbase, enums_exports } from './chunk-GNRC54ON.js';
2
- export { API, APIClient, APIError, APILogger, ArchiveItemChunkDetailSchema, ArchiveItemChunkRequestSchema, ArchiveItemChunkSchema, ArchiveItemDetailSchema, ArchiveItemRequestSchema, ArchiveItemSchema, ArchiveProcessingResultSchema, ArchiveSearchRequestRequestSchema, ArchiveSearchResultSchema, ArchiveStatisticsSchema, ChatHistorySchema, ChatMessageSchema, ChatQueryRequestSchema, ChatResponseRequestSchema, ChatResponseSchema, ChatSessionCreateRequestSchema, ChatSessionRequestSchema, ChatSessionSchema, ChatSourceRequestSchema, ChatSourceSchema, ChunkRevectorizationRequestRequestSchema, CookieStorageAdapter, DEFAULT_RETRY_CONFIG, DocumentArchiveDetailSchema, DocumentArchiveListSchema, DocumentArchiveRequestSchema, DocumentArchiveSchema, DocumentCategoryRequestSchema, DocumentCategorySchema, DocumentCreateRequestSchema, DocumentProcessingStatusSchema, DocumentRequestSchema, DocumentSchema, DocumentStatsSchema, enums_exports as Enums, models_exports as ExtKnowbaseKnowbaseTypes, FetchAdapter, fetchers_exports as Fetchers, LocalStorageAdapter, MemoryStorageAdapter, NetworkError, PaginatedArchiveItemChunkListSchema, PaginatedArchiveItemListSchema, PaginatedArchiveSearchResultListSchema, PaginatedChatResponseListSchema, PaginatedChatSessionListSchema, PaginatedDocumentArchiveListListSchema, PaginatedDocumentListSchema, PaginatedPublicCategoryListSchema, PaginatedPublicDocumentListListSchema, PatchedArchiveItemChunkRequestSchema, PatchedArchiveItemRequestSchema, PatchedChatResponseRequestSchema, PatchedChatSessionRequestSchema, PatchedDocumentArchiveRequestSchema, PatchedDocumentRequestSchema, PublicCategorySchema, PublicDocumentListSchema, PublicDocumentSchema, REFRESH_TOKEN_KEY, schemas_exports as Schemas, TOKEN_KEY, VectorizationResultSchema, VectorizationStatisticsSchema, apiKnowbase, clearAPITokens, configureAPI, createKnowbaseAdminChatCreate, createKnowbaseAdminChatQueryCreate, createKnowbaseAdminDocumentsCreate, createKnowbaseAdminDocumentsReprocessCreate, createKnowbaseAdminSessionsActivateCreate, createKnowbaseAdminSessionsArchiveCreate, createKnowbaseAdminSessionsCreate, createKnowbaseSystemArchivesCreate, createKnowbaseSystemArchivesRevectorizeCreate, createKnowbaseSystemArchivesSearchCreate, createKnowbaseSystemChunksCreate, createKnowbaseSystemChunksVectorizeCreate, createKnowbaseSystemItemsCreate, deleteKnowbaseAdminChatDestroy, deleteKnowbaseAdminDocumentsDestroy, deleteKnowbaseAdminSessionsDestroy, deleteKnowbaseSystemArchivesDestroy, deleteKnowbaseSystemChunksDestroy, deleteKnowbaseSystemItemsDestroy, dispatchValidationError, formatZodError, getAPIInstance, getKnowbaseAdminChatHistoryRetrieve, getKnowbaseAdminChatList, getKnowbaseAdminChatRetrieve, getKnowbaseAdminDocumentsList, getKnowbaseAdminDocumentsRetrieve, getKnowbaseAdminDocumentsStatsRetrieve, getKnowbaseAdminDocumentsStatusRetrieve, getKnowbaseAdminSessionsList, getKnowbaseAdminSessionsRetrieve, getKnowbaseCategoriesList, getKnowbaseCategoriesRetrieve, getKnowbaseDocumentsList, getKnowbaseDocumentsRetrieve, getKnowbaseSystemArchivesFileTreeRetrieve, getKnowbaseSystemArchivesItemsList, getKnowbaseSystemArchivesList, getKnowbaseSystemArchivesRetrieve, getKnowbaseSystemArchivesStatisticsRetrieve, getKnowbaseSystemArchivesVectorizationStatsRetrieve, getKnowbaseSystemChunksContextRetrieve, getKnowbaseSystemChunksList, getKnowbaseSystemChunksRetrieve, getKnowbaseSystemItemsChunksList, getKnowbaseSystemItemsContentRetrieve, getKnowbaseSystemItemsList, getKnowbaseSystemItemsRetrieve, isAPIConfigured, onValidationError, partialUpdateKnowbaseAdminChatPartialUpdate, partialUpdateKnowbaseAdminDocumentsPartialUpdate, partialUpdateKnowbaseAdminSessionsPartialUpdate, partialUpdateKnowbaseSystemArchivesPartialUpdate, partialUpdateKnowbaseSystemChunksPartialUpdate, partialUpdateKnowbaseSystemItemsPartialUpdate, reconfigureAPI, resetAPI, shouldRetry, updateKnowbaseAdminChatUpdate, updateKnowbaseAdminDocumentsUpdate, updateKnowbaseAdminSessionsUpdate, updateKnowbaseSystemArchivesUpdate, updateKnowbaseSystemChunksUpdate, updateKnowbaseSystemItemsUpdate, withRetry } from './chunk-GNRC54ON.js';
3
- import useSWR, { useSWRConfig } from 'swr';
4
- import '@djangocfg/ext-base/hooks';
5
- import { createContext, useContext, useState, useCallback, useRef, useEffect } from 'react';
6
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
- import { createPortal } from 'react-dom';
8
- import { usePathname } from 'next/navigation';
9
- import { ScrollArea, Avatar, Card, CardContent, Badge, AvatarImage, AvatarFallback, Textarea, Button, Sheet, SheetContent, SheetHeader, SheetTitle, SheetDescription, useIsMobile, useLocalStorage, CardHeader } from '@djangocfg/ui-nextjs';
10
- import { Bot, ExternalLink, User, Loader2, Send, MessageSquare, Clock, Archive, Trash2, List, Plus, X, Minimize2, Maximize2 } from 'lucide-react';
11
- import { createConsola } from 'consola';
12
- import { useAuth } from '@djangocfg/api/auth';
13
- import useSWRInfinite from 'swr/infinite';
14
- import { ExtKnowbaseFetchers, apiKnowbase as apiKnowbase$1 } from '@djangocfg/api';
15
-
16
- function useKnowbaseAdminChatList(params, client) {
17
- return useSWR(
18
- params ? ["cfg-knowbase-admin-chat", params] : "cfg-knowbase-admin-chat",
19
- () => getKnowbaseAdminChatList(params, client)
20
- );
21
- }
22
- function useCreateKnowbaseAdminChatCreate() {
23
- const { mutate } = useSWRConfig();
24
- return async (data, client) => {
25
- const result = await createKnowbaseAdminChatCreate(data, client);
26
- mutate("cfg-knowbase-admin-chat");
27
- return result;
28
- };
29
- }
30
- function useKnowbaseAdminChatRetrieve(id, client) {
31
- return useSWR(
32
- ["cfg-knowbase-admin-chat", id],
33
- () => getKnowbaseAdminChatRetrieve(id, client)
34
- );
35
- }
36
- function useUpdateKnowbaseAdminChatUpdate() {
37
- const { mutate } = useSWRConfig();
38
- return async (id, data, client) => {
39
- const result = await updateKnowbaseAdminChatUpdate(id, data, client);
40
- mutate("cfg-knowbase-admin-chat");
41
- return result;
42
- };
43
- }
44
- function usePartialUpdateKnowbaseAdminChatPartialUpdate() {
45
- const { mutate } = useSWRConfig();
46
- return async (id, data, client) => {
47
- const result = await partialUpdateKnowbaseAdminChatPartialUpdate(id, data, client);
48
- mutate("cfg-knowbase-admin-chat-partial");
49
- return result;
50
- };
51
- }
52
- function useDeleteKnowbaseAdminChatDestroy() {
53
- const { mutate } = useSWRConfig();
54
- return async (id, client) => {
55
- const result = await deleteKnowbaseAdminChatDestroy(id, client);
56
- mutate("cfg-knowbase-admin-chat");
57
- return result;
58
- };
59
- }
60
- function useKnowbaseAdminChatHistoryRetrieve(id, client) {
61
- return useSWR(
62
- ["cfg-knowbase-admin-chat-history", id],
63
- () => getKnowbaseAdminChatHistoryRetrieve(id, client)
64
- );
65
- }
66
- function useCreateKnowbaseAdminChatQueryCreate() {
67
- const { mutate } = useSWRConfig();
68
- return async (data, client) => {
69
- const result = await createKnowbaseAdminChatQueryCreate(data, client);
70
- mutate("cfg-knowbase-admin-chat-query");
71
- return result;
72
- };
73
- }
74
- function useKnowbaseAdminDocumentsList(params, client) {
75
- return useSWR(
76
- params ? ["cfg-knowbase-admin-documents", params] : "cfg-knowbase-admin-documents",
77
- () => getKnowbaseAdminDocumentsList(params, client)
78
- );
79
- }
80
- function useCreateKnowbaseAdminDocumentsCreate() {
81
- const { mutate } = useSWRConfig();
82
- return async (data, client) => {
83
- const result = await createKnowbaseAdminDocumentsCreate(data, client);
84
- mutate("cfg-knowbase-admin-documents");
85
- return result;
86
- };
87
- }
88
- function useKnowbaseAdminDocumentsRetrieve(id, client) {
89
- return useSWR(
90
- ["cfg-knowbase-admin-document", id],
91
- () => getKnowbaseAdminDocumentsRetrieve(id, client)
92
- );
93
- }
94
- function useUpdateKnowbaseAdminDocumentsUpdate() {
95
- const { mutate } = useSWRConfig();
96
- return async (id, data, client) => {
97
- const result = await updateKnowbaseAdminDocumentsUpdate(id, data, client);
98
- mutate("cfg-knowbase-admin-documents");
99
- mutate("cfg-knowbase-admin-document");
100
- return result;
101
- };
102
- }
103
- function usePartialUpdateKnowbaseAdminDocumentsPartialUpdate() {
104
- const { mutate } = useSWRConfig();
105
- return async (id, data, client) => {
106
- const result = await partialUpdateKnowbaseAdminDocumentsPartialUpdate(id, data, client);
107
- mutate("cfg-knowbase-admin-documents-partial");
108
- return result;
109
- };
110
- }
111
- function useDeleteKnowbaseAdminDocumentsDestroy() {
112
- const { mutate } = useSWRConfig();
113
- return async (id, client) => {
114
- const result = await deleteKnowbaseAdminDocumentsDestroy(id, client);
115
- mutate("cfg-knowbase-admin-documents");
116
- mutate("cfg-knowbase-admin-document");
117
- return result;
118
- };
119
- }
120
- function useCreateKnowbaseAdminDocumentsReprocessCreate() {
121
- const { mutate } = useSWRConfig();
122
- return async (id, data, client) => {
123
- const result = await createKnowbaseAdminDocumentsReprocessCreate(id, data, client);
124
- mutate("cfg-knowbase-admin-documents-reprocess");
125
- return result;
126
- };
127
- }
128
- function useKnowbaseAdminDocumentsStatusRetrieve(id, client) {
129
- return useSWR(
130
- ["cfg-knowbase-admin-documents-statu", id],
131
- () => getKnowbaseAdminDocumentsStatusRetrieve(id, client)
132
- );
133
- }
134
- function useKnowbaseAdminDocumentsStatsRetrieve(client) {
135
- return useSWR(
136
- "cfg-knowbase-admin-documents-stat",
137
- () => getKnowbaseAdminDocumentsStatsRetrieve(client)
138
- );
139
- }
140
- function useKnowbaseAdminSessionsList(params, client) {
141
- return useSWR(
142
- params ? ["cfg-knowbase-admin-sessions", params] : "cfg-knowbase-admin-sessions",
143
- () => getKnowbaseAdminSessionsList(params, client)
144
- );
145
- }
146
- function useCreateKnowbaseAdminSessionsCreate() {
147
- const { mutate } = useSWRConfig();
148
- return async (data, client) => {
149
- const result = await createKnowbaseAdminSessionsCreate(data, client);
150
- mutate("cfg-knowbase-admin-sessions");
151
- return result;
152
- };
153
- }
154
- function useKnowbaseAdminSessionsRetrieve(id, client) {
155
- return useSWR(
156
- ["cfg-knowbase-admin-session", id],
157
- () => getKnowbaseAdminSessionsRetrieve(id, client)
158
- );
159
- }
160
- function useUpdateKnowbaseAdminSessionsUpdate() {
161
- const { mutate } = useSWRConfig();
162
- return async (id, data, client) => {
163
- const result = await updateKnowbaseAdminSessionsUpdate(id, data, client);
164
- mutate("cfg-knowbase-admin-sessions");
165
- mutate("cfg-knowbase-admin-session");
166
- return result;
167
- };
168
- }
169
- function usePartialUpdateKnowbaseAdminSessionsPartialUpdate() {
170
- const { mutate } = useSWRConfig();
171
- return async (id, data, client) => {
172
- const result = await partialUpdateKnowbaseAdminSessionsPartialUpdate(id, data, client);
173
- mutate("cfg-knowbase-admin-sessions-partial");
174
- return result;
175
- };
176
- }
177
- function useDeleteKnowbaseAdminSessionsDestroy() {
178
- const { mutate } = useSWRConfig();
179
- return async (id, client) => {
180
- const result = await deleteKnowbaseAdminSessionsDestroy(id, client);
181
- mutate("cfg-knowbase-admin-sessions");
182
- mutate("cfg-knowbase-admin-session");
183
- return result;
184
- };
185
- }
186
- function useCreateKnowbaseAdminSessionsActivateCreate() {
187
- const { mutate } = useSWRConfig();
188
- return async (id, data, client) => {
189
- const result = await createKnowbaseAdminSessionsActivateCreate(id, data, client);
190
- mutate("cfg-knowbase-admin-sessions-activate");
191
- return result;
192
- };
193
- }
194
- function useCreateKnowbaseAdminSessionsArchiveCreate() {
195
- const { mutate } = useSWRConfig();
196
- return async (id, data, client) => {
197
- const result = await createKnowbaseAdminSessionsArchiveCreate(id, data, client);
198
- mutate("cfg-knowbase-admin-sessions-archive");
199
- return result;
200
- };
201
- }
202
- function useKnowbaseCategoriesList(params, client) {
203
- return useSWR(
204
- params ? ["cfg-knowbase-categories", params] : "cfg-knowbase-categories",
205
- () => getKnowbaseCategoriesList(params, client)
206
- );
207
- }
208
- function useKnowbaseCategoriesRetrieve(id, client) {
209
- return useSWR(
210
- ["cfg-knowbase-categorie", id],
211
- () => getKnowbaseCategoriesRetrieve(id, client)
212
- );
213
- }
214
- function useKnowbaseDocumentsList(params, client) {
215
- return useSWR(
216
- params ? ["cfg-knowbase-documents", params] : "cfg-knowbase-documents",
217
- () => getKnowbaseDocumentsList(params, client)
218
- );
219
- }
220
- function useKnowbaseDocumentsRetrieve(id, client) {
221
- return useSWR(
222
- ["cfg-knowbase-document", id],
223
- () => getKnowbaseDocumentsRetrieve(id, client)
224
- );
225
- }
226
- function useKnowbaseSystemArchivesList(params, client) {
227
- return useSWR(
228
- params ? ["cfg-knowbase-system-archives", params] : "cfg-knowbase-system-archives",
229
- () => getKnowbaseSystemArchivesList(params, client)
230
- );
231
- }
232
- function useCreateKnowbaseSystemArchivesCreate() {
233
- const { mutate } = useSWRConfig();
234
- return async (data, client) => {
235
- const result = await createKnowbaseSystemArchivesCreate(data, client);
236
- mutate("cfg-knowbase-system-archives");
237
- return result;
238
- };
239
- }
240
- function useKnowbaseSystemArchivesRetrieve(id, client) {
241
- return useSWR(
242
- ["cfg-knowbase-system-archive", id],
243
- () => getKnowbaseSystemArchivesRetrieve(id, client)
244
- );
245
- }
246
- function useUpdateKnowbaseSystemArchivesUpdate() {
247
- const { mutate } = useSWRConfig();
248
- return async (id, data, client) => {
249
- const result = await updateKnowbaseSystemArchivesUpdate(id, data, client);
250
- mutate("cfg-knowbase-system-archives");
251
- mutate("cfg-knowbase-system-archive");
252
- return result;
253
- };
254
- }
255
- function usePartialUpdateKnowbaseSystemArchivesPartialUpdate() {
256
- const { mutate } = useSWRConfig();
257
- return async (id, data, client) => {
258
- const result = await partialUpdateKnowbaseSystemArchivesPartialUpdate(id, data, client);
259
- mutate("cfg-knowbase-system-archives-partial");
260
- return result;
261
- };
262
- }
263
- function useDeleteKnowbaseSystemArchivesDestroy() {
264
- const { mutate } = useSWRConfig();
265
- return async (id, client) => {
266
- const result = await deleteKnowbaseSystemArchivesDestroy(id, client);
267
- mutate("cfg-knowbase-system-archives");
268
- mutate("cfg-knowbase-system-archive");
269
- return result;
270
- };
271
- }
272
- function useKnowbaseSystemArchivesFileTreeRetrieve(id, client) {
273
- return useSWR(
274
- ["cfg-knowbase-system-archives-file-tree", id],
275
- () => getKnowbaseSystemArchivesFileTreeRetrieve(id, client)
276
- );
277
- }
278
- function useKnowbaseSystemArchivesItemsList(id, params, client) {
279
- return useSWR(
280
- ["cfg-knowbase-system-archives-items", id],
281
- () => getKnowbaseSystemArchivesItemsList(id, params, client)
282
- );
283
- }
284
- function useCreateKnowbaseSystemArchivesSearchCreate() {
285
- const { mutate } = useSWRConfig();
286
- return async (id, data, params, client) => {
287
- const result = await createKnowbaseSystemArchivesSearchCreate(id, data, params, client);
288
- mutate("cfg-knowbase-system-archives-search");
289
- return result;
290
- };
291
- }
292
- function useCreateKnowbaseSystemArchivesRevectorizeCreate() {
293
- const { mutate } = useSWRConfig();
294
- return async (data, client) => {
295
- const result = await createKnowbaseSystemArchivesRevectorizeCreate(data, client);
296
- mutate("cfg-knowbase-system-archives-revectorize");
297
- return result;
298
- };
299
- }
300
- function useKnowbaseSystemArchivesStatisticsRetrieve(client) {
301
- return useSWR(
302
- "cfg-knowbase-system-archives-statistic",
303
- () => getKnowbaseSystemArchivesStatisticsRetrieve(client)
304
- );
305
- }
306
- function useKnowbaseSystemArchivesVectorizationStatsRetrieve(client) {
307
- return useSWR(
308
- "cfg-knowbase-system-archives-vectorization-stat",
309
- () => getKnowbaseSystemArchivesVectorizationStatsRetrieve(client)
310
- );
311
- }
312
- function useKnowbaseSystemChunksList(params, client) {
313
- return useSWR(
314
- params ? ["cfg-knowbase-system-chunks", params] : "cfg-knowbase-system-chunks",
315
- () => getKnowbaseSystemChunksList(params, client)
316
- );
317
- }
318
- function useCreateKnowbaseSystemChunksCreate() {
319
- const { mutate } = useSWRConfig();
320
- return async (data, client) => {
321
- const result = await createKnowbaseSystemChunksCreate(data, client);
322
- mutate("cfg-knowbase-system-chunks");
323
- return result;
324
- };
325
- }
326
- function useKnowbaseSystemChunksRetrieve(id, client) {
327
- return useSWR(
328
- ["cfg-knowbase-system-chunk", id],
329
- () => getKnowbaseSystemChunksRetrieve(id, client)
330
- );
331
- }
332
- function useUpdateKnowbaseSystemChunksUpdate() {
333
- const { mutate } = useSWRConfig();
334
- return async (id, data, client) => {
335
- const result = await updateKnowbaseSystemChunksUpdate(id, data, client);
336
- mutate("cfg-knowbase-system-chunks");
337
- mutate("cfg-knowbase-system-chunk");
338
- return result;
339
- };
340
- }
341
- function usePartialUpdateKnowbaseSystemChunksPartialUpdate() {
342
- const { mutate } = useSWRConfig();
343
- return async (id, data, client) => {
344
- const result = await partialUpdateKnowbaseSystemChunksPartialUpdate(id, data, client);
345
- mutate("cfg-knowbase-system-chunks-partial");
346
- return result;
347
- };
348
- }
349
- function useDeleteKnowbaseSystemChunksDestroy() {
350
- const { mutate } = useSWRConfig();
351
- return async (id, client) => {
352
- const result = await deleteKnowbaseSystemChunksDestroy(id, client);
353
- mutate("cfg-knowbase-system-chunks");
354
- mutate("cfg-knowbase-system-chunk");
355
- return result;
356
- };
357
- }
358
- function useKnowbaseSystemChunksContextRetrieve(id, client) {
359
- return useSWR(
360
- ["cfg-knowbase-system-chunks-context", id],
361
- () => getKnowbaseSystemChunksContextRetrieve(id, client)
362
- );
363
- }
364
- function useCreateKnowbaseSystemChunksVectorizeCreate() {
365
- const { mutate } = useSWRConfig();
366
- return async (id, data, client) => {
367
- const result = await createKnowbaseSystemChunksVectorizeCreate(id, data, client);
368
- mutate("cfg-knowbase-system-chunks-vectorize");
369
- return result;
370
- };
371
- }
372
- function useKnowbaseSystemItemsList(params, client) {
373
- return useSWR(
374
- params ? ["cfg-knowbase-system-items", params] : "cfg-knowbase-system-items",
375
- () => getKnowbaseSystemItemsList(params, client)
376
- );
377
- }
378
- function useCreateKnowbaseSystemItemsCreate() {
379
- const { mutate } = useSWRConfig();
380
- return async (data, client) => {
381
- const result = await createKnowbaseSystemItemsCreate(data, client);
382
- mutate("cfg-knowbase-system-items");
383
- return result;
384
- };
385
- }
386
- function useKnowbaseSystemItemsRetrieve(id, client) {
387
- return useSWR(
388
- ["cfg-knowbase-system-item", id],
389
- () => getKnowbaseSystemItemsRetrieve(id, client)
390
- );
391
- }
392
- function useUpdateKnowbaseSystemItemsUpdate() {
393
- const { mutate } = useSWRConfig();
394
- return async (id, data, client) => {
395
- const result = await updateKnowbaseSystemItemsUpdate(id, data, client);
396
- mutate("cfg-knowbase-system-items");
397
- mutate("cfg-knowbase-system-item");
398
- return result;
399
- };
400
- }
401
- function usePartialUpdateKnowbaseSystemItemsPartialUpdate() {
402
- const { mutate } = useSWRConfig();
403
- return async (id, data, client) => {
404
- const result = await partialUpdateKnowbaseSystemItemsPartialUpdate(id, data, client);
405
- mutate("cfg-knowbase-system-items-partial");
406
- return result;
407
- };
408
- }
409
- function useDeleteKnowbaseSystemItemsDestroy() {
410
- const { mutate } = useSWRConfig();
411
- return async (id, client) => {
412
- const result = await deleteKnowbaseSystemItemsDestroy(id, client);
413
- mutate("cfg-knowbase-system-items");
414
- mutate("cfg-knowbase-system-item");
415
- return result;
416
- };
417
- }
418
- function useKnowbaseSystemItemsChunksList(id, params, client) {
419
- return useSWR(
420
- ["cfg-knowbase-system-items-chunks", id],
421
- () => getKnowbaseSystemItemsChunksList(id, params, client)
422
- );
423
- }
424
- function useKnowbaseSystemItemsContentRetrieve(id, client) {
425
- return useSWR(
426
- ["cfg-knowbase-system-items-content", id],
427
- () => getKnowbaseSystemItemsContentRetrieve(id, client)
428
- );
429
- }
430
- var KnowbaseChatContext = createContext(void 0);
431
- function KnowbaseChatProvider({ children }) {
432
- const {
433
- data: chats,
434
- error: chatsError,
435
- isLoading: isLoadingChats,
436
- mutate: mutateChats
437
- } = useKnowbaseAdminChatList({}, apiKnowbase);
438
- const refreshChats = async () => {
439
- await mutateChats();
440
- };
441
- const createChatMutation = useCreateKnowbaseAdminChatCreate();
442
- const updateChatMutation = useUpdateKnowbaseAdminChatUpdate();
443
- const partialUpdateChatMutation = usePartialUpdateKnowbaseAdminChatPartialUpdate();
444
- const deleteChatMutation = useDeleteKnowbaseAdminChatDestroy();
445
- const sendQueryMutation = useCreateKnowbaseAdminChatQueryCreate();
446
- const getChat = async (id) => {
447
- const { data } = useKnowbaseAdminChatRetrieve(id, apiKnowbase);
448
- return data;
449
- };
450
- const getChatHistory = async (id) => {
451
- const { data } = useKnowbaseAdminChatHistoryRetrieve(id, apiKnowbase);
452
- return data;
453
- };
454
- const createChat = async (data) => {
455
- const result = await createChatMutation(data, apiKnowbase);
456
- await refreshChats();
457
- return result;
458
- };
459
- const updateChat = async (id, data) => {
460
- const result = await updateChatMutation(id, data, apiKnowbase);
461
- await refreshChats();
462
- return result;
463
- };
464
- const partialUpdateChat = async (id, data) => {
465
- const result = await partialUpdateChatMutation(id, data, apiKnowbase);
466
- await refreshChats();
467
- return result;
468
- };
469
- const deleteChat = async (id) => {
470
- await deleteChatMutation(id, apiKnowbase);
471
- await refreshChats();
472
- };
473
- const sendQuery = async (data) => {
474
- const result = await sendQueryMutation(data, apiKnowbase);
475
- await refreshChats();
476
- return result;
477
- };
478
- const value = {
479
- chats,
480
- isLoadingChats,
481
- chatsError,
482
- refreshChats,
483
- getChat,
484
- getChatHistory,
485
- createChat,
486
- updateChat,
487
- partialUpdateChat,
488
- deleteChat,
489
- sendQuery
490
- };
491
- return /* @__PURE__ */ jsx(KnowbaseChatContext.Provider, { value, children });
492
- }
493
- function useKnowbaseChatContext() {
494
- const context = useContext(KnowbaseChatContext);
495
- if (!context) {
496
- throw new Error("useKnowbaseChatContext must be used within KnowbaseChatProvider");
497
- }
498
- return context;
499
- }
500
- var KnowbaseDocumentsContext = createContext(
501
- void 0
502
- );
503
- function KnowbaseDocumentsProvider({ children }) {
504
- const {
505
- data: documents,
506
- error: documentsError,
507
- isLoading: isLoadingDocuments,
508
- mutate: mutateDocuments
509
- } = useKnowbaseAdminDocumentsList({ page: 1, page_size: 1 }, apiKnowbase);
510
- const refreshDocuments = async () => {
511
- await mutateDocuments();
512
- };
513
- const {
514
- data: archives,
515
- error: archivesError,
516
- isLoading: isLoadingArchives,
517
- mutate: mutateArchives
518
- } = useKnowbaseSystemArchivesList({ page: 1, page_size: 1 }, apiKnowbase);
519
- const refreshArchives = async () => {
520
- await mutateArchives();
521
- };
522
- const createDocumentMutation = useCreateKnowbaseAdminDocumentsCreate();
523
- const updateDocumentMutation = useUpdateKnowbaseAdminDocumentsUpdate();
524
- const partialUpdateDocumentMutation = usePartialUpdateKnowbaseAdminDocumentsPartialUpdate();
525
- const deleteDocumentMutation = useDeleteKnowbaseAdminDocumentsDestroy();
526
- const reprocessDocumentMutation = useCreateKnowbaseAdminDocumentsReprocessCreate();
527
- const createArchiveMutation = useCreateKnowbaseSystemArchivesCreate();
528
- const updateArchiveMutation = useUpdateKnowbaseSystemArchivesUpdate();
529
- const partialUpdateArchiveMutation = usePartialUpdateKnowbaseSystemArchivesPartialUpdate();
530
- const deleteArchiveMutation = useDeleteKnowbaseSystemArchivesDestroy();
531
- const getDocument = async (id) => {
532
- const { data } = useKnowbaseAdminDocumentsRetrieve(id, apiKnowbase);
533
- return data;
534
- };
535
- const getDocumentStatus = async (id) => {
536
- const { data } = useKnowbaseAdminDocumentsStatusRetrieve(id, apiKnowbase);
537
- return data;
538
- };
539
- const getDocumentStats = async () => {
540
- const { data } = useKnowbaseAdminDocumentsStatsRetrieve(apiKnowbase);
541
- return data;
542
- };
543
- const createDocument = async (data) => {
544
- const result = await createDocumentMutation(data, apiKnowbase);
545
- await refreshDocuments();
546
- return result;
547
- };
548
- const updateDocument = async (id, data) => {
549
- const result = await updateDocumentMutation(id, data, apiKnowbase);
550
- await refreshDocuments();
551
- return result;
552
- };
553
- const partialUpdateDocument = async (id, data) => {
554
- const result = await partialUpdateDocumentMutation(id, data, apiKnowbase);
555
- await refreshDocuments();
556
- return result;
557
- };
558
- const deleteDocument = async (id) => {
559
- await deleteDocumentMutation(id, apiKnowbase);
560
- await refreshDocuments();
561
- };
562
- const reprocessDocument = async (id, data) => {
563
- const result = await reprocessDocumentMutation(id, data, apiKnowbase);
564
- await refreshDocuments();
565
- return result;
566
- };
567
- const getArchive = async (id) => {
568
- const { data } = useKnowbaseSystemArchivesRetrieve(id, apiKnowbase);
569
- return data;
570
- };
571
- const getArchiveStatistics = async () => {
572
- const { data } = useKnowbaseSystemArchivesStatisticsRetrieve(apiKnowbase);
573
- return data;
574
- };
575
- const createArchive = async (data) => {
576
- const result = await createArchiveMutation(data, apiKnowbase);
577
- await refreshArchives();
578
- return result;
579
- };
580
- const updateArchive = async (id, title, archive_file, description, is_public) => {
581
- const data = { title, archive_file, description, is_public };
582
- const result = await updateArchiveMutation(id, data, apiKnowbase);
583
- await refreshArchives();
584
- return result;
585
- };
586
- const partialUpdateArchive = async (id, data) => {
587
- const result = await partialUpdateArchiveMutation(id, data, apiKnowbase);
588
- await refreshArchives();
589
- return result;
590
- };
591
- const deleteArchive = async (id) => {
592
- await deleteArchiveMutation(id, apiKnowbase);
593
- await refreshArchives();
594
- };
595
- const value = {
596
- documents,
597
- isLoadingDocuments,
598
- documentsError,
599
- refreshDocuments,
600
- getDocument,
601
- getDocumentStatus,
602
- getDocumentStats,
603
- createDocument,
604
- updateDocument,
605
- partialUpdateDocument,
606
- deleteDocument,
607
- reprocessDocument,
608
- archives,
609
- isLoadingArchives,
610
- archivesError,
611
- refreshArchives,
612
- getArchive,
613
- getArchiveStatistics,
614
- createArchive,
615
- updateArchive,
616
- partialUpdateArchive,
617
- deleteArchive
618
- };
619
- return /* @__PURE__ */ jsx(KnowbaseDocumentsContext.Provider, { value, children });
620
- }
621
- function useKnowbaseDocumentsContext() {
622
- const context = useContext(KnowbaseDocumentsContext);
623
- if (!context) {
624
- throw new Error("useKnowbaseDocumentsContext must be used within KnowbaseDocumentsProvider");
625
- }
626
- return context;
627
- }
628
- var KnowbaseSessionsContext = createContext(void 0);
629
- function KnowbaseSessionsProvider({ children }) {
630
- const {
631
- data: sessions,
632
- error: sessionsError,
633
- isLoading: isLoadingSessions,
634
- mutate: mutateSessions
635
- } = useKnowbaseAdminSessionsList({ page: 1, page_size: 1 }, apiKnowbase);
636
- const refreshSessions = async () => {
637
- await mutateSessions();
638
- };
639
- const createSessionMutation = useCreateKnowbaseAdminSessionsCreate();
640
- const updateSessionMutation = useUpdateKnowbaseAdminSessionsUpdate();
641
- const partialUpdateSessionMutation = usePartialUpdateKnowbaseAdminSessionsPartialUpdate();
642
- const deleteSessionMutation = useDeleteKnowbaseAdminSessionsDestroy();
643
- const activateSessionMutation = useCreateKnowbaseAdminSessionsActivateCreate();
644
- const archiveSessionMutation = useCreateKnowbaseAdminSessionsArchiveCreate();
645
- const getSession = async (id) => {
646
- const { data } = useKnowbaseAdminSessionsRetrieve(id, apiKnowbase);
647
- return data;
648
- };
649
- const createSession = async (data) => {
650
- const result = await createSessionMutation(data, apiKnowbase);
651
- await refreshSessions();
652
- return result;
653
- };
654
- const updateSession = async (id, data) => {
655
- const result = await updateSessionMutation(id, data, apiKnowbase);
656
- await refreshSessions();
657
- return result;
658
- };
659
- const partialUpdateSession = async (id, data) => {
660
- const result = await partialUpdateSessionMutation(id, data, apiKnowbase);
661
- await refreshSessions();
662
- return result;
663
- };
664
- const deleteSession = async (id) => {
665
- await deleteSessionMutation(id, apiKnowbase);
666
- await refreshSessions();
667
- };
668
- const activateSession = async (id, data) => {
669
- const result = await activateSessionMutation(id, data, apiKnowbase);
670
- await refreshSessions();
671
- return result;
672
- };
673
- const archiveSession = async (id, data) => {
674
- const result = await archiveSessionMutation(id, data, apiKnowbase);
675
- await refreshSessions();
676
- return result;
677
- };
678
- const value = {
679
- sessions,
680
- isLoadingSessions,
681
- sessionsError,
682
- refreshSessions,
683
- getSession,
684
- createSession,
685
- updateSession,
686
- partialUpdateSession,
687
- deleteSession,
688
- activateSession,
689
- archiveSession
690
- };
691
- return /* @__PURE__ */ jsx(KnowbaseSessionsContext.Provider, { value, children });
692
- }
693
- function useKnowbaseSessionsContext() {
694
- const context = useContext(KnowbaseSessionsContext);
695
- if (!context) {
696
- throw new Error("useKnowbaseSessionsContext must be used within KnowbaseSessionsProvider");
697
- }
698
- return context;
699
- }
700
- var ChatUIContext = createContext(void 0);
701
- function ChatUIProvider({ children, initialState }) {
702
- const [uiState, setUIState] = useState({
703
- isOpen: false,
704
- isExpanded: false,
705
- isMinimized: false,
706
- showSources: true,
707
- showTimestamps: false,
708
- ...initialState
709
- });
710
- const toggleChat = useCallback(() => {
711
- setUIState((prev) => ({ ...prev, isOpen: !prev.isOpen }));
712
- }, []);
713
- const openChat = useCallback(() => {
714
- setUIState((prev) => ({ ...prev, isOpen: true }));
715
- }, []);
716
- const closeChat = useCallback(() => {
717
- setUIState((prev) => ({ ...prev, isOpen: false }));
718
- }, []);
719
- const expandChat = useCallback(() => {
720
- setUIState((prev) => ({ ...prev, isExpanded: true, isMinimized: false }));
721
- }, []);
722
- const collapseChat = useCallback(() => {
723
- setUIState((prev) => ({ ...prev, isExpanded: false }));
724
- }, []);
725
- const minimizeChat = useCallback(() => {
726
- setUIState((prev) => ({ ...prev, isMinimized: true, isExpanded: false }));
727
- }, []);
728
- const toggleSources = useCallback(() => {
729
- setUIState((prev) => ({ ...prev, showSources: !prev.showSources }));
730
- }, []);
731
- const toggleTimestamps = useCallback(() => {
732
- setUIState((prev) => ({ ...prev, showTimestamps: !prev.showTimestamps }));
733
- }, []);
734
- const value = {
735
- uiState,
736
- toggleChat,
737
- openChat,
738
- closeChat,
739
- expandChat,
740
- collapseChat,
741
- minimizeChat,
742
- toggleSources,
743
- toggleTimestamps
744
- };
745
- return /* @__PURE__ */ jsx(ChatUIContext.Provider, { value, children });
746
- }
747
- function useChatUI() {
748
- const context = useContext(ChatUIContext);
749
- if (!context) {
750
- throw new Error("useChatUI must be used within ChatUIProvider");
751
- }
752
- return context;
753
- }
754
-
755
- // src/components/Chat/types.ts
756
- var Enums = enums_exports;
757
- var isDevelopment = process.env.NODE_ENV === "development";
758
- var logger = createConsola({
759
- level: isDevelopment ? 4 : 1
760
- }).withTag("ext-knowbase");
761
- var chatLogger = logger;
762
- var MessageList = ({
763
- messages,
764
- isLoading = false,
765
- showSources = true,
766
- showTimestamps = false,
767
- autoScroll = true,
768
- className = ""
769
- }) => {
770
- const scrollRef = useRef(null);
771
- const { user } = useAuth();
772
- useEffect(() => {
773
- if (autoScroll && scrollRef.current) {
774
- const scrollContainer = scrollRef.current.querySelector("[data-radix-scroll-area-viewport]");
775
- if (scrollContainer) {
776
- scrollContainer.scrollTop = scrollContainer.scrollHeight;
777
- }
778
- }
779
- }, [messages, isLoading, autoScroll]);
780
- const formatTimestamp = (timestamp) => {
781
- const date = new Date(timestamp);
782
- return date.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" });
783
- };
784
- return /* @__PURE__ */ jsx(ScrollArea, { className: `h-full bg-muted/50 ${className}`, viewportRef: scrollRef, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 p-4", children: [
785
- messages.length === 0 && !isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full text-center py-12", children: [
786
- /* @__PURE__ */ jsx(Bot, { className: "h-12 w-12 text-muted-foreground mb-4" }),
787
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: "Start a Conversation" }),
788
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-md", children: "Ask me anything about the documentation, features, or get help with your project." })
789
- ] }) : messages.map((message, index) => {
790
- const isUser = message.role === Enums.ChatMessageRole.USER;
791
- const isAssistant = message.role === Enums.ChatMessageRole.ASSISTANT;
792
- return /* @__PURE__ */ jsxs(
793
- "div",
794
- {
795
- className: `flex gap-3 ${isUser ? "justify-end" : "justify-start"}
796
- animate-in fade-in slide-in-from-bottom-2 duration-300`,
797
- style: { animationDelay: `${index * 50}ms` },
798
- children: [
799
- isAssistant && /* @__PURE__ */ jsx(Avatar, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Bot, { className: "h-5 w-5" }) }) }),
800
- /* @__PURE__ */ jsxs(
801
- "div",
802
- {
803
- className: `flex flex-col gap-2 flex-1 max-w-[80%] ${isUser ? "items-end" : "items-start"}`,
804
- children: [
805
- /* @__PURE__ */ jsx(
806
- Card,
807
- {
808
- className: `${isUser ? "bg-primary text-primary-foreground" : "bg-muted"} transition-all duration-200 hover:shadow-md`,
809
- children: /* @__PURE__ */ jsx(CardContent, { className: "p-3", children: /* @__PURE__ */ jsx("div", { className: "text-sm whitespace-pre-wrap break-words", children: message.content }) })
810
- }
811
- ),
812
- showTimestamps && message.created_at && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground px-1", children: formatTimestamp(message.created_at) }),
813
- showSources && isAssistant && message.sources && message.sources.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 px-1 animate-in fade-in slide-in-from-left-2 duration-300 delay-100", children: message.sources.map((source, idx) => /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
814
- Badge,
815
- {
816
- variant: "secondary",
817
- className: "text-xs flex items-center gap-1 cursor-pointer \n hover:bg-secondary/80 hover:scale-105 active:scale-95 \n transition-all duration-200 animate-in fade-in zoom-in-95",
818
- style: { animationDelay: `${(idx + 1) * 100}ms` },
819
- children: [
820
- source.document_title || `Source ${idx + 1}`,
821
- /* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3" })
822
- ]
823
- }
824
- ) }, idx)) })
825
- ]
826
- }
827
- ),
828
- isUser && /* @__PURE__ */ jsxs(Avatar, { className: "h-8 w-8 shrink-0", children: [
829
- user?.avatar && /* @__PURE__ */ jsx(AvatarImage, { src: user.avatar, alt: user.display_username || user.email || "User" }),
830
- /* @__PURE__ */ jsx(AvatarFallback, { className: "bg-primary/10 text-primary font-semibold", children: user?.display_username?.charAt(0)?.toUpperCase() || user?.email?.charAt(0)?.toUpperCase() || /* @__PURE__ */ jsx(User, { className: "h-5 w-5" }) })
831
- ] })
832
- ]
833
- },
834
- message.id
835
- );
836
- }),
837
- isLoading && /* @__PURE__ */ jsxs("div", { className: "flex gap-3 justify-start animate-in fade-in slide-in-from-bottom-2 duration-300", children: [
838
- /* @__PURE__ */ jsx(Avatar, { className: "h-8 w-8 shrink-0 animate-pulse", children: /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx(Bot, { className: "h-5 w-5 animate-bounce" }) }) }),
839
- /* @__PURE__ */ jsx(Card, { className: "bg-muted animate-pulse", children: /* @__PURE__ */ jsx(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [
840
- /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
841
- /* @__PURE__ */ jsx("span", { className: "animate-pulse", children: "Thinking..." })
842
- ] }) }) })
843
- ] })
844
- ] }) });
845
- };
846
- var MessageInput = ({
847
- onSend,
848
- isLoading = false,
849
- disabled = false,
850
- placeholder = "Ask me anything...",
851
- className = ""
852
- }) => {
853
- const [message, setMessage] = useState("");
854
- const [rows, setRows] = useState(1);
855
- const textareaRef = useRef(null);
856
- useEffect(() => {
857
- if (textareaRef.current) {
858
- const lineHeight = 24;
859
- const maxRows = 5;
860
- const minRows = 1;
861
- if (!message) {
862
- textareaRef.current.style.height = "auto";
863
- setRows(minRows);
864
- return;
865
- }
866
- textareaRef.current.style.height = "auto";
867
- const scrollHeight = textareaRef.current.scrollHeight;
868
- const newRows = Math.max(minRows, Math.min(maxRows, Math.floor(scrollHeight / lineHeight)));
869
- setRows(newRows);
870
- }
871
- }, [message]);
872
- const handleSubmit = useCallback(
873
- async (e) => {
874
- e?.preventDefault();
875
- const trimmedMessage = message.trim();
876
- if (!trimmedMessage || isLoading || disabled) return;
877
- try {
878
- await onSend(trimmedMessage);
879
- setMessage("");
880
- setRows(1);
881
- if (textareaRef.current) {
882
- textareaRef.current.style.height = "auto";
883
- }
884
- } catch (error) {
885
- chatLogger.error("Failed to send message from input:", error);
886
- }
887
- },
888
- [message, isLoading, disabled, onSend]
889
- );
890
- const handleKeyDown = useCallback(
891
- (e) => {
892
- if (e.key === "Enter" && !e.shiftKey) {
893
- e.preventDefault();
894
- handleSubmit();
895
- }
896
- },
897
- [handleSubmit]
898
- );
899
- const isDisabled = disabled || isLoading;
900
- const canSend = message.trim().length > 0 && !isDisabled;
901
- return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: `border-t p-4 ${className}`, children: [
902
- /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
903
- /* @__PURE__ */ jsx(
904
- Textarea,
905
- {
906
- ref: textareaRef,
907
- value: message,
908
- onChange: (e) => setMessage(e.target.value),
909
- onKeyDown: handleKeyDown,
910
- placeholder,
911
- disabled: isDisabled,
912
- rows,
913
- className: "resize-none min-h-[40px] max-h-[120px] transition-all duration-200 \n focus:ring-2 focus:ring-primary/20",
914
- style: { resize: "none" }
915
- }
916
- ),
917
- /* @__PURE__ */ jsx(
918
- Button,
919
- {
920
- type: "submit",
921
- size: "icon",
922
- disabled: !canSend,
923
- className: "shrink-0 h-10 w-10 transition-all duration-200 \n hover:scale-110 active:scale-95 disabled:scale-100",
924
- children: isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx(Send, { className: "h-4 w-4" })
925
- }
926
- )
927
- ] }),
928
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "Press Enter to send, Shift+Enter for new line" })
929
- ] });
930
- };
931
- var PAGE_SIZE = 20;
932
- function useInfiniteSessions() {
933
- const getKey = (pageIndex, previousPageData) => {
934
- if (previousPageData && !previousPageData.has_next) return null;
935
- if (pageIndex === 0) return ["cfg-knowbase-admin-sessions-infinite", 1, PAGE_SIZE];
936
- return ["cfg-knowbase-admin-sessions-infinite", pageIndex + 1, PAGE_SIZE];
937
- };
938
- const fetcher = async ([, page, pageSize]) => {
939
- return ExtKnowbaseFetchers.getKnowbaseAdminSessionsList(
940
- { page, page_size: pageSize },
941
- apiKnowbase$1
942
- );
943
- };
944
- const {
945
- data,
946
- error,
947
- isLoading,
948
- isValidating,
949
- size,
950
- setSize,
951
- mutate
952
- } = useSWRInfinite(getKey, fetcher, {
953
- revalidateFirstPage: false,
954
- parallel: false
955
- });
956
- const sessions = data ? data.flatMap((page) => page.results) : [];
957
- const hasMore = data && data[data.length - 1]?.has_next;
958
- const totalCount = data && data[data.length - 1]?.count;
959
- const isLoadingMore = isValidating && data && typeof data[size - 1] !== "undefined";
960
- const loadMore = () => {
961
- if (hasMore && !isLoadingMore) {
962
- setSize(size + 1);
963
- }
964
- };
965
- const refresh = async () => {
966
- await mutate();
967
- };
968
- return {
969
- sessions,
970
- isLoading,
971
- isLoadingMore: isLoadingMore || false,
972
- error,
973
- hasMore: hasMore || false,
974
- totalCount: totalCount || 0,
975
- loadMore,
976
- refresh
977
- };
978
- }
979
- var SessionList = ({
980
- isOpen,
981
- onClose,
982
- onSelectSession,
983
- className = ""
984
- }) => {
985
- const { deleteSession, archiveSession } = useKnowbaseSessionsContext();
986
- const {
987
- sessions,
988
- isLoading,
989
- isLoadingMore,
990
- hasMore,
991
- loadMore
992
- } = useInfiniteSessions();
993
- const scrollRef = useRef(null);
994
- const handleScroll = useCallback(() => {
995
- if (!scrollRef.current || isLoadingMore || !hasMore) return;
996
- const scrollContainer = scrollRef.current.querySelector("[data-radix-scroll-area-viewport]");
997
- if (!scrollContainer) return;
998
- const { scrollTop, scrollHeight, clientHeight } = scrollContainer;
999
- const scrollPercentage = (scrollTop + clientHeight) / scrollHeight;
1000
- if (scrollPercentage > 0.8) {
1001
- loadMore();
1002
- }
1003
- }, [hasMore, isLoadingMore, loadMore]);
1004
- useEffect(() => {
1005
- const scrollContainer = scrollRef.current?.querySelector("[data-radix-scroll-area-viewport]");
1006
- if (!scrollContainer) return;
1007
- scrollContainer.addEventListener("scroll", handleScroll);
1008
- return () => scrollContainer.removeEventListener("scroll", handleScroll);
1009
- }, [handleScroll]);
1010
- const formatDate = (dateString) => {
1011
- const date = new Date(dateString);
1012
- return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
1013
- };
1014
- return /* @__PURE__ */ jsx(Sheet, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(SheetContent, { side: "left", className: `w-[400px] sm:w-[540px] ${className}`, children: [
1015
- /* @__PURE__ */ jsxs(SheetHeader, { children: [
1016
- /* @__PURE__ */ jsx(SheetTitle, { children: "Chat Sessions" }),
1017
- /* @__PURE__ */ jsx(SheetDescription, { children: "View and manage your chat history" })
1018
- ] }),
1019
- /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-120px)] mt-6", viewportRef: scrollRef, children: isLoading ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin text-muted-foreground" }) }) : !sessions || sessions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-12 text-center", children: [
1020
- /* @__PURE__ */ jsx(MessageSquare, { className: "h-12 w-12 text-muted-foreground mb-4" }),
1021
- /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-foreground mb-2", children: "No Sessions Yet" }),
1022
- /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-md", children: "Start a new conversation to create your first session." })
1023
- ] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
1024
- sessions.map((session, index) => /* @__PURE__ */ jsxs(
1025
- "div",
1026
- {
1027
- className: "group relative flex items-start gap-3 p-4 border rounded-sm \n hover:bg-muted/50 hover:border-primary/50 hover:shadow-md\n transition-all duration-200 cursor-pointer\n animate-in fade-in slide-in-from-left-2",
1028
- style: { animationDelay: `${index * 50}ms` },
1029
- onClick: () => {
1030
- onSelectSession(session.id);
1031
- onClose();
1032
- },
1033
- children: [
1034
- /* @__PURE__ */ jsx("div", { className: "shrink-0 mt-1", children: /* @__PURE__ */ jsx(MessageSquare, { className: "h-5 w-5 text-muted-foreground" }) }),
1035
- /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
1036
- /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2 mb-1", children: [
1037
- /* @__PURE__ */ jsx("h4", { className: "font-medium text-sm truncate", children: session.title || "Untitled Session" }),
1038
- session.is_active && /* @__PURE__ */ jsx(Badge, { variant: "default", className: "shrink-0 text-xs", children: "Active" })
1039
- ] }),
1040
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
1041
- /* @__PURE__ */ jsx(Clock, { className: "h-3 w-3" }),
1042
- /* @__PURE__ */ jsx("span", { children: formatDate(session.created_at) })
1043
- ] })
1044
- ] }),
1045
- /* @__PURE__ */ jsxs("div", { className: "shrink-0 flex items-center gap-1 opacity-0 group-hover:opacity-100 \n transition-all duration-200 group-hover:translate-x-0 translate-x-2", children: [
1046
- /* @__PURE__ */ jsx(
1047
- Button,
1048
- {
1049
- variant: "ghost",
1050
- size: "sm",
1051
- className: "h-8 w-8 p-0 hover:scale-110 active:scale-95 transition-transform duration-200",
1052
- onClick: (e) => {
1053
- e.stopPropagation();
1054
- archiveSession(session.id, {});
1055
- },
1056
- title: "Archive",
1057
- children: /* @__PURE__ */ jsx(Archive, { className: "h-4 w-4" })
1058
- }
1059
- ),
1060
- /* @__PURE__ */ jsx(
1061
- Button,
1062
- {
1063
- variant: "ghost",
1064
- size: "sm",
1065
- className: "h-8 w-8 p-0 text-destructive hover:text-destructive \n hover:scale-110 active:scale-95 transition-transform duration-200",
1066
- onClick: (e) => {
1067
- e.stopPropagation();
1068
- deleteSession(session.id);
1069
- },
1070
- title: "Delete",
1071
- children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
1072
- }
1073
- )
1074
- ] })
1075
- ]
1076
- },
1077
- session.id
1078
- )),
1079
- isLoadingMore && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-6", children: [
1080
- /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin text-muted-foreground mr-2" }),
1081
- /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: "Loading more..." })
1082
- ] }),
1083
- !hasMore && sessions.length > 0 && /* @__PURE__ */ jsx("div", { className: "text-center py-4", children: /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "No more sessions" }) })
1084
- ] }) })
1085
- ] }) });
1086
- };
1087
- var WIDGET_MAX_WIDTH = 800;
1088
- var WIDGET_MAX_HEIGHT = 900;
1089
- var ChatWidget = ({
1090
- autoOpen = false,
1091
- persistent = true,
1092
- className = "",
1093
- onToggle,
1094
- onMessage
1095
- }) => {
1096
- const { sendQuery, getChatHistory } = useKnowbaseChatContext();
1097
- const { createSession, getSession } = useKnowbaseSessionsContext();
1098
- const {
1099
- uiState,
1100
- toggleChat,
1101
- expandChat,
1102
- collapseChat,
1103
- toggleSources,
1104
- toggleTimestamps
1105
- } = useChatUI();
1106
- const pathname = usePathname();
1107
- const isMobile = useIsMobile();
1108
- const [isLoading, setIsLoading] = useState(false);
1109
- const [showSessions, setShowSessions] = useState(false);
1110
- const [mounted, setMounted] = useState(false);
1111
- const [currentSessionId, setCurrentSessionId] = useLocalStorage(
1112
- "chat_session_id",
1113
- null
1114
- );
1115
- const [messages, setMessages] = useLocalStorage(
1116
- "chat_messages",
1117
- []
1118
- );
1119
- const isSupport = pathname.startsWith("/private/support");
1120
- const isContact = pathname.startsWith("/private/contact");
1121
- useEffect(() => {
1122
- setMounted(true);
1123
- }, []);
1124
- useEffect(() => {
1125
- if (isSupport || isContact) {
1126
- setMounted(false);
1127
- } else {
1128
- setMounted(true);
1129
- }
1130
- }, [isSupport, isContact]);
1131
- useEffect(() => {
1132
- if (autoOpen && !uiState.isOpen) {
1133
- toggleChat();
1134
- }
1135
- }, [autoOpen, uiState.isOpen, toggleChat]);
1136
- useEffect(() => {
1137
- if (onToggle) {
1138
- onToggle(uiState.isOpen);
1139
- }
1140
- }, [uiState.isOpen, onToggle]);
1141
- useEffect(() => {
1142
- if (currentSessionId) {
1143
- if (messages.length === 0) {
1144
- loadChatHistory(currentSessionId);
1145
- }
1146
- }
1147
- }, [currentSessionId]);
1148
- const loadChatHistory = async (sessionId) => {
1149
- try {
1150
- const history = await getChatHistory(sessionId);
1151
- if (history?.messages) {
1152
- const messagesWithSources = history.messages.map((msg) => ({
1153
- ...msg,
1154
- sources: void 0
1155
- // Sources come from ChatResponse, not ChatMessage
1156
- }));
1157
- setMessages(messagesWithSources);
1158
- }
1159
- } catch (error) {
1160
- chatLogger.error("Failed to load chat history:", error);
1161
- setCurrentSessionId(null);
1162
- setMessages([]);
1163
- }
1164
- };
1165
- const handleSendMessage = useCallback(
1166
- async (message) => {
1167
- try {
1168
- setIsLoading(true);
1169
- let sessionId = currentSessionId;
1170
- if (!sessionId) {
1171
- try {
1172
- const newSession = await createSession({
1173
- title: message.substring(0, 50)
1174
- // Use first 50 chars as title
1175
- });
1176
- sessionId = newSession.id;
1177
- setCurrentSessionId(sessionId);
1178
- chatLogger.info("Created new chat session:", sessionId);
1179
- } catch (error) {
1180
- chatLogger.error("Failed to create session:", error);
1181
- }
1182
- }
1183
- const userMessage = {
1184
- id: `temp-${Date.now()}`,
1185
- role: Enums.ChatMessageRole.USER,
1186
- content: message,
1187
- cost_usd: 0,
1188
- created_at: (/* @__PURE__ */ new Date()).toISOString()
1189
- };
1190
- const updatedMessages = [...messages, userMessage];
1191
- setMessages(updatedMessages);
1192
- const response = await sendQuery({
1193
- query: message,
1194
- session_id: sessionId || void 0
1195
- });
1196
- if (response) {
1197
- const assistantMessage = {
1198
- id: response.message_id,
1199
- role: Enums.ChatMessageRole.ASSISTANT,
1200
- content: response.content,
1201
- cost_usd: response.cost_usd,
1202
- tokens_used: response.tokens_used,
1203
- processing_time_ms: response.processing_time_ms,
1204
- created_at: (/* @__PURE__ */ new Date()).toISOString(),
1205
- sources: response.sources || void 0
1206
- };
1207
- const finalMessages = [...updatedMessages, assistantMessage];
1208
- setMessages(finalMessages);
1209
- if (onMessage) {
1210
- onMessage(assistantMessage);
1211
- }
1212
- }
1213
- } catch (error) {
1214
- chatLogger.error("Failed to send message:", error);
1215
- throw error;
1216
- } finally {
1217
- setIsLoading(false);
1218
- }
1219
- },
1220
- [sendQuery, currentSessionId, createSession, setCurrentSessionId, messages, setMessages, onMessage]
1221
- );
1222
- const handleNewChat = useCallback(() => {
1223
- setMessages([]);
1224
- setCurrentSessionId(null);
1225
- }, [setMessages, setCurrentSessionId]);
1226
- const handleSelectSession = useCallback((sessionId) => {
1227
- setMessages([]);
1228
- setCurrentSessionId(sessionId);
1229
- }, [setMessages, setCurrentSessionId]);
1230
- if (!mounted) {
1231
- return null;
1232
- }
1233
- if (!uiState.isOpen && !persistent) {
1234
- return null;
1235
- }
1236
- if (isMobile) {
1237
- const mobileContent = /* @__PURE__ */ jsxs(Fragment, { children: [
1238
- /* @__PURE__ */ jsx(
1239
- "div",
1240
- {
1241
- className: `fixed inset-0 z-9999 bg-background ${uiState.isOpen ? "block" : "hidden"} ${className}`,
1242
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
1243
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b bg-background shadow-sm", children: [
1244
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1245
- /* @__PURE__ */ jsx(MessageSquare, { className: "h-5 w-5 text-primary" }),
1246
- /* @__PURE__ */ jsx("h2", { className: "font-semibold text-foreground", children: "Knowledge Assistant" })
1247
- ] }),
1248
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1249
- /* @__PURE__ */ jsx(
1250
- Button,
1251
- {
1252
- variant: "ghost",
1253
- size: "sm",
1254
- onClick: () => setShowSessions(true),
1255
- className: "text-muted-foreground hover:text-foreground",
1256
- title: "Sessions",
1257
- children: /* @__PURE__ */ jsx(List, { className: "h-5 w-5" })
1258
- }
1259
- ),
1260
- /* @__PURE__ */ jsx(
1261
- Button,
1262
- {
1263
- variant: "ghost",
1264
- size: "sm",
1265
- onClick: handleNewChat,
1266
- className: "text-muted-foreground hover:text-foreground",
1267
- title: "New Chat",
1268
- children: /* @__PURE__ */ jsx(Plus, { className: "h-5 w-5" })
1269
- }
1270
- ),
1271
- /* @__PURE__ */ jsx(
1272
- Button,
1273
- {
1274
- variant: "ghost",
1275
- size: "sm",
1276
- onClick: toggleChat,
1277
- className: "text-muted-foreground hover:text-foreground",
1278
- children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
1279
- }
1280
- )
1281
- ] })
1282
- ] }),
1283
- /* @__PURE__ */ jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", children: [
1284
- /* @__PURE__ */ jsx(
1285
- MessageList,
1286
- {
1287
- messages,
1288
- isLoading,
1289
- showSources: uiState.showSources,
1290
- showTimestamps: uiState.showTimestamps,
1291
- autoScroll: true,
1292
- className: "flex-1"
1293
- }
1294
- ),
1295
- /* @__PURE__ */ jsx(
1296
- MessageInput,
1297
- {
1298
- onSend: handleSendMessage,
1299
- isLoading,
1300
- placeholder: "Ask me anything..."
1301
- }
1302
- )
1303
- ] })
1304
- ] })
1305
- }
1306
- ),
1307
- /* @__PURE__ */ jsx(
1308
- SessionList,
1309
- {
1310
- isOpen: showSessions,
1311
- onClose: () => setShowSessions(false),
1312
- onSelectSession: handleSelectSession
1313
- }
1314
- )
1315
- ] });
1316
- return createPortal(mobileContent, document.body);
1317
- }
1318
- const widgetWidth = uiState.isExpanded ? WIDGET_MAX_WIDTH : 400;
1319
- const widgetHeight = uiState.isExpanded ? WIDGET_MAX_HEIGHT : 600;
1320
- const widgetStyle = uiState.isExpanded ? {
1321
- position: "fixed",
1322
- top: "24px",
1323
- bottom: "24px",
1324
- right: "24px",
1325
- left: "auto",
1326
- width: widgetWidth,
1327
- height: "auto",
1328
- zIndex: 40,
1329
- transformOrigin: "bottom right"
1330
- } : {
1331
- position: "fixed",
1332
- bottom: "24px",
1333
- right: "24px",
1334
- width: widgetWidth,
1335
- height: widgetHeight,
1336
- zIndex: 40,
1337
- transformOrigin: "bottom right"
1338
- };
1339
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
1340
- uiState.isOpen && /* @__PURE__ */ jsx(
1341
- "div",
1342
- {
1343
- className: "fixed z-40 \n animate-in fade-in zoom-in-95 slide-in-from-bottom-8 \n duration-500 ease-out",
1344
- style: widgetStyle,
1345
- children: /* @__PURE__ */ jsxs(Card, { className: "h-full flex flex-col shadow-2xl border-2 border-primary/20", children: [
1346
- /* @__PURE__ */ jsxs(CardHeader, { className: "flex-row items-center justify-between space-y-0 pb-3 border-b", children: [
1347
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1348
- /* @__PURE__ */ jsx(MessageSquare, { className: "h-5 w-5 text-primary" }),
1349
- /* @__PURE__ */ jsx("h3", { className: "font-semibold text-foreground", children: "Support" })
1350
- ] }),
1351
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1352
- /* @__PURE__ */ jsx(
1353
- Button,
1354
- {
1355
- variant: "ghost",
1356
- size: "sm",
1357
- onClick: () => setShowSessions(true),
1358
- className: "h-8 w-8 p-0",
1359
- title: "Sessions",
1360
- children: /* @__PURE__ */ jsx(List, { className: "h-4 w-4" })
1361
- }
1362
- ),
1363
- /* @__PURE__ */ jsx(
1364
- Button,
1365
- {
1366
- variant: "ghost",
1367
- size: "sm",
1368
- onClick: handleNewChat,
1369
- className: "h-8 w-8 p-0",
1370
- title: "New Chat",
1371
- children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" })
1372
- }
1373
- ),
1374
- /* @__PURE__ */ jsx(
1375
- Button,
1376
- {
1377
- variant: "ghost",
1378
- size: "sm",
1379
- onClick: uiState.isExpanded ? collapseChat : expandChat,
1380
- className: "h-8 w-8 p-0",
1381
- title: uiState.isExpanded ? "Collapse" : "Expand",
1382
- children: uiState.isExpanded ? /* @__PURE__ */ jsx(Minimize2, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(Maximize2, { className: "h-4 w-4" })
1383
- }
1384
- ),
1385
- /* @__PURE__ */ jsx(
1386
- Button,
1387
- {
1388
- variant: "ghost",
1389
- size: "sm",
1390
- onClick: toggleChat,
1391
- className: "h-8 w-8 p-0",
1392
- title: "Close",
1393
- children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
1394
- }
1395
- )
1396
- ] })
1397
- ] }),
1398
- /* @__PURE__ */ jsxs(CardContent, { className: "flex-1 flex flex-col p-0 overflow-hidden", children: [
1399
- /* @__PURE__ */ jsx(
1400
- MessageList,
1401
- {
1402
- messages,
1403
- isLoading,
1404
- showSources: uiState.showSources,
1405
- showTimestamps: uiState.showTimestamps,
1406
- autoScroll: true,
1407
- className: "flex-1"
1408
- }
1409
- ),
1410
- /* @__PURE__ */ jsx(
1411
- MessageInput,
1412
- {
1413
- onSend: handleSendMessage,
1414
- isLoading,
1415
- placeholder: "Ask me anything..."
1416
- }
1417
- )
1418
- ] })
1419
- ] })
1420
- }
1421
- ),
1422
- !uiState.isOpen && persistent && /* @__PURE__ */ jsxs(
1423
- "div",
1424
- {
1425
- className: "fixed z-40 animate-in fade-in zoom-in-95 slide-in-from-bottom-8 duration-500",
1426
- style: {
1427
- bottom: "24px",
1428
- right: "24px",
1429
- zIndex: 40,
1430
- width: "64px",
1431
- height: "64px",
1432
- borderRadius: "50%",
1433
- animation: "pulse-shadow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite"
1434
- },
1435
- children: [
1436
- /* @__PURE__ */ jsx("style", { children: `
1437
- @keyframes pulse-shadow {
1438
- 0%, 100% {
1439
- box-shadow: 0 0 0 0 hsl(var(--primary) / 0.7);
1440
- }
1441
- 50% {
1442
- box-shadow: 0 0 0 20px hsl(var(--primary) / 0);
1443
- }
1444
- }
1445
- ` }),
1446
- /* @__PURE__ */ jsx(
1447
- Button,
1448
- {
1449
- onClick: toggleChat,
1450
- className: "w-full h-full rounded-full shadow-2xl \n hover:scale-110 hover:rotate-12 active:scale-95 \n transition-all duration-300 ease-out\n flex items-center justify-center\n group",
1451
- style: {
1452
- backgroundColor: "hsl(var(--primary))",
1453
- borderRadius: "50%",
1454
- padding: 0
1455
- },
1456
- title: "Open Support Chat",
1457
- "aria-label": "Open Support Chat",
1458
- children: /* @__PURE__ */ jsx(
1459
- MessageSquare,
1460
- {
1461
- className: "h-7 w-7 text-primary-foreground group-hover:scale-110 transition-transform duration-300",
1462
- strokeWidth: 2
1463
- }
1464
- )
1465
- }
1466
- )
1467
- ]
1468
- }
1469
- ),
1470
- /* @__PURE__ */ jsx(
1471
- SessionList,
1472
- {
1473
- isOpen: showSessions,
1474
- onClose: () => setShowSessions(false),
1475
- onSelectSession: handleSelectSession
1476
- }
1477
- )
1478
- ] });
1479
- return createPortal(content, document.body);
1480
- };
1481
- var KnowledgeChat = (props) => {
1482
- return /* @__PURE__ */ jsx(KnowbaseChatProvider, { children: /* @__PURE__ */ jsx(KnowbaseSessionsProvider, { children: /* @__PURE__ */ jsx(ChatUIProvider, { initialState: { isOpen: false }, children: /* @__PURE__ */ jsx(ChatWidget, { ...props }) }) }) });
1483
- };
1484
- var Chat_default = KnowledgeChat;
1485
-
1486
- export { Chat_default as Chat, ChatUIProvider, ChatWidget, KnowbaseChatProvider, KnowbaseDocumentsProvider, KnowbaseSessionsProvider, KnowledgeChat, MessageInput, MessageList, SessionList, useChatUI, useCreateKnowbaseAdminChatCreate, useCreateKnowbaseAdminChatQueryCreate, useCreateKnowbaseAdminDocumentsCreate, useCreateKnowbaseAdminDocumentsReprocessCreate, useCreateKnowbaseAdminSessionsActivateCreate, useCreateKnowbaseAdminSessionsArchiveCreate, useCreateKnowbaseAdminSessionsCreate, useCreateKnowbaseSystemArchivesCreate, useCreateKnowbaseSystemArchivesRevectorizeCreate, useCreateKnowbaseSystemArchivesSearchCreate, useCreateKnowbaseSystemChunksCreate, useCreateKnowbaseSystemChunksVectorizeCreate, useCreateKnowbaseSystemItemsCreate, useDeleteKnowbaseAdminChatDestroy, useDeleteKnowbaseAdminDocumentsDestroy, useDeleteKnowbaseAdminSessionsDestroy, useDeleteKnowbaseSystemArchivesDestroy, useDeleteKnowbaseSystemChunksDestroy, useDeleteKnowbaseSystemItemsDestroy, useKnowbaseAdminChatHistoryRetrieve, useKnowbaseAdminChatList, useKnowbaseAdminChatRetrieve, useKnowbaseAdminDocumentsList, useKnowbaseAdminDocumentsRetrieve, useKnowbaseAdminDocumentsStatsRetrieve, useKnowbaseAdminDocumentsStatusRetrieve, useKnowbaseAdminSessionsList, useKnowbaseAdminSessionsRetrieve, useKnowbaseCategoriesList, useKnowbaseCategoriesRetrieve, useKnowbaseChatContext, useKnowbaseDocumentsContext, useKnowbaseDocumentsList, useKnowbaseDocumentsRetrieve, useKnowbaseSessionsContext, useKnowbaseSystemArchivesFileTreeRetrieve, useKnowbaseSystemArchivesItemsList, useKnowbaseSystemArchivesList, useKnowbaseSystemArchivesRetrieve, useKnowbaseSystemArchivesStatisticsRetrieve, useKnowbaseSystemArchivesVectorizationStatsRetrieve, useKnowbaseSystemChunksContextRetrieve, useKnowbaseSystemChunksList, useKnowbaseSystemChunksRetrieve, useKnowbaseSystemItemsChunksList, useKnowbaseSystemItemsContentRetrieve, useKnowbaseSystemItemsList, useKnowbaseSystemItemsRetrieve, usePartialUpdateKnowbaseAdminChatPartialUpdate, usePartialUpdateKnowbaseAdminDocumentsPartialUpdate, usePartialUpdateKnowbaseAdminSessionsPartialUpdate, usePartialUpdateKnowbaseSystemArchivesPartialUpdate, usePartialUpdateKnowbaseSystemChunksPartialUpdate, usePartialUpdateKnowbaseSystemItemsPartialUpdate, useUpdateKnowbaseAdminChatUpdate, useUpdateKnowbaseAdminDocumentsUpdate, useUpdateKnowbaseAdminSessionsUpdate, useUpdateKnowbaseSystemArchivesUpdate, useUpdateKnowbaseSystemChunksUpdate, useUpdateKnowbaseSystemItemsUpdate };