@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/index.cjs DELETED
@@ -1,4450 +0,0 @@
1
- 'use strict';
2
-
3
- var consola = require('consola');
4
- var pRetry = require('p-retry');
5
- var zod = require('zod');
6
- var api = require('@djangocfg/ext-base/api');
7
-
8
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
9
-
10
- var pRetry__default = /*#__PURE__*/_interopDefault(pRetry);
11
-
12
- var __defProp = Object.defineProperty;
13
- var __export = (target, all) => {
14
- for (var name in all)
15
- __defProp(target, name, { get: all[name], enumerable: true });
16
- };
17
-
18
- // src/api/generated/ext_knowbase/ext_knowbase__knowbase/client.ts
19
- var ExtKnowbaseKnowbase = class {
20
- client;
21
- constructor(client) {
22
- this.client = client;
23
- }
24
- /**
25
- * Chat query endpoints.
26
- */
27
- async adminChatList(...args) {
28
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
29
- let params;
30
- if (isParamsObject) {
31
- params = args[0];
32
- } else {
33
- params = { page: args[0], page_size: args[1] };
34
- }
35
- const response = await this.client.request("GET", "/cfg/knowbase/admin/chat/", { params });
36
- return response;
37
- }
38
- /**
39
- * Chat query endpoints.
40
- */
41
- async adminChatCreate(data) {
42
- const response = await this.client.request("POST", "/cfg/knowbase/admin/chat/", { body: data });
43
- return response;
44
- }
45
- /**
46
- * Chat query endpoints.
47
- */
48
- async adminChatRetrieve(id) {
49
- const response = await this.client.request("GET", `/cfg/knowbase/admin/chat/${id}/`);
50
- return response;
51
- }
52
- /**
53
- * Chat query endpoints.
54
- */
55
- async adminChatUpdate(id, data) {
56
- const response = await this.client.request("PUT", `/cfg/knowbase/admin/chat/${id}/`, { body: data });
57
- return response;
58
- }
59
- /**
60
- * Chat query endpoints.
61
- */
62
- async adminChatPartialUpdate(id, data) {
63
- const response = await this.client.request("PATCH", `/cfg/knowbase/admin/chat/${id}/`, { body: data });
64
- return response;
65
- }
66
- /**
67
- * Chat query endpoints.
68
- */
69
- async adminChatDestroy(id) {
70
- await this.client.request("DELETE", `/cfg/knowbase/admin/chat/${id}/`);
71
- return;
72
- }
73
- /**
74
- * Get chat history
75
- *
76
- * Get chat session history.
77
- */
78
- async adminChatHistoryRetrieve(id) {
79
- const response = await this.client.request("GET", `/cfg/knowbase/admin/chat/${id}/history/`);
80
- return response;
81
- }
82
- /**
83
- * Process chat query with RAG
84
- *
85
- * Process chat query with RAG context.
86
- */
87
- async adminChatQueryCreate(data) {
88
- const response = await this.client.request("POST", "/cfg/knowbase/admin/chat/query/", { body: data });
89
- return response;
90
- }
91
- /**
92
- * List user documents
93
- *
94
- * List user documents with filtering and pagination.
95
- */
96
- async adminDocumentsList(...args) {
97
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
98
- let params;
99
- if (isParamsObject) {
100
- params = args[0];
101
- } else {
102
- params = { page: args[0], page_size: args[1], status: args[2] };
103
- }
104
- const response = await this.client.request("GET", "/cfg/knowbase/admin/documents/", { params });
105
- return response;
106
- }
107
- /**
108
- * Upload new document
109
- *
110
- * Upload and process a new knowledge document
111
- */
112
- async adminDocumentsCreate(data) {
113
- const response = await this.client.request("POST", "/cfg/knowbase/admin/documents/", { body: data });
114
- return response;
115
- }
116
- /**
117
- * Get document details
118
- *
119
- * Get document by ID.
120
- */
121
- async adminDocumentsRetrieve(id) {
122
- const response = await this.client.request("GET", `/cfg/knowbase/admin/documents/${id}/`);
123
- return response;
124
- }
125
- /**
126
- * Document management endpoints - Admin only.
127
- */
128
- async adminDocumentsUpdate(id, data) {
129
- const response = await this.client.request("PUT", `/cfg/knowbase/admin/documents/${id}/`, { body: data });
130
- return response;
131
- }
132
- /**
133
- * Document management endpoints - Admin only.
134
- */
135
- async adminDocumentsPartialUpdate(id, data) {
136
- const response = await this.client.request("PATCH", `/cfg/knowbase/admin/documents/${id}/`, { body: data });
137
- return response;
138
- }
139
- /**
140
- * Delete document
141
- *
142
- * Delete document and all associated chunks.
143
- */
144
- async adminDocumentsDestroy(id) {
145
- await this.client.request("DELETE", `/cfg/knowbase/admin/documents/${id}/`);
146
- return;
147
- }
148
- /**
149
- * Reprocess document
150
- *
151
- * Trigger reprocessing of document chunks and embeddings
152
- */
153
- async adminDocumentsReprocessCreate(id, data) {
154
- const response = await this.client.request("POST", `/cfg/knowbase/admin/documents/${id}/reprocess/`, { body: data });
155
- return response;
156
- }
157
- /**
158
- * Get document processing status
159
- *
160
- * Get document processing status.
161
- */
162
- async adminDocumentsStatusRetrieve(id) {
163
- const response = await this.client.request("GET", `/cfg/knowbase/admin/documents/${id}/status/`);
164
- return response;
165
- }
166
- /**
167
- * Get processing statistics
168
- *
169
- * Get user's document processing statistics.
170
- */
171
- async adminDocumentsStatsRetrieve() {
172
- const response = await this.client.request("GET", "/cfg/knowbase/admin/documents/stats/");
173
- return response;
174
- }
175
- /**
176
- * List user chat sessions
177
- *
178
- * List user chat sessions with filtering.
179
- */
180
- async adminSessionsList(...args) {
181
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
182
- let params;
183
- if (isParamsObject) {
184
- params = args[0];
185
- } else {
186
- params = { page: args[0], page_size: args[1] };
187
- }
188
- const response = await this.client.request("GET", "/cfg/knowbase/admin/sessions/", { params });
189
- return response;
190
- }
191
- /**
192
- * Create new chat session
193
- *
194
- * Create new chat session.
195
- */
196
- async adminSessionsCreate(data) {
197
- const response = await this.client.request("POST", "/cfg/knowbase/admin/sessions/", { body: data });
198
- return response;
199
- }
200
- /**
201
- * Chat session management endpoints.
202
- */
203
- async adminSessionsRetrieve(id) {
204
- const response = await this.client.request("GET", `/cfg/knowbase/admin/sessions/${id}/`);
205
- return response;
206
- }
207
- /**
208
- * Chat session management endpoints.
209
- */
210
- async adminSessionsUpdate(id, data) {
211
- const response = await this.client.request("PUT", `/cfg/knowbase/admin/sessions/${id}/`, { body: data });
212
- return response;
213
- }
214
- /**
215
- * Chat session management endpoints.
216
- */
217
- async adminSessionsPartialUpdate(id, data) {
218
- const response = await this.client.request("PATCH", `/cfg/knowbase/admin/sessions/${id}/`, { body: data });
219
- return response;
220
- }
221
- /**
222
- * Chat session management endpoints.
223
- */
224
- async adminSessionsDestroy(id) {
225
- await this.client.request("DELETE", `/cfg/knowbase/admin/sessions/${id}/`);
226
- return;
227
- }
228
- /**
229
- * Activate chat session
230
- *
231
- * Activate chat session.
232
- */
233
- async adminSessionsActivateCreate(id, data) {
234
- const response = await this.client.request("POST", `/cfg/knowbase/admin/sessions/${id}/activate/`, { body: data });
235
- return response;
236
- }
237
- /**
238
- * Archive chat session
239
- *
240
- * Archive (deactivate) chat session.
241
- */
242
- async adminSessionsArchiveCreate(id, data) {
243
- const response = await this.client.request("POST", `/cfg/knowbase/admin/sessions/${id}/archive/`, { body: data });
244
- return response;
245
- }
246
- /**
247
- * List public categories
248
- *
249
- * Get list of all public categories
250
- */
251
- async categoriesList(...args) {
252
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
253
- let params;
254
- if (isParamsObject) {
255
- params = args[0];
256
- } else {
257
- params = { page: args[0], page_size: args[1] };
258
- }
259
- const response = await this.client.request("GET", "/cfg/knowbase/categories/", { params });
260
- return response;
261
- }
262
- /**
263
- * Get public category details
264
- *
265
- * Get category details by ID (public access)
266
- */
267
- async categoriesRetrieve(id) {
268
- const response = await this.client.request("GET", `/cfg/knowbase/categories/${id}/`);
269
- return response;
270
- }
271
- /**
272
- * List public documents
273
- *
274
- * Get list of all completed and publicly accessible documents
275
- */
276
- async documentsList(...args) {
277
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
278
- let params;
279
- if (isParamsObject) {
280
- params = args[0];
281
- } else {
282
- params = { category: args[0], page: args[1], page_size: args[2], search: args[3] };
283
- }
284
- const response = await this.client.request("GET", "/cfg/knowbase/documents/", { params });
285
- return response;
286
- }
287
- /**
288
- * Get public document details
289
- *
290
- * Get document details by ID (public access)
291
- */
292
- async documentsRetrieve(id) {
293
- const response = await this.client.request("GET", `/cfg/knowbase/documents/${id}/`);
294
- return response;
295
- }
296
- /**
297
- * Document archive management endpoints - Admin only.
298
- */
299
- async systemArchivesList(...args) {
300
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
301
- let params;
302
- if (isParamsObject) {
303
- params = args[0];
304
- } else {
305
- params = { page: args[0], page_size: args[1] };
306
- }
307
- const response = await this.client.request("GET", "/cfg/knowbase/system/archives/", { params });
308
- return response;
309
- }
310
- /**
311
- * Upload and process archive
312
- *
313
- * Upload archive file and process it synchronously
314
- */
315
- async systemArchivesCreate(data) {
316
- const response = await this.client.request("POST", "/cfg/knowbase/system/archives/", { formData: data });
317
- return response;
318
- }
319
- /**
320
- * Document archive management endpoints - Admin only.
321
- */
322
- async systemArchivesRetrieve(id) {
323
- const response = await this.client.request("GET", `/cfg/knowbase/system/archives/${id}/`);
324
- return response;
325
- }
326
- /**
327
- * Document archive management endpoints - Admin only.
328
- */
329
- async systemArchivesUpdate(id, data) {
330
- const formData = new FormData();
331
- formData.append("title", String(data.title));
332
- if (data.description !== void 0) formData.append("description", String(data.description));
333
- if (data.is_public !== void 0) formData.append("is_public", String(data.is_public));
334
- const response = await this.client.request("PUT", `/cfg/knowbase/system/archives/${id}/`, { formData });
335
- return response;
336
- }
337
- /**
338
- * Document archive management endpoints - Admin only.
339
- */
340
- async systemArchivesPartialUpdate(id, data) {
341
- const response = await this.client.request("PATCH", `/cfg/knowbase/system/archives/${id}/`, { body: data });
342
- return response;
343
- }
344
- /**
345
- * Document archive management endpoints - Admin only.
346
- */
347
- async systemArchivesDestroy(id) {
348
- await this.client.request("DELETE", `/cfg/knowbase/system/archives/${id}/`);
349
- return;
350
- }
351
- /**
352
- * Get archive file tree
353
- *
354
- * Get hierarchical file tree structure
355
- */
356
- async systemArchivesFileTreeRetrieve(id) {
357
- const response = await this.client.request("GET", `/cfg/knowbase/system/archives/${id}/file_tree/`);
358
- return response;
359
- }
360
- /**
361
- * Get archive items
362
- *
363
- * Get all items in the archive
364
- */
365
- async systemArchivesItemsList(...args) {
366
- const id = args[0];
367
- const isParamsObject = args.length === 2 && typeof args[1] === "object" && args[1] !== null && !Array.isArray(args[1]);
368
- let params;
369
- if (isParamsObject) {
370
- params = args[1];
371
- } else {
372
- params = { page: args[1], page_size: args[2] };
373
- }
374
- const response = await this.client.request("GET", `/cfg/knowbase/system/archives/${id}/items/`, { params });
375
- return response;
376
- }
377
- /**
378
- * Search archive chunks
379
- *
380
- * Semantic search within archive chunks
381
- */
382
- async systemArchivesSearchCreate(...args) {
383
- const id = args[0];
384
- const data = args[1];
385
- const isParamsObject = args.length === 3 && typeof args[2] === "object" && args[2] !== null && !Array.isArray(args[2]);
386
- let params;
387
- if (isParamsObject) {
388
- params = args[2];
389
- } else {
390
- params = { page: args[2], page_size: args[3] };
391
- }
392
- const formData = new FormData();
393
- formData.append("query", String(data.query));
394
- if (data.content_types !== void 0) formData.append("content_types", String(data.content_types));
395
- if (data.languages !== void 0) formData.append("languages", String(data.languages));
396
- if (data.chunk_types !== void 0) formData.append("chunk_types", String(data.chunk_types));
397
- if (data.archive_ids !== void 0) formData.append("archive_ids", String(data.archive_ids));
398
- if (data.limit !== void 0) formData.append("limit", String(data.limit));
399
- if (data.similarity_threshold !== void 0) formData.append("similarity_threshold", String(data.similarity_threshold));
400
- const response = await this.client.request("POST", `/cfg/knowbase/system/archives/${id}/search/`, { params, formData });
401
- return response;
402
- }
403
- /**
404
- * Re-vectorize chunks
405
- *
406
- * Re-vectorize specific chunks
407
- */
408
- async systemArchivesRevectorizeCreate(data) {
409
- const formData = new FormData();
410
- formData.append("chunk_ids", String(data.chunk_ids));
411
- if (data.force !== void 0) formData.append("force", String(data.force));
412
- const response = await this.client.request("POST", "/cfg/knowbase/system/archives/revectorize/", { formData });
413
- return response;
414
- }
415
- /**
416
- * Get archive statistics
417
- *
418
- * Get processing and vectorization statistics
419
- */
420
- async systemArchivesStatisticsRetrieve() {
421
- const response = await this.client.request("GET", "/cfg/knowbase/system/archives/statistics/");
422
- return response;
423
- }
424
- /**
425
- * Get vectorization statistics
426
- *
427
- * Get vectorization statistics for archives
428
- */
429
- async systemArchivesVectorizationStatsRetrieve() {
430
- const response = await this.client.request("GET", "/cfg/knowbase/system/archives/vectorization_stats/");
431
- return response;
432
- }
433
- /**
434
- * Archive item chunk management endpoints - Admin only.
435
- */
436
- async systemChunksList(...args) {
437
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
438
- let params;
439
- if (isParamsObject) {
440
- params = args[0];
441
- } else {
442
- params = { page: args[0], page_size: args[1] };
443
- }
444
- const response = await this.client.request("GET", "/cfg/knowbase/system/chunks/", { params });
445
- return response;
446
- }
447
- /**
448
- * Archive item chunk management endpoints - Admin only.
449
- */
450
- async systemChunksCreate(data) {
451
- const response = await this.client.request("POST", "/cfg/knowbase/system/chunks/", { body: data });
452
- return response;
453
- }
454
- /**
455
- * Archive item chunk management endpoints - Admin only.
456
- */
457
- async systemChunksRetrieve(id) {
458
- const response = await this.client.request("GET", `/cfg/knowbase/system/chunks/${id}/`);
459
- return response;
460
- }
461
- /**
462
- * Archive item chunk management endpoints - Admin only.
463
- */
464
- async systemChunksUpdate(id, data) {
465
- const response = await this.client.request("PUT", `/cfg/knowbase/system/chunks/${id}/`, { body: data });
466
- return response;
467
- }
468
- /**
469
- * Archive item chunk management endpoints - Admin only.
470
- */
471
- async systemChunksPartialUpdate(id, data) {
472
- const response = await this.client.request("PATCH", `/cfg/knowbase/system/chunks/${id}/`, { body: data });
473
- return response;
474
- }
475
- /**
476
- * Archive item chunk management endpoints - Admin only.
477
- */
478
- async systemChunksDestroy(id) {
479
- await this.client.request("DELETE", `/cfg/knowbase/system/chunks/${id}/`);
480
- return;
481
- }
482
- /**
483
- * Get chunk context
484
- *
485
- * Get full context metadata for chunk
486
- */
487
- async systemChunksContextRetrieve(id) {
488
- const response = await this.client.request("GET", `/cfg/knowbase/system/chunks/${id}/context/`);
489
- return response;
490
- }
491
- /**
492
- * Vectorize chunk
493
- *
494
- * Generate embedding for specific chunk
495
- */
496
- async systemChunksVectorizeCreate(id, data) {
497
- const response = await this.client.request("POST", `/cfg/knowbase/system/chunks/${id}/vectorize/`, { body: data });
498
- return response;
499
- }
500
- /**
501
- * Archive item management endpoints - Admin only.
502
- */
503
- async systemItemsList(...args) {
504
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
505
- let params;
506
- if (isParamsObject) {
507
- params = args[0];
508
- } else {
509
- params = { page: args[0], page_size: args[1] };
510
- }
511
- const response = await this.client.request("GET", "/cfg/knowbase/system/items/", { params });
512
- return response;
513
- }
514
- /**
515
- * Archive item management endpoints - Admin only.
516
- */
517
- async systemItemsCreate(data) {
518
- const response = await this.client.request("POST", "/cfg/knowbase/system/items/", { body: data });
519
- return response;
520
- }
521
- /**
522
- * Archive item management endpoints - Admin only.
523
- */
524
- async systemItemsRetrieve(id) {
525
- const response = await this.client.request("GET", `/cfg/knowbase/system/items/${id}/`);
526
- return response;
527
- }
528
- /**
529
- * Archive item management endpoints - Admin only.
530
- */
531
- async systemItemsUpdate(id, data) {
532
- const response = await this.client.request("PUT", `/cfg/knowbase/system/items/${id}/`, { body: data });
533
- return response;
534
- }
535
- /**
536
- * Archive item management endpoints - Admin only.
537
- */
538
- async systemItemsPartialUpdate(id, data) {
539
- const response = await this.client.request("PATCH", `/cfg/knowbase/system/items/${id}/`, { body: data });
540
- return response;
541
- }
542
- /**
543
- * Archive item management endpoints - Admin only.
544
- */
545
- async systemItemsDestroy(id) {
546
- await this.client.request("DELETE", `/cfg/knowbase/system/items/${id}/`);
547
- return;
548
- }
549
- /**
550
- * Get item chunks
551
- *
552
- * Get all chunks for this item
553
- */
554
- async systemItemsChunksList(...args) {
555
- const id = args[0];
556
- const isParamsObject = args.length === 2 && typeof args[1] === "object" && args[1] !== null && !Array.isArray(args[1]);
557
- let params;
558
- if (isParamsObject) {
559
- params = args[1];
560
- } else {
561
- params = { page: args[1], page_size: args[2] };
562
- }
563
- const response = await this.client.request("GET", `/cfg/knowbase/system/items/${id}/chunks/`, { params });
564
- return response;
565
- }
566
- /**
567
- * Get item content
568
- *
569
- * Get full content of archive item
570
- */
571
- async systemItemsContentRetrieve(id) {
572
- const response = await this.client.request("GET", `/cfg/knowbase/system/items/${id}/content/`);
573
- return response;
574
- }
575
- };
576
-
577
- // src/api/generated/ext_knowbase/ext_knowbase__knowbase/models.ts
578
- var models_exports = {};
579
-
580
- // src/api/generated/ext_knowbase/http.ts
581
- var FetchAdapter = class {
582
- async request(request) {
583
- const { method, url, headers, body, params, formData } = request;
584
- let finalUrl = url;
585
- if (params) {
586
- const searchParams = new URLSearchParams();
587
- Object.entries(params).forEach(([key, value]) => {
588
- if (value !== null && value !== void 0) {
589
- searchParams.append(key, String(value));
590
- }
591
- });
592
- const queryString = searchParams.toString();
593
- if (queryString) {
594
- finalUrl = url.includes("?") ? `${url}&${queryString}` : `${url}?${queryString}`;
595
- }
596
- }
597
- const finalHeaders = { ...headers };
598
- let requestBody;
599
- if (formData) {
600
- requestBody = formData;
601
- } else if (body) {
602
- finalHeaders["Content-Type"] = "application/json";
603
- requestBody = JSON.stringify(body);
604
- }
605
- const response = await fetch(finalUrl, {
606
- method,
607
- headers: finalHeaders,
608
- body: requestBody,
609
- credentials: "include"
610
- // Include Django session cookies
611
- });
612
- let data = null;
613
- const contentType = response.headers.get("content-type");
614
- if (response.status !== 204 && contentType?.includes("application/json")) {
615
- data = await response.json();
616
- } else if (response.status !== 204) {
617
- data = await response.text();
618
- }
619
- const responseHeaders = {};
620
- response.headers.forEach((value, key) => {
621
- responseHeaders[key] = value;
622
- });
623
- return {
624
- data,
625
- status: response.status,
626
- statusText: response.statusText,
627
- headers: responseHeaders
628
- };
629
- }
630
- };
631
-
632
- // src/api/generated/ext_knowbase/errors.ts
633
- var APIError = class extends Error {
634
- constructor(statusCode, statusText, response, url, message) {
635
- super(message || `HTTP ${statusCode}: ${statusText}`);
636
- this.statusCode = statusCode;
637
- this.statusText = statusText;
638
- this.response = response;
639
- this.url = url;
640
- this.name = "APIError";
641
- }
642
- /**
643
- * Get error details from response.
644
- * DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
645
- */
646
- get details() {
647
- if (typeof this.response === "object" && this.response !== null) {
648
- return this.response;
649
- }
650
- return null;
651
- }
652
- /**
653
- * Get field-specific validation errors from DRF.
654
- * Returns: { "field_name": ["error1", "error2"], ... }
655
- */
656
- get fieldErrors() {
657
- const details = this.details;
658
- if (!details) return null;
659
- const fieldErrors = {};
660
- for (const [key, value] of Object.entries(details)) {
661
- if (Array.isArray(value)) {
662
- fieldErrors[key] = value;
663
- }
664
- }
665
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
666
- }
667
- /**
668
- * Get single error message from DRF.
669
- * Checks for "detail", "message", or first field error.
670
- */
671
- get errorMessage() {
672
- const details = this.details;
673
- if (!details) return this.message;
674
- if (details.detail) {
675
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
676
- }
677
- if (details.message) {
678
- return String(details.message);
679
- }
680
- const fieldErrors = this.fieldErrors;
681
- if (fieldErrors) {
682
- const firstField = Object.keys(fieldErrors)[0];
683
- if (firstField) {
684
- return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
685
- }
686
- }
687
- return this.message;
688
- }
689
- // Helper methods for common HTTP status codes
690
- get isValidationError() {
691
- return this.statusCode === 400;
692
- }
693
- get isAuthError() {
694
- return this.statusCode === 401;
695
- }
696
- get isPermissionError() {
697
- return this.statusCode === 403;
698
- }
699
- get isNotFoundError() {
700
- return this.statusCode === 404;
701
- }
702
- get isServerError() {
703
- return this.statusCode >= 500 && this.statusCode < 600;
704
- }
705
- };
706
- var NetworkError = class extends Error {
707
- constructor(message, url, originalError) {
708
- super(message);
709
- this.url = url;
710
- this.originalError = originalError;
711
- this.name = "NetworkError";
712
- }
713
- };
714
- var DEFAULT_CONFIG = {
715
- enabled: process.env.NODE_ENV !== "production",
716
- logRequests: true,
717
- logResponses: true,
718
- logErrors: true,
719
- logBodies: true,
720
- logHeaders: false
721
- };
722
- var SENSITIVE_HEADERS = [
723
- "authorization",
724
- "cookie",
725
- "set-cookie",
726
- "x-api-key",
727
- "x-csrf-token"
728
- ];
729
- var APILogger = class {
730
- config;
731
- consola;
732
- constructor(config = {}) {
733
- this.config = { ...DEFAULT_CONFIG, ...config };
734
- this.consola = config.consola || consola.createConsola({
735
- level: this.config.enabled ? 4 : 0
736
- });
737
- }
738
- /**
739
- * Enable logging
740
- */
741
- enable() {
742
- this.config.enabled = true;
743
- }
744
- /**
745
- * Disable logging
746
- */
747
- disable() {
748
- this.config.enabled = false;
749
- }
750
- /**
751
- * Update configuration
752
- */
753
- setConfig(config) {
754
- this.config = { ...this.config, ...config };
755
- }
756
- /**
757
- * Filter sensitive headers
758
- */
759
- filterHeaders(headers) {
760
- if (!headers) return {};
761
- const filtered = {};
762
- Object.keys(headers).forEach((key) => {
763
- const lowerKey = key.toLowerCase();
764
- if (SENSITIVE_HEADERS.includes(lowerKey)) {
765
- filtered[key] = "***";
766
- } else {
767
- filtered[key] = headers[key] || "";
768
- }
769
- });
770
- return filtered;
771
- }
772
- /**
773
- * Log request
774
- */
775
- logRequest(request) {
776
- if (!this.config.enabled || !this.config.logRequests) return;
777
- const { method, url, headers, body } = request;
778
- this.consola.start(`${method} ${url}`);
779
- if (this.config.logHeaders && headers) {
780
- this.consola.debug("Headers:", this.filterHeaders(headers));
781
- }
782
- if (this.config.logBodies && body) {
783
- this.consola.debug("Body:", body);
784
- }
785
- }
786
- /**
787
- * Log response
788
- */
789
- logResponse(request, response) {
790
- if (!this.config.enabled || !this.config.logResponses) return;
791
- const { method, url } = request;
792
- const { status, statusText, data, duration } = response;
793
- this.consola.success(
794
- `${method} ${url} ${status} ${statusText} (${duration}ms)`
795
- );
796
- if (this.config.logBodies && data) {
797
- this.consola.debug("Response:", data);
798
- }
799
- }
800
- /**
801
- * Log error
802
- */
803
- logError(request, error) {
804
- if (!this.config.enabled || !this.config.logErrors) return;
805
- const { method, url } = request;
806
- const { message, statusCode, fieldErrors, duration } = error;
807
- this.consola.error(
808
- `${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
809
- );
810
- this.consola.error("Message:", message);
811
- if (fieldErrors && Object.keys(fieldErrors).length > 0) {
812
- this.consola.error("Field Errors:");
813
- Object.entries(fieldErrors).forEach(([field, errors]) => {
814
- errors.forEach((err) => {
815
- this.consola.error(` \u2022 ${field}: ${err}`);
816
- });
817
- });
818
- }
819
- }
820
- /**
821
- * Log general info
822
- */
823
- info(message, ...args) {
824
- if (!this.config.enabled) return;
825
- this.consola.info(message, ...args);
826
- }
827
- /**
828
- * Log warning
829
- */
830
- warn(message, ...args) {
831
- if (!this.config.enabled) return;
832
- this.consola.warn(message, ...args);
833
- }
834
- /**
835
- * Log error
836
- */
837
- error(message, ...args) {
838
- if (!this.config.enabled) return;
839
- this.consola.error(message, ...args);
840
- }
841
- /**
842
- * Log debug
843
- */
844
- debug(message, ...args) {
845
- if (!this.config.enabled) return;
846
- this.consola.debug(message, ...args);
847
- }
848
- /**
849
- * Log success
850
- */
851
- success(message, ...args) {
852
- if (!this.config.enabled) return;
853
- this.consola.success(message, ...args);
854
- }
855
- /**
856
- * Create a sub-logger with prefix
857
- */
858
- withTag(tag) {
859
- return this.consola.withTag(tag);
860
- }
861
- };
862
- new APILogger();
863
- var DEFAULT_RETRY_CONFIG = {
864
- retries: 3,
865
- factor: 2,
866
- minTimeout: 1e3,
867
- maxTimeout: 6e4,
868
- randomize: true,
869
- onFailedAttempt: () => {
870
- }
871
- };
872
- function shouldRetry(error) {
873
- if (error instanceof NetworkError) {
874
- return true;
875
- }
876
- if (error instanceof APIError) {
877
- const status = error.statusCode;
878
- if (status >= 500 && status < 600) {
879
- return true;
880
- }
881
- if (status === 429) {
882
- return true;
883
- }
884
- return false;
885
- }
886
- return true;
887
- }
888
- async function withRetry(fn, config) {
889
- const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
890
- return pRetry__default.default(
891
- async () => {
892
- try {
893
- return await fn();
894
- } catch (error) {
895
- if (!shouldRetry(error)) {
896
- throw new pRetry.AbortError(error);
897
- }
898
- throw error;
899
- }
900
- },
901
- {
902
- retries: finalConfig.retries,
903
- factor: finalConfig.factor,
904
- minTimeout: finalConfig.minTimeout,
905
- maxTimeout: finalConfig.maxTimeout,
906
- randomize: finalConfig.randomize,
907
- onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
908
- const pRetryError = error;
909
- finalConfig.onFailedAttempt({
910
- error: pRetryError,
911
- attemptNumber: pRetryError.attemptNumber,
912
- retriesLeft: pRetryError.retriesLeft
913
- });
914
- } : void 0
915
- }
916
- );
917
- }
918
-
919
- // src/api/generated/ext_knowbase/client.ts
920
- var APIClient = class {
921
- baseUrl;
922
- httpClient;
923
- logger = null;
924
- retryConfig = null;
925
- // Sub-clients
926
- ext_knowbase_knowbase;
927
- constructor(baseUrl, options) {
928
- this.baseUrl = baseUrl.replace(/\/$/, "");
929
- this.httpClient = options?.httpClient || new FetchAdapter();
930
- if (options?.loggerConfig !== void 0) {
931
- this.logger = new APILogger(options.loggerConfig);
932
- }
933
- if (options?.retryConfig !== void 0) {
934
- this.retryConfig = options.retryConfig;
935
- }
936
- this.ext_knowbase_knowbase = new ExtKnowbaseKnowbase(this);
937
- }
938
- /**
939
- * Get CSRF token from cookies (for SessionAuthentication).
940
- *
941
- * Returns null if cookie doesn't exist (JWT-only auth).
942
- */
943
- getCsrfToken() {
944
- const name = "csrftoken";
945
- const value = `; ${document.cookie}`;
946
- const parts = value.split(`; ${name}=`);
947
- if (parts.length === 2) {
948
- return parts.pop()?.split(";").shift() || null;
949
- }
950
- return null;
951
- }
952
- /**
953
- * Make HTTP request with Django CSRF and session handling.
954
- * Automatically retries on network errors and 5xx server errors.
955
- */
956
- async request(method, path, options) {
957
- if (this.retryConfig) {
958
- return withRetry(() => this._makeRequest(method, path, options), {
959
- ...this.retryConfig,
960
- onFailedAttempt: (info) => {
961
- if (this.logger) {
962
- this.logger.warn(
963
- `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} for ${method} ${path}: ${info.error.message}`
964
- );
965
- }
966
- this.retryConfig?.onFailedAttempt?.(info);
967
- }
968
- });
969
- }
970
- return this._makeRequest(method, path, options);
971
- }
972
- /**
973
- * Internal request method (without retry wrapper).
974
- * Used by request() method with optional retry logic.
975
- */
976
- async _makeRequest(method, path, options) {
977
- const url = this.baseUrl ? `${this.baseUrl}${path}` : path;
978
- const startTime = Date.now();
979
- const headers = {
980
- ...options?.headers || {}
981
- };
982
- if (!options?.formData && !headers["Content-Type"]) {
983
- headers["Content-Type"] = "application/json";
984
- }
985
- if (this.logger) {
986
- this.logger.logRequest({
987
- method,
988
- url,
989
- headers,
990
- body: options?.formData || options?.body,
991
- timestamp: startTime
992
- });
993
- }
994
- try {
995
- const response = await this.httpClient.request({
996
- method,
997
- url,
998
- headers,
999
- params: options?.params,
1000
- body: options?.body,
1001
- formData: options?.formData
1002
- });
1003
- const duration = Date.now() - startTime;
1004
- if (response.status >= 400) {
1005
- const error = new APIError(
1006
- response.status,
1007
- response.statusText,
1008
- response.data,
1009
- url
1010
- );
1011
- if (this.logger) {
1012
- this.logger.logError(
1013
- {
1014
- method,
1015
- url,
1016
- headers,
1017
- body: options?.formData || options?.body,
1018
- timestamp: startTime
1019
- },
1020
- {
1021
- message: error.message,
1022
- statusCode: response.status,
1023
- duration,
1024
- timestamp: Date.now()
1025
- }
1026
- );
1027
- }
1028
- throw error;
1029
- }
1030
- if (this.logger) {
1031
- this.logger.logResponse(
1032
- {
1033
- method,
1034
- url,
1035
- headers,
1036
- body: options?.formData || options?.body,
1037
- timestamp: startTime
1038
- },
1039
- {
1040
- status: response.status,
1041
- statusText: response.statusText,
1042
- data: response.data,
1043
- duration,
1044
- timestamp: Date.now()
1045
- }
1046
- );
1047
- }
1048
- return response.data;
1049
- } catch (error) {
1050
- const duration = Date.now() - startTime;
1051
- if (error instanceof APIError) {
1052
- throw error;
1053
- }
1054
- const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
1055
- if (this.logger) {
1056
- if (isCORSError) {
1057
- this.logger.error(`\u{1F6AB} CORS Error: ${method} ${url}`);
1058
- this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
1059
- this.logger.error(` \u2192 Configure security_domains parameter on the server`);
1060
- } else {
1061
- this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
1062
- this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
1063
- }
1064
- }
1065
- if (typeof window !== "undefined") {
1066
- try {
1067
- if (isCORSError) {
1068
- window.dispatchEvent(new CustomEvent("cors-error", {
1069
- detail: {
1070
- url,
1071
- method,
1072
- error: error instanceof Error ? error.message : String(error),
1073
- timestamp: /* @__PURE__ */ new Date()
1074
- },
1075
- bubbles: true,
1076
- cancelable: false
1077
- }));
1078
- } else {
1079
- window.dispatchEvent(new CustomEvent("network-error", {
1080
- detail: {
1081
- url,
1082
- method,
1083
- error: error instanceof Error ? error.message : String(error),
1084
- timestamp: /* @__PURE__ */ new Date()
1085
- },
1086
- bubbles: true,
1087
- cancelable: false
1088
- }));
1089
- }
1090
- } catch (eventError) {
1091
- }
1092
- }
1093
- const networkError = error instanceof Error ? new NetworkError(error.message, url, error) : new NetworkError("Unknown error", url);
1094
- if (this.logger) {
1095
- this.logger.logError(
1096
- {
1097
- method,
1098
- url,
1099
- headers,
1100
- body: options?.formData || options?.body,
1101
- timestamp: startTime
1102
- },
1103
- {
1104
- message: networkError.message,
1105
- duration,
1106
- timestamp: Date.now()
1107
- }
1108
- );
1109
- }
1110
- throw networkError;
1111
- }
1112
- }
1113
- };
1114
-
1115
- // src/api/generated/ext_knowbase/storage.ts
1116
- var LocalStorageAdapter = class {
1117
- logger;
1118
- constructor(logger) {
1119
- this.logger = logger;
1120
- }
1121
- getItem(key) {
1122
- try {
1123
- if (typeof window !== "undefined" && window.localStorage) {
1124
- const value = localStorage.getItem(key);
1125
- this.logger?.debug(`LocalStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
1126
- return value;
1127
- }
1128
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
1129
- } catch (error) {
1130
- this.logger?.error("LocalStorage.getItem failed:", error);
1131
- }
1132
- return null;
1133
- }
1134
- setItem(key, value) {
1135
- try {
1136
- if (typeof window !== "undefined" && window.localStorage) {
1137
- localStorage.setItem(key, value);
1138
- this.logger?.debug(`LocalStorage.setItem("${key}"): success`);
1139
- } else {
1140
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
1141
- }
1142
- } catch (error) {
1143
- this.logger?.error("LocalStorage.setItem failed:", error);
1144
- }
1145
- }
1146
- removeItem(key) {
1147
- try {
1148
- if (typeof window !== "undefined" && window.localStorage) {
1149
- localStorage.removeItem(key);
1150
- this.logger?.debug(`LocalStorage.removeItem("${key}"): success`);
1151
- } else {
1152
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
1153
- }
1154
- } catch (error) {
1155
- this.logger?.error("LocalStorage.removeItem failed:", error);
1156
- }
1157
- }
1158
- };
1159
- var CookieStorageAdapter = class {
1160
- logger;
1161
- constructor(logger) {
1162
- this.logger = logger;
1163
- }
1164
- getItem(key) {
1165
- try {
1166
- if (typeof document === "undefined") {
1167
- this.logger?.warn("Cookies not available: document is undefined (SSR context?)");
1168
- return null;
1169
- }
1170
- const value = `; ${document.cookie}`;
1171
- const parts = value.split(`; ${key}=`);
1172
- if (parts.length === 2) {
1173
- const result = parts.pop()?.split(";").shift() || null;
1174
- this.logger?.debug(`CookieStorage.getItem("${key}"): ${result ? "found" : "not found"}`);
1175
- return result;
1176
- }
1177
- this.logger?.debug(`CookieStorage.getItem("${key}"): not found`);
1178
- } catch (error) {
1179
- this.logger?.error("CookieStorage.getItem failed:", error);
1180
- }
1181
- return null;
1182
- }
1183
- setItem(key, value) {
1184
- try {
1185
- if (typeof document !== "undefined") {
1186
- document.cookie = `${key}=${value}; path=/; max-age=31536000`;
1187
- this.logger?.debug(`CookieStorage.setItem("${key}"): success`);
1188
- } else {
1189
- this.logger?.warn("Cookies not available: document is undefined (SSR context?)");
1190
- }
1191
- } catch (error) {
1192
- this.logger?.error("CookieStorage.setItem failed:", error);
1193
- }
1194
- }
1195
- removeItem(key) {
1196
- try {
1197
- if (typeof document !== "undefined") {
1198
- document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;
1199
- this.logger?.debug(`CookieStorage.removeItem("${key}"): success`);
1200
- } else {
1201
- this.logger?.warn("Cookies not available: document is undefined (SSR context?)");
1202
- }
1203
- } catch (error) {
1204
- this.logger?.error("CookieStorage.removeItem failed:", error);
1205
- }
1206
- }
1207
- };
1208
- var MemoryStorageAdapter = class {
1209
- storage = /* @__PURE__ */ new Map();
1210
- logger;
1211
- constructor(logger) {
1212
- this.logger = logger;
1213
- }
1214
- getItem(key) {
1215
- const value = this.storage.get(key) || null;
1216
- this.logger?.debug(`MemoryStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
1217
- return value;
1218
- }
1219
- setItem(key, value) {
1220
- this.storage.set(key, value);
1221
- this.logger?.debug(`MemoryStorage.setItem("${key}"): success`);
1222
- }
1223
- removeItem(key) {
1224
- this.storage.delete(key);
1225
- this.logger?.debug(`MemoryStorage.removeItem("${key}"): success`);
1226
- }
1227
- };
1228
-
1229
- // src/api/generated/ext_knowbase/enums.ts
1230
- var enums_exports = {};
1231
- __export(enums_exports, {
1232
- ArchiveItemChunkChunkType: () => ArchiveItemChunkChunkType,
1233
- ArchiveItemChunkDetailChunkType: () => ArchiveItemChunkDetailChunkType,
1234
- ArchiveItemChunkRequestChunkType: () => ArchiveItemChunkRequestChunkType,
1235
- ArchiveItemContentType: () => ArchiveItemContentType,
1236
- ArchiveItemDetailContentType: () => ArchiveItemDetailContentType,
1237
- ArchiveSearchRequestRequestChunkTypesItems: () => ArchiveSearchRequestRequestChunkTypesItems,
1238
- ArchiveSearchRequestRequestContentTypesItems: () => ArchiveSearchRequestRequestContentTypesItems,
1239
- ChatMessageRole: () => ChatMessageRole,
1240
- DocumentArchiveArchiveType: () => DocumentArchiveArchiveType,
1241
- DocumentArchiveDetailArchiveType: () => DocumentArchiveDetailArchiveType,
1242
- DocumentArchiveDetailProcessingStatus: () => DocumentArchiveDetailProcessingStatus,
1243
- DocumentArchiveListArchiveType: () => DocumentArchiveListArchiveType,
1244
- DocumentArchiveListProcessingStatus: () => DocumentArchiveListProcessingStatus,
1245
- DocumentArchiveProcessingStatus: () => DocumentArchiveProcessingStatus,
1246
- PatchedArchiveItemChunkRequestChunkType: () => PatchedArchiveItemChunkRequestChunkType
1247
- });
1248
- var ArchiveItemContentType = /* @__PURE__ */ ((ArchiveItemContentType2) => {
1249
- ArchiveItemContentType2["DOCUMENT"] = "document";
1250
- ArchiveItemContentType2["CODE"] = "code";
1251
- ArchiveItemContentType2["IMAGE"] = "image";
1252
- ArchiveItemContentType2["DATA"] = "data";
1253
- ArchiveItemContentType2["ARCHIVE"] = "archive";
1254
- ArchiveItemContentType2["UNKNOWN"] = "unknown";
1255
- return ArchiveItemContentType2;
1256
- })(ArchiveItemContentType || {});
1257
- var ArchiveItemChunkChunkType = /* @__PURE__ */ ((ArchiveItemChunkChunkType2) => {
1258
- ArchiveItemChunkChunkType2["TEXT"] = "text";
1259
- ArchiveItemChunkChunkType2["CODE"] = "code";
1260
- ArchiveItemChunkChunkType2["HEADING"] = "heading";
1261
- ArchiveItemChunkChunkType2["METADATA"] = "metadata";
1262
- ArchiveItemChunkChunkType2["TABLE"] = "table";
1263
- ArchiveItemChunkChunkType2["LIST"] = "list";
1264
- return ArchiveItemChunkChunkType2;
1265
- })(ArchiveItemChunkChunkType || {});
1266
- var ArchiveItemChunkDetailChunkType = /* @__PURE__ */ ((ArchiveItemChunkDetailChunkType2) => {
1267
- ArchiveItemChunkDetailChunkType2["TEXT"] = "text";
1268
- ArchiveItemChunkDetailChunkType2["CODE"] = "code";
1269
- ArchiveItemChunkDetailChunkType2["HEADING"] = "heading";
1270
- ArchiveItemChunkDetailChunkType2["METADATA"] = "metadata";
1271
- ArchiveItemChunkDetailChunkType2["TABLE"] = "table";
1272
- ArchiveItemChunkDetailChunkType2["LIST"] = "list";
1273
- return ArchiveItemChunkDetailChunkType2;
1274
- })(ArchiveItemChunkDetailChunkType || {});
1275
- var ArchiveItemChunkRequestChunkType = /* @__PURE__ */ ((ArchiveItemChunkRequestChunkType2) => {
1276
- ArchiveItemChunkRequestChunkType2["TEXT"] = "text";
1277
- ArchiveItemChunkRequestChunkType2["CODE"] = "code";
1278
- ArchiveItemChunkRequestChunkType2["HEADING"] = "heading";
1279
- ArchiveItemChunkRequestChunkType2["METADATA"] = "metadata";
1280
- ArchiveItemChunkRequestChunkType2["TABLE"] = "table";
1281
- ArchiveItemChunkRequestChunkType2["LIST"] = "list";
1282
- return ArchiveItemChunkRequestChunkType2;
1283
- })(ArchiveItemChunkRequestChunkType || {});
1284
- var ArchiveItemDetailContentType = /* @__PURE__ */ ((ArchiveItemDetailContentType2) => {
1285
- ArchiveItemDetailContentType2["DOCUMENT"] = "document";
1286
- ArchiveItemDetailContentType2["CODE"] = "code";
1287
- ArchiveItemDetailContentType2["IMAGE"] = "image";
1288
- ArchiveItemDetailContentType2["DATA"] = "data";
1289
- ArchiveItemDetailContentType2["ARCHIVE"] = "archive";
1290
- ArchiveItemDetailContentType2["UNKNOWN"] = "unknown";
1291
- return ArchiveItemDetailContentType2;
1292
- })(ArchiveItemDetailContentType || {});
1293
- var ArchiveSearchRequestRequestContentTypesItems = /* @__PURE__ */ ((ArchiveSearchRequestRequestContentTypesItems2) => {
1294
- ArchiveSearchRequestRequestContentTypesItems2["DOCUMENT"] = "document";
1295
- ArchiveSearchRequestRequestContentTypesItems2["CODE"] = "code";
1296
- ArchiveSearchRequestRequestContentTypesItems2["IMAGE"] = "image";
1297
- ArchiveSearchRequestRequestContentTypesItems2["DATA"] = "data";
1298
- ArchiveSearchRequestRequestContentTypesItems2["ARCHIVE"] = "archive";
1299
- ArchiveSearchRequestRequestContentTypesItems2["UNKNOWN"] = "unknown";
1300
- return ArchiveSearchRequestRequestContentTypesItems2;
1301
- })(ArchiveSearchRequestRequestContentTypesItems || {});
1302
- var ArchiveSearchRequestRequestChunkTypesItems = /* @__PURE__ */ ((ArchiveSearchRequestRequestChunkTypesItems2) => {
1303
- ArchiveSearchRequestRequestChunkTypesItems2["TEXT"] = "text";
1304
- ArchiveSearchRequestRequestChunkTypesItems2["CODE"] = "code";
1305
- ArchiveSearchRequestRequestChunkTypesItems2["HEADING"] = "heading";
1306
- ArchiveSearchRequestRequestChunkTypesItems2["METADATA"] = "metadata";
1307
- ArchiveSearchRequestRequestChunkTypesItems2["TABLE"] = "table";
1308
- ArchiveSearchRequestRequestChunkTypesItems2["LIST"] = "list";
1309
- return ArchiveSearchRequestRequestChunkTypesItems2;
1310
- })(ArchiveSearchRequestRequestChunkTypesItems || {});
1311
- var ChatMessageRole = /* @__PURE__ */ ((ChatMessageRole2) => {
1312
- ChatMessageRole2["USER"] = "user";
1313
- ChatMessageRole2["ASSISTANT"] = "assistant";
1314
- ChatMessageRole2["SYSTEM"] = "system";
1315
- return ChatMessageRole2;
1316
- })(ChatMessageRole || {});
1317
- var DocumentArchiveArchiveType = /* @__PURE__ */ ((DocumentArchiveArchiveType2) => {
1318
- DocumentArchiveArchiveType2["ZIP"] = "zip";
1319
- DocumentArchiveArchiveType2["TAR"] = "tar";
1320
- DocumentArchiveArchiveType2["TAR_DOT_GZ"] = "tar.gz";
1321
- DocumentArchiveArchiveType2["TAR_DOT_BZ2"] = "tar.bz2";
1322
- return DocumentArchiveArchiveType2;
1323
- })(DocumentArchiveArchiveType || {});
1324
- var DocumentArchiveProcessingStatus = /* @__PURE__ */ ((DocumentArchiveProcessingStatus2) => {
1325
- DocumentArchiveProcessingStatus2["PENDING"] = "pending";
1326
- DocumentArchiveProcessingStatus2["PROCESSING"] = "processing";
1327
- DocumentArchiveProcessingStatus2["COMPLETED"] = "completed";
1328
- DocumentArchiveProcessingStatus2["FAILED"] = "failed";
1329
- DocumentArchiveProcessingStatus2["CANCELLED"] = "cancelled";
1330
- return DocumentArchiveProcessingStatus2;
1331
- })(DocumentArchiveProcessingStatus || {});
1332
- var DocumentArchiveDetailArchiveType = /* @__PURE__ */ ((DocumentArchiveDetailArchiveType2) => {
1333
- DocumentArchiveDetailArchiveType2["ZIP"] = "zip";
1334
- DocumentArchiveDetailArchiveType2["TAR"] = "tar";
1335
- DocumentArchiveDetailArchiveType2["TAR_DOT_GZ"] = "tar.gz";
1336
- DocumentArchiveDetailArchiveType2["TAR_DOT_BZ2"] = "tar.bz2";
1337
- return DocumentArchiveDetailArchiveType2;
1338
- })(DocumentArchiveDetailArchiveType || {});
1339
- var DocumentArchiveDetailProcessingStatus = /* @__PURE__ */ ((DocumentArchiveDetailProcessingStatus2) => {
1340
- DocumentArchiveDetailProcessingStatus2["PENDING"] = "pending";
1341
- DocumentArchiveDetailProcessingStatus2["PROCESSING"] = "processing";
1342
- DocumentArchiveDetailProcessingStatus2["COMPLETED"] = "completed";
1343
- DocumentArchiveDetailProcessingStatus2["FAILED"] = "failed";
1344
- DocumentArchiveDetailProcessingStatus2["CANCELLED"] = "cancelled";
1345
- return DocumentArchiveDetailProcessingStatus2;
1346
- })(DocumentArchiveDetailProcessingStatus || {});
1347
- var DocumentArchiveListArchiveType = /* @__PURE__ */ ((DocumentArchiveListArchiveType2) => {
1348
- DocumentArchiveListArchiveType2["ZIP"] = "zip";
1349
- DocumentArchiveListArchiveType2["TAR"] = "tar";
1350
- DocumentArchiveListArchiveType2["TAR_DOT_GZ"] = "tar.gz";
1351
- DocumentArchiveListArchiveType2["TAR_DOT_BZ2"] = "tar.bz2";
1352
- return DocumentArchiveListArchiveType2;
1353
- })(DocumentArchiveListArchiveType || {});
1354
- var DocumentArchiveListProcessingStatus = /* @__PURE__ */ ((DocumentArchiveListProcessingStatus2) => {
1355
- DocumentArchiveListProcessingStatus2["PENDING"] = "pending";
1356
- DocumentArchiveListProcessingStatus2["PROCESSING"] = "processing";
1357
- DocumentArchiveListProcessingStatus2["COMPLETED"] = "completed";
1358
- DocumentArchiveListProcessingStatus2["FAILED"] = "failed";
1359
- DocumentArchiveListProcessingStatus2["CANCELLED"] = "cancelled";
1360
- return DocumentArchiveListProcessingStatus2;
1361
- })(DocumentArchiveListProcessingStatus || {});
1362
- var PatchedArchiveItemChunkRequestChunkType = /* @__PURE__ */ ((PatchedArchiveItemChunkRequestChunkType2) => {
1363
- PatchedArchiveItemChunkRequestChunkType2["TEXT"] = "text";
1364
- PatchedArchiveItemChunkRequestChunkType2["CODE"] = "code";
1365
- PatchedArchiveItemChunkRequestChunkType2["HEADING"] = "heading";
1366
- PatchedArchiveItemChunkRequestChunkType2["METADATA"] = "metadata";
1367
- PatchedArchiveItemChunkRequestChunkType2["TABLE"] = "table";
1368
- PatchedArchiveItemChunkRequestChunkType2["LIST"] = "list";
1369
- return PatchedArchiveItemChunkRequestChunkType2;
1370
- })(PatchedArchiveItemChunkRequestChunkType || {});
1371
-
1372
- // src/api/generated/ext_knowbase/_utils/schemas/index.ts
1373
- var schemas_exports = {};
1374
- __export(schemas_exports, {
1375
- ArchiveItemChunkDetailSchema: () => ArchiveItemChunkDetailSchema,
1376
- ArchiveItemChunkRequestSchema: () => ArchiveItemChunkRequestSchema,
1377
- ArchiveItemChunkSchema: () => ArchiveItemChunkSchema,
1378
- ArchiveItemDetailSchema: () => ArchiveItemDetailSchema,
1379
- ArchiveItemRequestSchema: () => ArchiveItemRequestSchema,
1380
- ArchiveItemSchema: () => ArchiveItemSchema,
1381
- ArchiveProcessingResultSchema: () => ArchiveProcessingResultSchema,
1382
- ArchiveSearchRequestRequestSchema: () => ArchiveSearchRequestRequestSchema,
1383
- ArchiveSearchResultSchema: () => ArchiveSearchResultSchema,
1384
- ArchiveStatisticsSchema: () => ArchiveStatisticsSchema,
1385
- ChatHistorySchema: () => ChatHistorySchema,
1386
- ChatMessageSchema: () => ChatMessageSchema,
1387
- ChatQueryRequestSchema: () => ChatQueryRequestSchema,
1388
- ChatResponseRequestSchema: () => ChatResponseRequestSchema,
1389
- ChatResponseSchema: () => ChatResponseSchema,
1390
- ChatSessionCreateRequestSchema: () => ChatSessionCreateRequestSchema,
1391
- ChatSessionRequestSchema: () => ChatSessionRequestSchema,
1392
- ChatSessionSchema: () => ChatSessionSchema,
1393
- ChatSourceRequestSchema: () => ChatSourceRequestSchema,
1394
- ChatSourceSchema: () => ChatSourceSchema,
1395
- ChunkRevectorizationRequestRequestSchema: () => ChunkRevectorizationRequestRequestSchema,
1396
- DocumentArchiveDetailSchema: () => DocumentArchiveDetailSchema,
1397
- DocumentArchiveListSchema: () => DocumentArchiveListSchema,
1398
- DocumentArchiveRequestSchema: () => DocumentArchiveRequestSchema,
1399
- DocumentArchiveSchema: () => DocumentArchiveSchema,
1400
- DocumentCategoryRequestSchema: () => DocumentCategoryRequestSchema,
1401
- DocumentCategorySchema: () => DocumentCategorySchema,
1402
- DocumentCreateRequestSchema: () => DocumentCreateRequestSchema,
1403
- DocumentProcessingStatusSchema: () => DocumentProcessingStatusSchema,
1404
- DocumentRequestSchema: () => DocumentRequestSchema,
1405
- DocumentSchema: () => DocumentSchema,
1406
- DocumentStatsSchema: () => DocumentStatsSchema,
1407
- PaginatedArchiveItemChunkListSchema: () => PaginatedArchiveItemChunkListSchema,
1408
- PaginatedArchiveItemListSchema: () => PaginatedArchiveItemListSchema,
1409
- PaginatedArchiveSearchResultListSchema: () => PaginatedArchiveSearchResultListSchema,
1410
- PaginatedChatResponseListSchema: () => PaginatedChatResponseListSchema,
1411
- PaginatedChatSessionListSchema: () => PaginatedChatSessionListSchema,
1412
- PaginatedDocumentArchiveListListSchema: () => PaginatedDocumentArchiveListListSchema,
1413
- PaginatedDocumentListSchema: () => PaginatedDocumentListSchema,
1414
- PaginatedPublicCategoryListSchema: () => PaginatedPublicCategoryListSchema,
1415
- PaginatedPublicDocumentListListSchema: () => PaginatedPublicDocumentListListSchema,
1416
- PatchedArchiveItemChunkRequestSchema: () => PatchedArchiveItemChunkRequestSchema,
1417
- PatchedArchiveItemRequestSchema: () => PatchedArchiveItemRequestSchema,
1418
- PatchedChatResponseRequestSchema: () => PatchedChatResponseRequestSchema,
1419
- PatchedChatSessionRequestSchema: () => PatchedChatSessionRequestSchema,
1420
- PatchedDocumentArchiveRequestSchema: () => PatchedDocumentArchiveRequestSchema,
1421
- PatchedDocumentRequestSchema: () => PatchedDocumentRequestSchema,
1422
- PublicCategorySchema: () => PublicCategorySchema,
1423
- PublicDocumentListSchema: () => PublicDocumentListSchema,
1424
- PublicDocumentSchema: () => PublicDocumentSchema,
1425
- VectorizationResultSchema: () => VectorizationResultSchema,
1426
- VectorizationStatisticsSchema: () => VectorizationStatisticsSchema
1427
- });
1428
- var ArchiveItemSchema = zod.z.object({
1429
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1430
- relative_path: zod.z.string().max(1024),
1431
- item_name: zod.z.string().max(255),
1432
- item_type: zod.z.string().max(100),
1433
- content_type: zod.z.nativeEnum(ArchiveItemContentType),
1434
- file_size: zod.z.int().min(0).max(2147483647).optional(),
1435
- is_processable: zod.z.boolean(),
1436
- language: zod.z.string(),
1437
- encoding: zod.z.string(),
1438
- chunks_count: zod.z.int(),
1439
- total_tokens: zod.z.int(),
1440
- processing_cost: zod.z.number(),
1441
- created_at: zod.z.iso.datetime(),
1442
- updated_at: zod.z.iso.datetime()
1443
- });
1444
- var ArchiveItemChunkSchema = zod.z.object({
1445
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1446
- content: zod.z.string(),
1447
- chunk_index: zod.z.int().min(0).max(2147483647),
1448
- chunk_type: zod.z.nativeEnum(ArchiveItemChunkChunkType).optional(),
1449
- token_count: zod.z.int(),
1450
- character_count: zod.z.int(),
1451
- embedding_model: zod.z.string(),
1452
- embedding_cost: zod.z.number(),
1453
- context_summary: zod.z.object({}),
1454
- created_at: zod.z.iso.datetime()
1455
- });
1456
- var ArchiveItemChunkDetailSchema = zod.z.object({
1457
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1458
- content: zod.z.string(),
1459
- chunk_index: zod.z.int().min(0).max(2147483647),
1460
- chunk_type: zod.z.nativeEnum(ArchiveItemChunkDetailChunkType).optional(),
1461
- token_count: zod.z.int(),
1462
- character_count: zod.z.int(),
1463
- embedding_model: zod.z.string(),
1464
- embedding_cost: zod.z.number(),
1465
- context_summary: zod.z.object({}),
1466
- created_at: zod.z.iso.datetime(),
1467
- context_metadata: zod.z.record(zod.z.string(), zod.z.any())
1468
- });
1469
- var ArchiveItemChunkRequestSchema = zod.z.object({
1470
- content: zod.z.string().min(1),
1471
- chunk_index: zod.z.int().min(0).max(2147483647),
1472
- chunk_type: zod.z.nativeEnum(ArchiveItemChunkRequestChunkType).optional()
1473
- });
1474
- var ArchiveItemDetailSchema = zod.z.object({
1475
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1476
- relative_path: zod.z.string().max(1024),
1477
- item_name: zod.z.string().max(255),
1478
- item_type: zod.z.string().max(100),
1479
- content_type: zod.z.nativeEnum(ArchiveItemDetailContentType),
1480
- file_size: zod.z.int().min(0).max(2147483647).optional(),
1481
- is_processable: zod.z.boolean(),
1482
- language: zod.z.string(),
1483
- encoding: zod.z.string(),
1484
- chunks_count: zod.z.int(),
1485
- total_tokens: zod.z.int(),
1486
- processing_cost: zod.z.number(),
1487
- created_at: zod.z.iso.datetime(),
1488
- updated_at: zod.z.iso.datetime(),
1489
- raw_content: zod.z.string(),
1490
- metadata: zod.z.record(zod.z.string(), zod.z.any())
1491
- });
1492
- var ArchiveItemRequestSchema = zod.z.object({
1493
- relative_path: zod.z.string().min(1).max(1024),
1494
- item_name: zod.z.string().min(1).max(255),
1495
- item_type: zod.z.string().min(1).max(100),
1496
- file_size: zod.z.int().min(0).max(2147483647).optional()
1497
- });
1498
- var ArchiveProcessingResultSchema = zod.z.object({
1499
- archive_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1500
- status: zod.z.string(),
1501
- processing_time_ms: zod.z.int(),
1502
- items_processed: zod.z.int(),
1503
- chunks_created: zod.z.int(),
1504
- vectorized_chunks: zod.z.int(),
1505
- total_cost_usd: zod.z.number(),
1506
- error_message: zod.z.string()
1507
- });
1508
- var ArchiveSearchRequestRequestSchema = zod.z.object({
1509
- query: zod.z.string().min(1).max(500),
1510
- content_types: zod.z.array(zod.z.string()).optional(),
1511
- languages: zod.z.array(zod.z.string().min(1).max(50)).optional(),
1512
- chunk_types: zod.z.array(zod.z.string()).optional(),
1513
- archive_ids: zod.z.array(zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)).optional(),
1514
- limit: zod.z.int().min(1).max(50).optional(),
1515
- similarity_threshold: zod.z.number().min(0).max(1).optional()
1516
- });
1517
- var ArchiveSearchResultSchema = zod.z.object({
1518
- chunk: ArchiveItemChunkSchema,
1519
- similarity_score: zod.z.number(),
1520
- context_summary: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.any())),
1521
- archive_info: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.any())),
1522
- item_info: zod.z.record(zod.z.string(), zod.z.record(zod.z.string(), zod.z.any()))
1523
- });
1524
- var ArchiveStatisticsSchema = zod.z.object({
1525
- total_archives: zod.z.int(),
1526
- processed_archives: zod.z.int(),
1527
- failed_archives: zod.z.int(),
1528
- total_items: zod.z.int(),
1529
- total_chunks: zod.z.int(),
1530
- total_tokens: zod.z.int(),
1531
- total_cost: zod.z.number(),
1532
- avg_processing_time: zod.z.number(),
1533
- avg_items_per_archive: zod.z.number(),
1534
- avg_chunks_per_archive: zod.z.number()
1535
- });
1536
- var ChatMessageSchema = zod.z.object({
1537
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1538
- role: zod.z.nativeEnum(ChatMessageRole),
1539
- content: zod.z.string(),
1540
- tokens_used: zod.z.int().min(0).max(2147483647).optional(),
1541
- cost_usd: zod.z.number(),
1542
- processing_time_ms: zod.z.int().min(0).max(2147483647).optional(),
1543
- created_at: zod.z.iso.datetime(),
1544
- context_chunks: zod.z.record(zod.z.string(), zod.z.any()).optional()
1545
- });
1546
-
1547
- // src/api/generated/ext_knowbase/_utils/schemas/ChatHistory.schema.ts
1548
- var ChatHistorySchema = zod.z.object({
1549
- session_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1550
- messages: zod.z.array(ChatMessageSchema),
1551
- total_messages: zod.z.int()
1552
- });
1553
- var ChatQueryRequestSchema = zod.z.object({
1554
- session_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1555
- query: zod.z.string().min(1).max(2e3),
1556
- max_tokens: zod.z.int().min(1).max(4e3).optional(),
1557
- include_sources: zod.z.boolean().optional()
1558
- });
1559
- var ChatSourceSchema = zod.z.object({
1560
- document_title: zod.z.string(),
1561
- chunk_content: zod.z.string(),
1562
- similarity: zod.z.number()
1563
- });
1564
-
1565
- // src/api/generated/ext_knowbase/_utils/schemas/ChatResponse.schema.ts
1566
- var ChatResponseSchema = zod.z.object({
1567
- message_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1568
- content: zod.z.string(),
1569
- tokens_used: zod.z.int(),
1570
- cost_usd: zod.z.number(),
1571
- processing_time_ms: zod.z.int(),
1572
- model_used: zod.z.string(),
1573
- sources: zod.z.array(ChatSourceSchema).nullable().optional()
1574
- });
1575
- var ChatSourceRequestSchema = zod.z.object({
1576
- document_title: zod.z.string().min(1),
1577
- chunk_content: zod.z.string().min(1),
1578
- similarity: zod.z.number()
1579
- });
1580
-
1581
- // src/api/generated/ext_knowbase/_utils/schemas/ChatResponseRequest.schema.ts
1582
- var ChatResponseRequestSchema = zod.z.object({
1583
- message_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1584
- content: zod.z.string().min(1),
1585
- tokens_used: zod.z.int(),
1586
- cost_usd: zod.z.number(),
1587
- processing_time_ms: zod.z.int(),
1588
- model_used: zod.z.string().min(1),
1589
- sources: zod.z.array(ChatSourceRequestSchema).nullable().optional()
1590
- });
1591
- var ChatSessionSchema = zod.z.object({
1592
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1593
- title: zod.z.string().max(255).optional(),
1594
- is_active: zod.z.boolean().optional(),
1595
- messages_count: zod.z.int().min(0).max(2147483647).optional(),
1596
- total_tokens_used: zod.z.int().min(0).max(2147483647).optional(),
1597
- total_cost_usd: zod.z.number(),
1598
- model_name: zod.z.string().max(100).optional(),
1599
- temperature: zod.z.number().optional(),
1600
- max_context_chunks: zod.z.int().min(0).max(2147483647).optional(),
1601
- created_at: zod.z.iso.datetime(),
1602
- updated_at: zod.z.iso.datetime()
1603
- });
1604
- var ChatSessionCreateRequestSchema = zod.z.object({
1605
- title: zod.z.string().max(255).optional(),
1606
- model_name: zod.z.string().min(1).max(100).optional(),
1607
- temperature: zod.z.number().min(0).max(2).optional(),
1608
- max_context_chunks: zod.z.int().min(1).max(10).optional()
1609
- });
1610
- var ChatSessionRequestSchema = zod.z.object({
1611
- title: zod.z.string().max(255).optional(),
1612
- is_active: zod.z.boolean().optional(),
1613
- messages_count: zod.z.int().min(0).max(2147483647).optional(),
1614
- total_tokens_used: zod.z.int().min(0).max(2147483647).optional(),
1615
- model_name: zod.z.string().min(1).max(100).optional(),
1616
- temperature: zod.z.number().optional(),
1617
- max_context_chunks: zod.z.int().min(0).max(2147483647).optional()
1618
- });
1619
- var ChunkRevectorizationRequestRequestSchema = zod.z.object({
1620
- chunk_ids: zod.z.array(zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)),
1621
- force: zod.z.boolean().optional()
1622
- });
1623
- var DocumentSchema = zod.z.object({
1624
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1625
- title: zod.z.string().max(512),
1626
- file_type: zod.z.string().max(100).optional(),
1627
- file_size: zod.z.int().min(0).max(2147483647).optional(),
1628
- processing_status: zod.z.string(),
1629
- chunks_count: zod.z.int(),
1630
- total_tokens: zod.z.int(),
1631
- total_cost_usd: zod.z.number(),
1632
- created_at: zod.z.iso.datetime(),
1633
- updated_at: zod.z.iso.datetime(),
1634
- processing_started_at: zod.z.iso.datetime(),
1635
- processing_completed_at: zod.z.iso.datetime(),
1636
- processing_error: zod.z.string(),
1637
- metadata: zod.z.record(zod.z.string(), zod.z.any()).nullable().optional()
1638
- });
1639
- var DocumentCategorySchema = zod.z.object({
1640
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1641
- name: zod.z.string().max(255),
1642
- description: zod.z.string().optional(),
1643
- is_public: zod.z.boolean().optional(),
1644
- created_at: zod.z.iso.datetime()
1645
- });
1646
-
1647
- // src/api/generated/ext_knowbase/_utils/schemas/DocumentArchive.schema.ts
1648
- var DocumentArchiveSchema = zod.z.object({
1649
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1650
- title: zod.z.string().max(512),
1651
- description: zod.z.string().optional(),
1652
- categories: zod.z.array(DocumentCategorySchema),
1653
- is_public: zod.z.boolean().optional(),
1654
- archive_file: zod.z.url(),
1655
- original_filename: zod.z.string(),
1656
- file_size: zod.z.int(),
1657
- archive_type: zod.z.nativeEnum(DocumentArchiveArchiveType),
1658
- processing_status: zod.z.nativeEnum(DocumentArchiveProcessingStatus),
1659
- processed_at: zod.z.iso.datetime().nullable(),
1660
- processing_duration_ms: zod.z.int(),
1661
- processing_error: zod.z.string(),
1662
- total_items: zod.z.int(),
1663
- processed_items: zod.z.int(),
1664
- total_chunks: zod.z.int(),
1665
- vectorized_chunks: zod.z.int(),
1666
- total_tokens: zod.z.int(),
1667
- total_cost_usd: zod.z.number(),
1668
- processing_progress: zod.z.number(),
1669
- vectorization_progress: zod.z.number(),
1670
- is_processed: zod.z.boolean(),
1671
- created_at: zod.z.iso.datetime(),
1672
- updated_at: zod.z.iso.datetime()
1673
- });
1674
- var DocumentArchiveDetailSchema = zod.z.object({
1675
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1676
- title: zod.z.string().max(512),
1677
- description: zod.z.string().optional(),
1678
- categories: zod.z.array(DocumentCategorySchema),
1679
- is_public: zod.z.boolean().optional(),
1680
- archive_file: zod.z.url(),
1681
- original_filename: zod.z.string(),
1682
- file_size: zod.z.int(),
1683
- archive_type: zod.z.nativeEnum(DocumentArchiveDetailArchiveType),
1684
- processing_status: zod.z.nativeEnum(DocumentArchiveDetailProcessingStatus),
1685
- processed_at: zod.z.iso.datetime().nullable(),
1686
- processing_duration_ms: zod.z.int(),
1687
- processing_error: zod.z.string(),
1688
- total_items: zod.z.int(),
1689
- processed_items: zod.z.int(),
1690
- total_chunks: zod.z.int(),
1691
- vectorized_chunks: zod.z.int(),
1692
- total_tokens: zod.z.int(),
1693
- total_cost_usd: zod.z.number(),
1694
- processing_progress: zod.z.number(),
1695
- vectorization_progress: zod.z.number(),
1696
- is_processed: zod.z.boolean(),
1697
- created_at: zod.z.iso.datetime(),
1698
- updated_at: zod.z.iso.datetime(),
1699
- items: zod.z.array(ArchiveItemSchema),
1700
- file_tree: zod.z.record(zod.z.string(), zod.z.any()),
1701
- metadata: zod.z.record(zod.z.string(), zod.z.any()).nullable().optional()
1702
- });
1703
- var DocumentArchiveListSchema = zod.z.object({
1704
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1705
- title: zod.z.string(),
1706
- description: zod.z.string(),
1707
- categories: zod.z.array(DocumentCategorySchema),
1708
- is_public: zod.z.boolean(),
1709
- original_filename: zod.z.string(),
1710
- file_size: zod.z.int(),
1711
- archive_type: zod.z.nativeEnum(DocumentArchiveListArchiveType),
1712
- processing_status: zod.z.nativeEnum(DocumentArchiveListProcessingStatus),
1713
- processed_at: zod.z.iso.datetime().nullable(),
1714
- total_items: zod.z.int(),
1715
- total_chunks: zod.z.int(),
1716
- total_cost_usd: zod.z.number(),
1717
- processing_progress: zod.z.number(),
1718
- created_at: zod.z.iso.datetime()
1719
- });
1720
- var DocumentArchiveRequestSchema = zod.z.object({
1721
- title: zod.z.string().min(1).max(512),
1722
- description: zod.z.string().optional(),
1723
- is_public: zod.z.boolean().optional()
1724
- });
1725
- var DocumentCategoryRequestSchema = zod.z.object({
1726
- name: zod.z.string().min(1).max(255),
1727
- description: zod.z.string().optional(),
1728
- is_public: zod.z.boolean().optional()
1729
- });
1730
- var DocumentCreateRequestSchema = zod.z.object({
1731
- title: zod.z.string().min(1).max(512),
1732
- content: zod.z.string().min(10).max(1e6),
1733
- file_type: zod.z.string().min(1).optional(),
1734
- metadata: zod.z.record(zod.z.string(), zod.z.any()).optional()
1735
- });
1736
- var DocumentProcessingStatusSchema = zod.z.object({
1737
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1738
- status: zod.z.string(),
1739
- progress: zod.z.record(zod.z.string(), zod.z.any()),
1740
- error: zod.z.string().nullable().optional(),
1741
- processing_time_seconds: zod.z.number().nullable().optional()
1742
- });
1743
- var DocumentRequestSchema = zod.z.object({
1744
- title: zod.z.string().min(1).max(512),
1745
- file_type: zod.z.string().min(1).max(100).optional(),
1746
- file_size: zod.z.int().min(0).max(2147483647).optional(),
1747
- metadata: zod.z.record(zod.z.string(), zod.z.any()).nullable().optional()
1748
- });
1749
- var DocumentStatsSchema = zod.z.object({
1750
- total_documents: zod.z.int(),
1751
- completed_documents: zod.z.int(),
1752
- processing_success_rate: zod.z.number(),
1753
- total_chunks: zod.z.int(),
1754
- total_tokens: zod.z.int(),
1755
- total_cost_usd: zod.z.number(),
1756
- avg_processing_time_seconds: zod.z.number()
1757
- });
1758
- var PaginatedArchiveItemChunkListSchema = zod.z.object({
1759
- count: zod.z.int(),
1760
- page: zod.z.int(),
1761
- pages: zod.z.int(),
1762
- page_size: zod.z.int(),
1763
- has_next: zod.z.boolean(),
1764
- has_previous: zod.z.boolean(),
1765
- next_page: zod.z.int().nullable().optional(),
1766
- previous_page: zod.z.int().nullable().optional(),
1767
- results: zod.z.array(ArchiveItemChunkSchema)
1768
- });
1769
- var PaginatedArchiveItemListSchema = zod.z.object({
1770
- count: zod.z.int(),
1771
- page: zod.z.int(),
1772
- pages: zod.z.int(),
1773
- page_size: zod.z.int(),
1774
- has_next: zod.z.boolean(),
1775
- has_previous: zod.z.boolean(),
1776
- next_page: zod.z.int().nullable().optional(),
1777
- previous_page: zod.z.int().nullable().optional(),
1778
- results: zod.z.array(ArchiveItemSchema)
1779
- });
1780
- var PaginatedArchiveSearchResultListSchema = zod.z.object({
1781
- count: zod.z.int(),
1782
- page: zod.z.int(),
1783
- pages: zod.z.int(),
1784
- page_size: zod.z.int(),
1785
- has_next: zod.z.boolean(),
1786
- has_previous: zod.z.boolean(),
1787
- next_page: zod.z.int().nullable().optional(),
1788
- previous_page: zod.z.int().nullable().optional(),
1789
- results: zod.z.array(ArchiveSearchResultSchema)
1790
- });
1791
- var PaginatedChatResponseListSchema = zod.z.object({
1792
- count: zod.z.int(),
1793
- page: zod.z.int(),
1794
- pages: zod.z.int(),
1795
- page_size: zod.z.int(),
1796
- has_next: zod.z.boolean(),
1797
- has_previous: zod.z.boolean(),
1798
- next_page: zod.z.int().nullable().optional(),
1799
- previous_page: zod.z.int().nullable().optional(),
1800
- results: zod.z.array(ChatResponseSchema)
1801
- });
1802
- var PaginatedChatSessionListSchema = zod.z.object({
1803
- count: zod.z.int(),
1804
- page: zod.z.int(),
1805
- pages: zod.z.int(),
1806
- page_size: zod.z.int(),
1807
- has_next: zod.z.boolean(),
1808
- has_previous: zod.z.boolean(),
1809
- next_page: zod.z.int().nullable().optional(),
1810
- previous_page: zod.z.int().nullable().optional(),
1811
- results: zod.z.array(ChatSessionSchema)
1812
- });
1813
- var PaginatedDocumentArchiveListListSchema = zod.z.object({
1814
- count: zod.z.int(),
1815
- page: zod.z.int(),
1816
- pages: zod.z.int(),
1817
- page_size: zod.z.int(),
1818
- has_next: zod.z.boolean(),
1819
- has_previous: zod.z.boolean(),
1820
- next_page: zod.z.int().nullable().optional(),
1821
- previous_page: zod.z.int().nullable().optional(),
1822
- results: zod.z.array(DocumentArchiveListSchema)
1823
- });
1824
- var PaginatedDocumentListSchema = zod.z.object({
1825
- count: zod.z.int(),
1826
- page: zod.z.int(),
1827
- pages: zod.z.int(),
1828
- page_size: zod.z.int(),
1829
- has_next: zod.z.boolean(),
1830
- has_previous: zod.z.boolean(),
1831
- next_page: zod.z.int().nullable().optional(),
1832
- previous_page: zod.z.int().nullable().optional(),
1833
- results: zod.z.array(DocumentSchema)
1834
- });
1835
- var PublicCategorySchema = zod.z.object({
1836
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1837
- name: zod.z.string().max(255),
1838
- description: zod.z.string().optional()
1839
- });
1840
-
1841
- // src/api/generated/ext_knowbase/_utils/schemas/PaginatedPublicCategoryList.schema.ts
1842
- var PaginatedPublicCategoryListSchema = zod.z.object({
1843
- count: zod.z.int(),
1844
- page: zod.z.int(),
1845
- pages: zod.z.int(),
1846
- page_size: zod.z.int(),
1847
- has_next: zod.z.boolean(),
1848
- has_previous: zod.z.boolean(),
1849
- next_page: zod.z.int().nullable().optional(),
1850
- previous_page: zod.z.int().nullable().optional(),
1851
- results: zod.z.array(PublicCategorySchema)
1852
- });
1853
- var PublicDocumentListSchema = zod.z.object({
1854
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1855
- title: zod.z.string().max(512),
1856
- category: PublicCategorySchema,
1857
- created_at: zod.z.iso.datetime(),
1858
- updated_at: zod.z.iso.datetime()
1859
- });
1860
-
1861
- // src/api/generated/ext_knowbase/_utils/schemas/PaginatedPublicDocumentListList.schema.ts
1862
- var PaginatedPublicDocumentListListSchema = zod.z.object({
1863
- count: zod.z.int(),
1864
- page: zod.z.int(),
1865
- pages: zod.z.int(),
1866
- page_size: zod.z.int(),
1867
- has_next: zod.z.boolean(),
1868
- has_previous: zod.z.boolean(),
1869
- next_page: zod.z.int().nullable().optional(),
1870
- previous_page: zod.z.int().nullable().optional(),
1871
- results: zod.z.array(PublicDocumentListSchema)
1872
- });
1873
- var PatchedArchiveItemChunkRequestSchema = zod.z.object({
1874
- content: zod.z.string().min(1).optional(),
1875
- chunk_index: zod.z.int().min(0).max(2147483647).optional(),
1876
- chunk_type: zod.z.nativeEnum(PatchedArchiveItemChunkRequestChunkType).optional()
1877
- });
1878
- var PatchedArchiveItemRequestSchema = zod.z.object({
1879
- relative_path: zod.z.string().min(1).max(1024).optional(),
1880
- item_name: zod.z.string().min(1).max(255).optional(),
1881
- item_type: zod.z.string().min(1).max(100).optional(),
1882
- file_size: zod.z.int().min(0).max(2147483647).optional()
1883
- });
1884
- var PatchedChatResponseRequestSchema = zod.z.object({
1885
- message_id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).optional(),
1886
- content: zod.z.string().min(1).optional(),
1887
- tokens_used: zod.z.int().optional(),
1888
- cost_usd: zod.z.number().optional(),
1889
- processing_time_ms: zod.z.int().optional(),
1890
- model_used: zod.z.string().min(1).optional(),
1891
- sources: zod.z.array(ChatSourceRequestSchema).nullable().optional()
1892
- });
1893
- var PatchedChatSessionRequestSchema = zod.z.object({
1894
- title: zod.z.string().max(255).optional(),
1895
- is_active: zod.z.boolean().optional(),
1896
- messages_count: zod.z.int().min(0).max(2147483647).optional(),
1897
- total_tokens_used: zod.z.int().min(0).max(2147483647).optional(),
1898
- model_name: zod.z.string().min(1).max(100).optional(),
1899
- temperature: zod.z.number().optional(),
1900
- max_context_chunks: zod.z.int().min(0).max(2147483647).optional()
1901
- });
1902
- var PatchedDocumentArchiveRequestSchema = zod.z.object({
1903
- title: zod.z.string().min(1).max(512).optional(),
1904
- description: zod.z.string().optional(),
1905
- is_public: zod.z.boolean().optional()
1906
- });
1907
- var PatchedDocumentRequestSchema = zod.z.object({
1908
- title: zod.z.string().min(1).max(512).optional(),
1909
- file_type: zod.z.string().min(1).max(100).optional(),
1910
- file_size: zod.z.int().min(0).max(2147483647).optional(),
1911
- metadata: zod.z.record(zod.z.string(), zod.z.any()).nullable().optional()
1912
- });
1913
- var PublicDocumentSchema = zod.z.object({
1914
- id: zod.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
1915
- title: zod.z.string().max(512),
1916
- content: zod.z.string(),
1917
- category: PublicCategorySchema,
1918
- created_at: zod.z.iso.datetime(),
1919
- updated_at: zod.z.iso.datetime()
1920
- });
1921
- var VectorizationResultSchema = zod.z.object({
1922
- vectorized_count: zod.z.int(),
1923
- failed_count: zod.z.int(),
1924
- total_tokens: zod.z.int(),
1925
- total_cost: zod.z.number(),
1926
- success_rate: zod.z.number(),
1927
- errors: zod.z.array(zod.z.string())
1928
- });
1929
- var VectorizationStatisticsSchema = zod.z.object({
1930
- total_chunks: zod.z.int(),
1931
- vectorized_chunks: zod.z.int(),
1932
- pending_chunks: zod.z.int(),
1933
- vectorization_rate: zod.z.number(),
1934
- total_tokens: zod.z.int(),
1935
- total_cost: zod.z.number(),
1936
- avg_tokens_per_chunk: zod.z.number(),
1937
- avg_cost_per_chunk: zod.z.number()
1938
- });
1939
-
1940
- // src/api/generated/ext_knowbase/validation-events.ts
1941
- function dispatchValidationError(detail) {
1942
- if (typeof window === "undefined") {
1943
- return;
1944
- }
1945
- try {
1946
- const event = new CustomEvent("zod-validation-error", {
1947
- detail,
1948
- bubbles: true,
1949
- cancelable: false
1950
- });
1951
- window.dispatchEvent(event);
1952
- } catch (error) {
1953
- console.warn("Failed to dispatch validation error event:", error);
1954
- }
1955
- }
1956
- function onValidationError(callback) {
1957
- if (typeof window === "undefined") {
1958
- return () => {
1959
- };
1960
- }
1961
- const handler = (event) => {
1962
- if (event instanceof CustomEvent) {
1963
- callback(event.detail);
1964
- }
1965
- };
1966
- window.addEventListener("zod-validation-error", handler);
1967
- return () => {
1968
- window.removeEventListener("zod-validation-error", handler);
1969
- };
1970
- }
1971
- function formatZodError(error) {
1972
- const issues = error.issues.map((issue, index) => {
1973
- const path = issue.path.join(".") || "root";
1974
- const parts = [`${index + 1}. ${path}: ${issue.message}`];
1975
- if ("expected" in issue && issue.expected) {
1976
- parts.push(` Expected: ${issue.expected}`);
1977
- }
1978
- if ("received" in issue && issue.received) {
1979
- parts.push(` Received: ${issue.received}`);
1980
- }
1981
- return parts.join("\n");
1982
- });
1983
- return issues.join("\n");
1984
- }
1985
-
1986
- // src/api/generated/ext_knowbase/_utils/fetchers/index.ts
1987
- var fetchers_exports = {};
1988
- __export(fetchers_exports, {
1989
- createKnowbaseAdminChatCreate: () => createKnowbaseAdminChatCreate,
1990
- createKnowbaseAdminChatQueryCreate: () => createKnowbaseAdminChatQueryCreate,
1991
- createKnowbaseAdminDocumentsCreate: () => createKnowbaseAdminDocumentsCreate,
1992
- createKnowbaseAdminDocumentsReprocessCreate: () => createKnowbaseAdminDocumentsReprocessCreate,
1993
- createKnowbaseAdminSessionsActivateCreate: () => createKnowbaseAdminSessionsActivateCreate,
1994
- createKnowbaseAdminSessionsArchiveCreate: () => createKnowbaseAdminSessionsArchiveCreate,
1995
- createKnowbaseAdminSessionsCreate: () => createKnowbaseAdminSessionsCreate,
1996
- createKnowbaseSystemArchivesCreate: () => createKnowbaseSystemArchivesCreate,
1997
- createKnowbaseSystemArchivesRevectorizeCreate: () => createKnowbaseSystemArchivesRevectorizeCreate,
1998
- createKnowbaseSystemArchivesSearchCreate: () => createKnowbaseSystemArchivesSearchCreate,
1999
- createKnowbaseSystemChunksCreate: () => createKnowbaseSystemChunksCreate,
2000
- createKnowbaseSystemChunksVectorizeCreate: () => createKnowbaseSystemChunksVectorizeCreate,
2001
- createKnowbaseSystemItemsCreate: () => createKnowbaseSystemItemsCreate,
2002
- deleteKnowbaseAdminChatDestroy: () => deleteKnowbaseAdminChatDestroy,
2003
- deleteKnowbaseAdminDocumentsDestroy: () => deleteKnowbaseAdminDocumentsDestroy,
2004
- deleteKnowbaseAdminSessionsDestroy: () => deleteKnowbaseAdminSessionsDestroy,
2005
- deleteKnowbaseSystemArchivesDestroy: () => deleteKnowbaseSystemArchivesDestroy,
2006
- deleteKnowbaseSystemChunksDestroy: () => deleteKnowbaseSystemChunksDestroy,
2007
- deleteKnowbaseSystemItemsDestroy: () => deleteKnowbaseSystemItemsDestroy,
2008
- getKnowbaseAdminChatHistoryRetrieve: () => getKnowbaseAdminChatHistoryRetrieve,
2009
- getKnowbaseAdminChatList: () => getKnowbaseAdminChatList,
2010
- getKnowbaseAdminChatRetrieve: () => getKnowbaseAdminChatRetrieve,
2011
- getKnowbaseAdminDocumentsList: () => getKnowbaseAdminDocumentsList,
2012
- getKnowbaseAdminDocumentsRetrieve: () => getKnowbaseAdminDocumentsRetrieve,
2013
- getKnowbaseAdminDocumentsStatsRetrieve: () => getKnowbaseAdminDocumentsStatsRetrieve,
2014
- getKnowbaseAdminDocumentsStatusRetrieve: () => getKnowbaseAdminDocumentsStatusRetrieve,
2015
- getKnowbaseAdminSessionsList: () => getKnowbaseAdminSessionsList,
2016
- getKnowbaseAdminSessionsRetrieve: () => getKnowbaseAdminSessionsRetrieve,
2017
- getKnowbaseCategoriesList: () => getKnowbaseCategoriesList,
2018
- getKnowbaseCategoriesRetrieve: () => getKnowbaseCategoriesRetrieve,
2019
- getKnowbaseDocumentsList: () => getKnowbaseDocumentsList,
2020
- getKnowbaseDocumentsRetrieve: () => getKnowbaseDocumentsRetrieve,
2021
- getKnowbaseSystemArchivesFileTreeRetrieve: () => getKnowbaseSystemArchivesFileTreeRetrieve,
2022
- getKnowbaseSystemArchivesItemsList: () => getKnowbaseSystemArchivesItemsList,
2023
- getKnowbaseSystemArchivesList: () => getKnowbaseSystemArchivesList,
2024
- getKnowbaseSystemArchivesRetrieve: () => getKnowbaseSystemArchivesRetrieve,
2025
- getKnowbaseSystemArchivesStatisticsRetrieve: () => getKnowbaseSystemArchivesStatisticsRetrieve,
2026
- getKnowbaseSystemArchivesVectorizationStatsRetrieve: () => getKnowbaseSystemArchivesVectorizationStatsRetrieve,
2027
- getKnowbaseSystemChunksContextRetrieve: () => getKnowbaseSystemChunksContextRetrieve,
2028
- getKnowbaseSystemChunksList: () => getKnowbaseSystemChunksList,
2029
- getKnowbaseSystemChunksRetrieve: () => getKnowbaseSystemChunksRetrieve,
2030
- getKnowbaseSystemItemsChunksList: () => getKnowbaseSystemItemsChunksList,
2031
- getKnowbaseSystemItemsContentRetrieve: () => getKnowbaseSystemItemsContentRetrieve,
2032
- getKnowbaseSystemItemsList: () => getKnowbaseSystemItemsList,
2033
- getKnowbaseSystemItemsRetrieve: () => getKnowbaseSystemItemsRetrieve,
2034
- partialUpdateKnowbaseAdminChatPartialUpdate: () => partialUpdateKnowbaseAdminChatPartialUpdate,
2035
- partialUpdateKnowbaseAdminDocumentsPartialUpdate: () => partialUpdateKnowbaseAdminDocumentsPartialUpdate,
2036
- partialUpdateKnowbaseAdminSessionsPartialUpdate: () => partialUpdateKnowbaseAdminSessionsPartialUpdate,
2037
- partialUpdateKnowbaseSystemArchivesPartialUpdate: () => partialUpdateKnowbaseSystemArchivesPartialUpdate,
2038
- partialUpdateKnowbaseSystemChunksPartialUpdate: () => partialUpdateKnowbaseSystemChunksPartialUpdate,
2039
- partialUpdateKnowbaseSystemItemsPartialUpdate: () => partialUpdateKnowbaseSystemItemsPartialUpdate,
2040
- updateKnowbaseAdminChatUpdate: () => updateKnowbaseAdminChatUpdate,
2041
- updateKnowbaseAdminDocumentsUpdate: () => updateKnowbaseAdminDocumentsUpdate,
2042
- updateKnowbaseAdminSessionsUpdate: () => updateKnowbaseAdminSessionsUpdate,
2043
- updateKnowbaseSystemArchivesUpdate: () => updateKnowbaseSystemArchivesUpdate,
2044
- updateKnowbaseSystemChunksUpdate: () => updateKnowbaseSystemChunksUpdate,
2045
- updateKnowbaseSystemItemsUpdate: () => updateKnowbaseSystemItemsUpdate
2046
- });
2047
-
2048
- // src/api/generated/ext_knowbase/api-instance.ts
2049
- var globalAPI = null;
2050
- function getAPIInstance() {
2051
- if (!globalAPI) {
2052
- throw new Error(
2053
- 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })'
2054
- );
2055
- }
2056
- return globalAPI;
2057
- }
2058
- function isAPIConfigured() {
2059
- return globalAPI !== null;
2060
- }
2061
- function configureAPI(config) {
2062
- globalAPI = new API(config.baseUrl, config.options);
2063
- if (config.token) {
2064
- globalAPI.setToken(config.token, config.refreshToken);
2065
- }
2066
- return globalAPI;
2067
- }
2068
- function reconfigureAPI(updates) {
2069
- const instance = getAPIInstance();
2070
- if (updates.baseUrl) {
2071
- instance.setBaseUrl(updates.baseUrl);
2072
- }
2073
- if (updates.token) {
2074
- instance.setToken(updates.token, updates.refreshToken);
2075
- }
2076
- return instance;
2077
- }
2078
- function clearAPITokens() {
2079
- const instance = getAPIInstance();
2080
- instance.clearTokens();
2081
- }
2082
- function resetAPI() {
2083
- if (globalAPI) {
2084
- globalAPI.clearTokens();
2085
- }
2086
- globalAPI = null;
2087
- }
2088
-
2089
- // src/api/generated/ext_knowbase/_utils/fetchers/ext_knowbase__knowbase.ts
2090
- async function getKnowbaseAdminChatList(params, client) {
2091
- const api = client || getAPIInstance();
2092
- const response = await api.ext_knowbase_knowbase.adminChatList(params?.page, params?.page_size);
2093
- try {
2094
- return PaginatedChatResponseListSchema.parse(response);
2095
- } catch (error) {
2096
- consola.consola.error("\u274C Zod Validation Failed");
2097
- consola.consola.box(`getKnowbaseAdminChatList
2098
- Path: /cfg/knowbase/admin/chat/
2099
- Method: GET`);
2100
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2101
- consola.consola.error("Validation Issues:");
2102
- error.issues.forEach((issue, index) => {
2103
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2104
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2105
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2106
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2107
- });
2108
- }
2109
- consola.consola.error("Response data:", response);
2110
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2111
- try {
2112
- const event = new CustomEvent("zod-validation-error", {
2113
- detail: {
2114
- operation: "getKnowbaseAdminChatList",
2115
- path: "/cfg/knowbase/admin/chat/",
2116
- method: "GET",
2117
- error,
2118
- response,
2119
- timestamp: /* @__PURE__ */ new Date()
2120
- },
2121
- bubbles: true,
2122
- cancelable: false
2123
- });
2124
- window.dispatchEvent(event);
2125
- } catch (eventError) {
2126
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2127
- }
2128
- }
2129
- throw error;
2130
- }
2131
- }
2132
- async function createKnowbaseAdminChatCreate(data, client) {
2133
- const api = client || getAPIInstance();
2134
- const response = await api.ext_knowbase_knowbase.adminChatCreate(data);
2135
- try {
2136
- return ChatResponseSchema.parse(response);
2137
- } catch (error) {
2138
- consola.consola.error("\u274C Zod Validation Failed");
2139
- consola.consola.box(`createKnowbaseAdminChatCreate
2140
- Path: /cfg/knowbase/admin/chat/
2141
- Method: POST`);
2142
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2143
- consola.consola.error("Validation Issues:");
2144
- error.issues.forEach((issue, index) => {
2145
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2146
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2147
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2148
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2149
- });
2150
- }
2151
- consola.consola.error("Response data:", response);
2152
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2153
- try {
2154
- const event = new CustomEvent("zod-validation-error", {
2155
- detail: {
2156
- operation: "createKnowbaseAdminChatCreate",
2157
- path: "/cfg/knowbase/admin/chat/",
2158
- method: "POST",
2159
- error,
2160
- response,
2161
- timestamp: /* @__PURE__ */ new Date()
2162
- },
2163
- bubbles: true,
2164
- cancelable: false
2165
- });
2166
- window.dispatchEvent(event);
2167
- } catch (eventError) {
2168
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2169
- }
2170
- }
2171
- throw error;
2172
- }
2173
- }
2174
- async function getKnowbaseAdminChatRetrieve(id, client) {
2175
- const api = client || getAPIInstance();
2176
- const response = await api.ext_knowbase_knowbase.adminChatRetrieve(id);
2177
- try {
2178
- return ChatResponseSchema.parse(response);
2179
- } catch (error) {
2180
- consola.consola.error("\u274C Zod Validation Failed");
2181
- consola.consola.box(`getKnowbaseAdminChatRetrieve
2182
- Path: /cfg/knowbase/admin/chat/{id}/
2183
- Method: GET`);
2184
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2185
- consola.consola.error("Validation Issues:");
2186
- error.issues.forEach((issue, index) => {
2187
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2188
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2189
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2190
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2191
- });
2192
- }
2193
- consola.consola.error("Response data:", response);
2194
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2195
- try {
2196
- const event = new CustomEvent("zod-validation-error", {
2197
- detail: {
2198
- operation: "getKnowbaseAdminChatRetrieve",
2199
- path: "/cfg/knowbase/admin/chat/{id}/",
2200
- method: "GET",
2201
- error,
2202
- response,
2203
- timestamp: /* @__PURE__ */ new Date()
2204
- },
2205
- bubbles: true,
2206
- cancelable: false
2207
- });
2208
- window.dispatchEvent(event);
2209
- } catch (eventError) {
2210
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2211
- }
2212
- }
2213
- throw error;
2214
- }
2215
- }
2216
- async function updateKnowbaseAdminChatUpdate(id, data, client) {
2217
- const api = client || getAPIInstance();
2218
- const response = await api.ext_knowbase_knowbase.adminChatUpdate(id, data);
2219
- try {
2220
- return ChatResponseSchema.parse(response);
2221
- } catch (error) {
2222
- consola.consola.error("\u274C Zod Validation Failed");
2223
- consola.consola.box(`updateKnowbaseAdminChatUpdate
2224
- Path: /cfg/knowbase/admin/chat/{id}/
2225
- Method: PUT`);
2226
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2227
- consola.consola.error("Validation Issues:");
2228
- error.issues.forEach((issue, index) => {
2229
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2230
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2231
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2232
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2233
- });
2234
- }
2235
- consola.consola.error("Response data:", response);
2236
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2237
- try {
2238
- const event = new CustomEvent("zod-validation-error", {
2239
- detail: {
2240
- operation: "updateKnowbaseAdminChatUpdate",
2241
- path: "/cfg/knowbase/admin/chat/{id}/",
2242
- method: "PUT",
2243
- error,
2244
- response,
2245
- timestamp: /* @__PURE__ */ new Date()
2246
- },
2247
- bubbles: true,
2248
- cancelable: false
2249
- });
2250
- window.dispatchEvent(event);
2251
- } catch (eventError) {
2252
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2253
- }
2254
- }
2255
- throw error;
2256
- }
2257
- }
2258
- async function partialUpdateKnowbaseAdminChatPartialUpdate(id, data, client) {
2259
- const api = client || getAPIInstance();
2260
- const response = await api.ext_knowbase_knowbase.adminChatPartialUpdate(id, data);
2261
- try {
2262
- return ChatResponseSchema.parse(response);
2263
- } catch (error) {
2264
- consola.consola.error("\u274C Zod Validation Failed");
2265
- consola.consola.box(`partialUpdateKnowbaseAdminChatPartialUpdate
2266
- Path: /cfg/knowbase/admin/chat/{id}/
2267
- Method: PATCH`);
2268
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2269
- consola.consola.error("Validation Issues:");
2270
- error.issues.forEach((issue, index) => {
2271
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2272
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2273
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2274
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2275
- });
2276
- }
2277
- consola.consola.error("Response data:", response);
2278
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2279
- try {
2280
- const event = new CustomEvent("zod-validation-error", {
2281
- detail: {
2282
- operation: "partialUpdateKnowbaseAdminChatPartialUpdate",
2283
- path: "/cfg/knowbase/admin/chat/{id}/",
2284
- method: "PATCH",
2285
- error,
2286
- response,
2287
- timestamp: /* @__PURE__ */ new Date()
2288
- },
2289
- bubbles: true,
2290
- cancelable: false
2291
- });
2292
- window.dispatchEvent(event);
2293
- } catch (eventError) {
2294
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2295
- }
2296
- }
2297
- throw error;
2298
- }
2299
- }
2300
- async function deleteKnowbaseAdminChatDestroy(id, client) {
2301
- const api = client || getAPIInstance();
2302
- const response = await api.ext_knowbase_knowbase.adminChatDestroy(id);
2303
- return response;
2304
- }
2305
- async function getKnowbaseAdminChatHistoryRetrieve(id, client) {
2306
- const api = client || getAPIInstance();
2307
- const response = await api.ext_knowbase_knowbase.adminChatHistoryRetrieve(id);
2308
- try {
2309
- return ChatHistorySchema.parse(response);
2310
- } catch (error) {
2311
- consola.consola.error("\u274C Zod Validation Failed");
2312
- consola.consola.box(`getKnowbaseAdminChatHistoryRetrieve
2313
- Path: /cfg/knowbase/admin/chat/{id}/history/
2314
- Method: GET`);
2315
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2316
- consola.consola.error("Validation Issues:");
2317
- error.issues.forEach((issue, index) => {
2318
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2319
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2320
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2321
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2322
- });
2323
- }
2324
- consola.consola.error("Response data:", response);
2325
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2326
- try {
2327
- const event = new CustomEvent("zod-validation-error", {
2328
- detail: {
2329
- operation: "getKnowbaseAdminChatHistoryRetrieve",
2330
- path: "/cfg/knowbase/admin/chat/{id}/history/",
2331
- method: "GET",
2332
- error,
2333
- response,
2334
- timestamp: /* @__PURE__ */ new Date()
2335
- },
2336
- bubbles: true,
2337
- cancelable: false
2338
- });
2339
- window.dispatchEvent(event);
2340
- } catch (eventError) {
2341
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2342
- }
2343
- }
2344
- throw error;
2345
- }
2346
- }
2347
- async function createKnowbaseAdminChatQueryCreate(data, client) {
2348
- const api = client || getAPIInstance();
2349
- const response = await api.ext_knowbase_knowbase.adminChatQueryCreate(data);
2350
- try {
2351
- return ChatResponseSchema.parse(response);
2352
- } catch (error) {
2353
- consola.consola.error("\u274C Zod Validation Failed");
2354
- consola.consola.box(`createKnowbaseAdminChatQueryCreate
2355
- Path: /cfg/knowbase/admin/chat/query/
2356
- Method: POST`);
2357
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2358
- consola.consola.error("Validation Issues:");
2359
- error.issues.forEach((issue, index) => {
2360
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2361
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2362
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2363
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2364
- });
2365
- }
2366
- consola.consola.error("Response data:", response);
2367
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2368
- try {
2369
- const event = new CustomEvent("zod-validation-error", {
2370
- detail: {
2371
- operation: "createKnowbaseAdminChatQueryCreate",
2372
- path: "/cfg/knowbase/admin/chat/query/",
2373
- method: "POST",
2374
- error,
2375
- response,
2376
- timestamp: /* @__PURE__ */ new Date()
2377
- },
2378
- bubbles: true,
2379
- cancelable: false
2380
- });
2381
- window.dispatchEvent(event);
2382
- } catch (eventError) {
2383
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2384
- }
2385
- }
2386
- throw error;
2387
- }
2388
- }
2389
- async function getKnowbaseAdminDocumentsList(params, client) {
2390
- const api = client || getAPIInstance();
2391
- const response = await api.ext_knowbase_knowbase.adminDocumentsList(params?.page, params?.page_size, params?.status);
2392
- try {
2393
- return PaginatedDocumentListSchema.parse(response);
2394
- } catch (error) {
2395
- consola.consola.error("\u274C Zod Validation Failed");
2396
- consola.consola.box(`getKnowbaseAdminDocumentsList
2397
- Path: /cfg/knowbase/admin/documents/
2398
- Method: GET`);
2399
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2400
- consola.consola.error("Validation Issues:");
2401
- error.issues.forEach((issue, index) => {
2402
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2403
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2404
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2405
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2406
- });
2407
- }
2408
- consola.consola.error("Response data:", response);
2409
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2410
- try {
2411
- const event = new CustomEvent("zod-validation-error", {
2412
- detail: {
2413
- operation: "getKnowbaseAdminDocumentsList",
2414
- path: "/cfg/knowbase/admin/documents/",
2415
- method: "GET",
2416
- error,
2417
- response,
2418
- timestamp: /* @__PURE__ */ new Date()
2419
- },
2420
- bubbles: true,
2421
- cancelable: false
2422
- });
2423
- window.dispatchEvent(event);
2424
- } catch (eventError) {
2425
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2426
- }
2427
- }
2428
- throw error;
2429
- }
2430
- }
2431
- async function createKnowbaseAdminDocumentsCreate(data, client) {
2432
- const api = client || getAPIInstance();
2433
- const response = await api.ext_knowbase_knowbase.adminDocumentsCreate(data);
2434
- try {
2435
- return DocumentSchema.parse(response);
2436
- } catch (error) {
2437
- consola.consola.error("\u274C Zod Validation Failed");
2438
- consola.consola.box(`createKnowbaseAdminDocumentsCreate
2439
- Path: /cfg/knowbase/admin/documents/
2440
- Method: POST`);
2441
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2442
- consola.consola.error("Validation Issues:");
2443
- error.issues.forEach((issue, index) => {
2444
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2445
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2446
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2447
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2448
- });
2449
- }
2450
- consola.consola.error("Response data:", response);
2451
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2452
- try {
2453
- const event = new CustomEvent("zod-validation-error", {
2454
- detail: {
2455
- operation: "createKnowbaseAdminDocumentsCreate",
2456
- path: "/cfg/knowbase/admin/documents/",
2457
- method: "POST",
2458
- error,
2459
- response,
2460
- timestamp: /* @__PURE__ */ new Date()
2461
- },
2462
- bubbles: true,
2463
- cancelable: false
2464
- });
2465
- window.dispatchEvent(event);
2466
- } catch (eventError) {
2467
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2468
- }
2469
- }
2470
- throw error;
2471
- }
2472
- }
2473
- async function getKnowbaseAdminDocumentsRetrieve(id, client) {
2474
- const api = client || getAPIInstance();
2475
- const response = await api.ext_knowbase_knowbase.adminDocumentsRetrieve(id);
2476
- try {
2477
- return DocumentSchema.parse(response);
2478
- } catch (error) {
2479
- consola.consola.error("\u274C Zod Validation Failed");
2480
- consola.consola.box(`getKnowbaseAdminDocumentsRetrieve
2481
- Path: /cfg/knowbase/admin/documents/{id}/
2482
- Method: GET`);
2483
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2484
- consola.consola.error("Validation Issues:");
2485
- error.issues.forEach((issue, index) => {
2486
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2487
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2488
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2489
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2490
- });
2491
- }
2492
- consola.consola.error("Response data:", response);
2493
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2494
- try {
2495
- const event = new CustomEvent("zod-validation-error", {
2496
- detail: {
2497
- operation: "getKnowbaseAdminDocumentsRetrieve",
2498
- path: "/cfg/knowbase/admin/documents/{id}/",
2499
- method: "GET",
2500
- error,
2501
- response,
2502
- timestamp: /* @__PURE__ */ new Date()
2503
- },
2504
- bubbles: true,
2505
- cancelable: false
2506
- });
2507
- window.dispatchEvent(event);
2508
- } catch (eventError) {
2509
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2510
- }
2511
- }
2512
- throw error;
2513
- }
2514
- }
2515
- async function updateKnowbaseAdminDocumentsUpdate(id, data, client) {
2516
- const api = client || getAPIInstance();
2517
- const response = await api.ext_knowbase_knowbase.adminDocumentsUpdate(id, data);
2518
- try {
2519
- return DocumentSchema.parse(response);
2520
- } catch (error) {
2521
- consola.consola.error("\u274C Zod Validation Failed");
2522
- consola.consola.box(`updateKnowbaseAdminDocumentsUpdate
2523
- Path: /cfg/knowbase/admin/documents/{id}/
2524
- Method: PUT`);
2525
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2526
- consola.consola.error("Validation Issues:");
2527
- error.issues.forEach((issue, index) => {
2528
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2529
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2530
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2531
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2532
- });
2533
- }
2534
- consola.consola.error("Response data:", response);
2535
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2536
- try {
2537
- const event = new CustomEvent("zod-validation-error", {
2538
- detail: {
2539
- operation: "updateKnowbaseAdminDocumentsUpdate",
2540
- path: "/cfg/knowbase/admin/documents/{id}/",
2541
- method: "PUT",
2542
- error,
2543
- response,
2544
- timestamp: /* @__PURE__ */ new Date()
2545
- },
2546
- bubbles: true,
2547
- cancelable: false
2548
- });
2549
- window.dispatchEvent(event);
2550
- } catch (eventError) {
2551
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2552
- }
2553
- }
2554
- throw error;
2555
- }
2556
- }
2557
- async function partialUpdateKnowbaseAdminDocumentsPartialUpdate(id, data, client) {
2558
- const api = client || getAPIInstance();
2559
- const response = await api.ext_knowbase_knowbase.adminDocumentsPartialUpdate(id, data);
2560
- try {
2561
- return DocumentSchema.parse(response);
2562
- } catch (error) {
2563
- consola.consola.error("\u274C Zod Validation Failed");
2564
- consola.consola.box(`partialUpdateKnowbaseAdminDocumentsPartialUpdate
2565
- Path: /cfg/knowbase/admin/documents/{id}/
2566
- Method: PATCH`);
2567
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2568
- consola.consola.error("Validation Issues:");
2569
- error.issues.forEach((issue, index) => {
2570
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2571
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2572
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2573
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2574
- });
2575
- }
2576
- consola.consola.error("Response data:", response);
2577
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2578
- try {
2579
- const event = new CustomEvent("zod-validation-error", {
2580
- detail: {
2581
- operation: "partialUpdateKnowbaseAdminDocumentsPartialUpdate",
2582
- path: "/cfg/knowbase/admin/documents/{id}/",
2583
- method: "PATCH",
2584
- error,
2585
- response,
2586
- timestamp: /* @__PURE__ */ new Date()
2587
- },
2588
- bubbles: true,
2589
- cancelable: false
2590
- });
2591
- window.dispatchEvent(event);
2592
- } catch (eventError) {
2593
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2594
- }
2595
- }
2596
- throw error;
2597
- }
2598
- }
2599
- async function deleteKnowbaseAdminDocumentsDestroy(id, client) {
2600
- const api = client || getAPIInstance();
2601
- const response = await api.ext_knowbase_knowbase.adminDocumentsDestroy(id);
2602
- return response;
2603
- }
2604
- async function createKnowbaseAdminDocumentsReprocessCreate(id, data, client) {
2605
- const api = client || getAPIInstance();
2606
- const response = await api.ext_knowbase_knowbase.adminDocumentsReprocessCreate(id, data);
2607
- try {
2608
- return DocumentSchema.parse(response);
2609
- } catch (error) {
2610
- consola.consola.error("\u274C Zod Validation Failed");
2611
- consola.consola.box(`createKnowbaseAdminDocumentsReprocessCreate
2612
- Path: /cfg/knowbase/admin/documents/{id}/reprocess/
2613
- Method: POST`);
2614
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2615
- consola.consola.error("Validation Issues:");
2616
- error.issues.forEach((issue, index) => {
2617
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2618
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2619
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2620
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2621
- });
2622
- }
2623
- consola.consola.error("Response data:", response);
2624
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2625
- try {
2626
- const event = new CustomEvent("zod-validation-error", {
2627
- detail: {
2628
- operation: "createKnowbaseAdminDocumentsReprocessCreate",
2629
- path: "/cfg/knowbase/admin/documents/{id}/reprocess/",
2630
- method: "POST",
2631
- error,
2632
- response,
2633
- timestamp: /* @__PURE__ */ new Date()
2634
- },
2635
- bubbles: true,
2636
- cancelable: false
2637
- });
2638
- window.dispatchEvent(event);
2639
- } catch (eventError) {
2640
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2641
- }
2642
- }
2643
- throw error;
2644
- }
2645
- }
2646
- async function getKnowbaseAdminDocumentsStatusRetrieve(id, client) {
2647
- const api = client || getAPIInstance();
2648
- const response = await api.ext_knowbase_knowbase.adminDocumentsStatusRetrieve(id);
2649
- try {
2650
- return DocumentProcessingStatusSchema.parse(response);
2651
- } catch (error) {
2652
- consola.consola.error("\u274C Zod Validation Failed");
2653
- consola.consola.box(`getKnowbaseAdminDocumentsStatusRetrieve
2654
- Path: /cfg/knowbase/admin/documents/{id}/status/
2655
- Method: GET`);
2656
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2657
- consola.consola.error("Validation Issues:");
2658
- error.issues.forEach((issue, index) => {
2659
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2660
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2661
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2662
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2663
- });
2664
- }
2665
- consola.consola.error("Response data:", response);
2666
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2667
- try {
2668
- const event = new CustomEvent("zod-validation-error", {
2669
- detail: {
2670
- operation: "getKnowbaseAdminDocumentsStatusRetrieve",
2671
- path: "/cfg/knowbase/admin/documents/{id}/status/",
2672
- method: "GET",
2673
- error,
2674
- response,
2675
- timestamp: /* @__PURE__ */ new Date()
2676
- },
2677
- bubbles: true,
2678
- cancelable: false
2679
- });
2680
- window.dispatchEvent(event);
2681
- } catch (eventError) {
2682
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2683
- }
2684
- }
2685
- throw error;
2686
- }
2687
- }
2688
- async function getKnowbaseAdminDocumentsStatsRetrieve(client) {
2689
- const api = client || getAPIInstance();
2690
- const response = await api.ext_knowbase_knowbase.adminDocumentsStatsRetrieve();
2691
- try {
2692
- return DocumentStatsSchema.parse(response);
2693
- } catch (error) {
2694
- consola.consola.error("\u274C Zod Validation Failed");
2695
- consola.consola.box(`getKnowbaseAdminDocumentsStatsRetrieve
2696
- Path: /cfg/knowbase/admin/documents/stats/
2697
- Method: GET`);
2698
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2699
- consola.consola.error("Validation Issues:");
2700
- error.issues.forEach((issue, index) => {
2701
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2702
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2703
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2704
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2705
- });
2706
- }
2707
- consola.consola.error("Response data:", response);
2708
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2709
- try {
2710
- const event = new CustomEvent("zod-validation-error", {
2711
- detail: {
2712
- operation: "getKnowbaseAdminDocumentsStatsRetrieve",
2713
- path: "/cfg/knowbase/admin/documents/stats/",
2714
- method: "GET",
2715
- error,
2716
- response,
2717
- timestamp: /* @__PURE__ */ new Date()
2718
- },
2719
- bubbles: true,
2720
- cancelable: false
2721
- });
2722
- window.dispatchEvent(event);
2723
- } catch (eventError) {
2724
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2725
- }
2726
- }
2727
- throw error;
2728
- }
2729
- }
2730
- async function getKnowbaseAdminSessionsList(params, client) {
2731
- const api = client || getAPIInstance();
2732
- const response = await api.ext_knowbase_knowbase.adminSessionsList(params?.page, params?.page_size);
2733
- try {
2734
- return PaginatedChatSessionListSchema.parse(response);
2735
- } catch (error) {
2736
- consola.consola.error("\u274C Zod Validation Failed");
2737
- consola.consola.box(`getKnowbaseAdminSessionsList
2738
- Path: /cfg/knowbase/admin/sessions/
2739
- Method: GET`);
2740
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2741
- consola.consola.error("Validation Issues:");
2742
- error.issues.forEach((issue, index) => {
2743
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2744
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2745
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2746
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2747
- });
2748
- }
2749
- consola.consola.error("Response data:", response);
2750
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2751
- try {
2752
- const event = new CustomEvent("zod-validation-error", {
2753
- detail: {
2754
- operation: "getKnowbaseAdminSessionsList",
2755
- path: "/cfg/knowbase/admin/sessions/",
2756
- method: "GET",
2757
- error,
2758
- response,
2759
- timestamp: /* @__PURE__ */ new Date()
2760
- },
2761
- bubbles: true,
2762
- cancelable: false
2763
- });
2764
- window.dispatchEvent(event);
2765
- } catch (eventError) {
2766
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2767
- }
2768
- }
2769
- throw error;
2770
- }
2771
- }
2772
- async function createKnowbaseAdminSessionsCreate(data, client) {
2773
- const api = client || getAPIInstance();
2774
- const response = await api.ext_knowbase_knowbase.adminSessionsCreate(data);
2775
- try {
2776
- return ChatSessionSchema.parse(response);
2777
- } catch (error) {
2778
- consola.consola.error("\u274C Zod Validation Failed");
2779
- consola.consola.box(`createKnowbaseAdminSessionsCreate
2780
- Path: /cfg/knowbase/admin/sessions/
2781
- Method: POST`);
2782
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2783
- consola.consola.error("Validation Issues:");
2784
- error.issues.forEach((issue, index) => {
2785
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2786
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2787
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2788
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2789
- });
2790
- }
2791
- consola.consola.error("Response data:", response);
2792
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2793
- try {
2794
- const event = new CustomEvent("zod-validation-error", {
2795
- detail: {
2796
- operation: "createKnowbaseAdminSessionsCreate",
2797
- path: "/cfg/knowbase/admin/sessions/",
2798
- method: "POST",
2799
- error,
2800
- response,
2801
- timestamp: /* @__PURE__ */ new Date()
2802
- },
2803
- bubbles: true,
2804
- cancelable: false
2805
- });
2806
- window.dispatchEvent(event);
2807
- } catch (eventError) {
2808
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2809
- }
2810
- }
2811
- throw error;
2812
- }
2813
- }
2814
- async function getKnowbaseAdminSessionsRetrieve(id, client) {
2815
- const api = client || getAPIInstance();
2816
- const response = await api.ext_knowbase_knowbase.adminSessionsRetrieve(id);
2817
- try {
2818
- return ChatSessionSchema.parse(response);
2819
- } catch (error) {
2820
- consola.consola.error("\u274C Zod Validation Failed");
2821
- consola.consola.box(`getKnowbaseAdminSessionsRetrieve
2822
- Path: /cfg/knowbase/admin/sessions/{id}/
2823
- Method: GET`);
2824
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2825
- consola.consola.error("Validation Issues:");
2826
- error.issues.forEach((issue, index) => {
2827
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2828
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2829
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2830
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2831
- });
2832
- }
2833
- consola.consola.error("Response data:", response);
2834
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2835
- try {
2836
- const event = new CustomEvent("zod-validation-error", {
2837
- detail: {
2838
- operation: "getKnowbaseAdminSessionsRetrieve",
2839
- path: "/cfg/knowbase/admin/sessions/{id}/",
2840
- method: "GET",
2841
- error,
2842
- response,
2843
- timestamp: /* @__PURE__ */ new Date()
2844
- },
2845
- bubbles: true,
2846
- cancelable: false
2847
- });
2848
- window.dispatchEvent(event);
2849
- } catch (eventError) {
2850
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2851
- }
2852
- }
2853
- throw error;
2854
- }
2855
- }
2856
- async function updateKnowbaseAdminSessionsUpdate(id, data, client) {
2857
- const api = client || getAPIInstance();
2858
- const response = await api.ext_knowbase_knowbase.adminSessionsUpdate(id, data);
2859
- try {
2860
- return ChatSessionSchema.parse(response);
2861
- } catch (error) {
2862
- consola.consola.error("\u274C Zod Validation Failed");
2863
- consola.consola.box(`updateKnowbaseAdminSessionsUpdate
2864
- Path: /cfg/knowbase/admin/sessions/{id}/
2865
- Method: PUT`);
2866
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2867
- consola.consola.error("Validation Issues:");
2868
- error.issues.forEach((issue, index) => {
2869
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2870
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2871
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2872
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2873
- });
2874
- }
2875
- consola.consola.error("Response data:", response);
2876
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2877
- try {
2878
- const event = new CustomEvent("zod-validation-error", {
2879
- detail: {
2880
- operation: "updateKnowbaseAdminSessionsUpdate",
2881
- path: "/cfg/knowbase/admin/sessions/{id}/",
2882
- method: "PUT",
2883
- error,
2884
- response,
2885
- timestamp: /* @__PURE__ */ new Date()
2886
- },
2887
- bubbles: true,
2888
- cancelable: false
2889
- });
2890
- window.dispatchEvent(event);
2891
- } catch (eventError) {
2892
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2893
- }
2894
- }
2895
- throw error;
2896
- }
2897
- }
2898
- async function partialUpdateKnowbaseAdminSessionsPartialUpdate(id, data, client) {
2899
- const api = client || getAPIInstance();
2900
- const response = await api.ext_knowbase_knowbase.adminSessionsPartialUpdate(id, data);
2901
- try {
2902
- return ChatSessionSchema.parse(response);
2903
- } catch (error) {
2904
- consola.consola.error("\u274C Zod Validation Failed");
2905
- consola.consola.box(`partialUpdateKnowbaseAdminSessionsPartialUpdate
2906
- Path: /cfg/knowbase/admin/sessions/{id}/
2907
- Method: PATCH`);
2908
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2909
- consola.consola.error("Validation Issues:");
2910
- error.issues.forEach((issue, index) => {
2911
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2912
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2913
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2914
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2915
- });
2916
- }
2917
- consola.consola.error("Response data:", response);
2918
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2919
- try {
2920
- const event = new CustomEvent("zod-validation-error", {
2921
- detail: {
2922
- operation: "partialUpdateKnowbaseAdminSessionsPartialUpdate",
2923
- path: "/cfg/knowbase/admin/sessions/{id}/",
2924
- method: "PATCH",
2925
- error,
2926
- response,
2927
- timestamp: /* @__PURE__ */ new Date()
2928
- },
2929
- bubbles: true,
2930
- cancelable: false
2931
- });
2932
- window.dispatchEvent(event);
2933
- } catch (eventError) {
2934
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2935
- }
2936
- }
2937
- throw error;
2938
- }
2939
- }
2940
- async function deleteKnowbaseAdminSessionsDestroy(id, client) {
2941
- const api = client || getAPIInstance();
2942
- const response = await api.ext_knowbase_knowbase.adminSessionsDestroy(id);
2943
- return response;
2944
- }
2945
- async function createKnowbaseAdminSessionsActivateCreate(id, data, client) {
2946
- const api = client || getAPIInstance();
2947
- const response = await api.ext_knowbase_knowbase.adminSessionsActivateCreate(id, data);
2948
- try {
2949
- return ChatSessionSchema.parse(response);
2950
- } catch (error) {
2951
- consola.consola.error("\u274C Zod Validation Failed");
2952
- consola.consola.box(`createKnowbaseAdminSessionsActivateCreate
2953
- Path: /cfg/knowbase/admin/sessions/{id}/activate/
2954
- Method: POST`);
2955
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2956
- consola.consola.error("Validation Issues:");
2957
- error.issues.forEach((issue, index) => {
2958
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
2959
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
2960
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
2961
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
2962
- });
2963
- }
2964
- consola.consola.error("Response data:", response);
2965
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
2966
- try {
2967
- const event = new CustomEvent("zod-validation-error", {
2968
- detail: {
2969
- operation: "createKnowbaseAdminSessionsActivateCreate",
2970
- path: "/cfg/knowbase/admin/sessions/{id}/activate/",
2971
- method: "POST",
2972
- error,
2973
- response,
2974
- timestamp: /* @__PURE__ */ new Date()
2975
- },
2976
- bubbles: true,
2977
- cancelable: false
2978
- });
2979
- window.dispatchEvent(event);
2980
- } catch (eventError) {
2981
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
2982
- }
2983
- }
2984
- throw error;
2985
- }
2986
- }
2987
- async function createKnowbaseAdminSessionsArchiveCreate(id, data, client) {
2988
- const api = client || getAPIInstance();
2989
- const response = await api.ext_knowbase_knowbase.adminSessionsArchiveCreate(id, data);
2990
- try {
2991
- return ChatSessionSchema.parse(response);
2992
- } catch (error) {
2993
- consola.consola.error("\u274C Zod Validation Failed");
2994
- consola.consola.box(`createKnowbaseAdminSessionsArchiveCreate
2995
- Path: /cfg/knowbase/admin/sessions/{id}/archive/
2996
- Method: POST`);
2997
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2998
- consola.consola.error("Validation Issues:");
2999
- error.issues.forEach((issue, index) => {
3000
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3001
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3002
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3003
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3004
- });
3005
- }
3006
- consola.consola.error("Response data:", response);
3007
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3008
- try {
3009
- const event = new CustomEvent("zod-validation-error", {
3010
- detail: {
3011
- operation: "createKnowbaseAdminSessionsArchiveCreate",
3012
- path: "/cfg/knowbase/admin/sessions/{id}/archive/",
3013
- method: "POST",
3014
- error,
3015
- response,
3016
- timestamp: /* @__PURE__ */ new Date()
3017
- },
3018
- bubbles: true,
3019
- cancelable: false
3020
- });
3021
- window.dispatchEvent(event);
3022
- } catch (eventError) {
3023
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3024
- }
3025
- }
3026
- throw error;
3027
- }
3028
- }
3029
- async function getKnowbaseCategoriesList(params, client) {
3030
- const api = client || getAPIInstance();
3031
- const response = await api.ext_knowbase_knowbase.categoriesList(params?.page, params?.page_size);
3032
- try {
3033
- return PaginatedPublicCategoryListSchema.parse(response);
3034
- } catch (error) {
3035
- consola.consola.error("\u274C Zod Validation Failed");
3036
- consola.consola.box(`getKnowbaseCategoriesList
3037
- Path: /cfg/knowbase/categories/
3038
- Method: GET`);
3039
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3040
- consola.consola.error("Validation Issues:");
3041
- error.issues.forEach((issue, index) => {
3042
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3043
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3044
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3045
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3046
- });
3047
- }
3048
- consola.consola.error("Response data:", response);
3049
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3050
- try {
3051
- const event = new CustomEvent("zod-validation-error", {
3052
- detail: {
3053
- operation: "getKnowbaseCategoriesList",
3054
- path: "/cfg/knowbase/categories/",
3055
- method: "GET",
3056
- error,
3057
- response,
3058
- timestamp: /* @__PURE__ */ new Date()
3059
- },
3060
- bubbles: true,
3061
- cancelable: false
3062
- });
3063
- window.dispatchEvent(event);
3064
- } catch (eventError) {
3065
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3066
- }
3067
- }
3068
- throw error;
3069
- }
3070
- }
3071
- async function getKnowbaseCategoriesRetrieve(id, client) {
3072
- const api = client || getAPIInstance();
3073
- const response = await api.ext_knowbase_knowbase.categoriesRetrieve(id);
3074
- try {
3075
- return PublicCategorySchema.parse(response);
3076
- } catch (error) {
3077
- consola.consola.error("\u274C Zod Validation Failed");
3078
- consola.consola.box(`getKnowbaseCategoriesRetrieve
3079
- Path: /cfg/knowbase/categories/{id}/
3080
- Method: GET`);
3081
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3082
- consola.consola.error("Validation Issues:");
3083
- error.issues.forEach((issue, index) => {
3084
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3085
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3086
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3087
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3088
- });
3089
- }
3090
- consola.consola.error("Response data:", response);
3091
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3092
- try {
3093
- const event = new CustomEvent("zod-validation-error", {
3094
- detail: {
3095
- operation: "getKnowbaseCategoriesRetrieve",
3096
- path: "/cfg/knowbase/categories/{id}/",
3097
- method: "GET",
3098
- error,
3099
- response,
3100
- timestamp: /* @__PURE__ */ new Date()
3101
- },
3102
- bubbles: true,
3103
- cancelable: false
3104
- });
3105
- window.dispatchEvent(event);
3106
- } catch (eventError) {
3107
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3108
- }
3109
- }
3110
- throw error;
3111
- }
3112
- }
3113
- async function getKnowbaseDocumentsList(params, client) {
3114
- const api = client || getAPIInstance();
3115
- const response = await api.ext_knowbase_knowbase.documentsList(params?.category, params?.page, params?.page_size, params?.search);
3116
- try {
3117
- return PaginatedPublicDocumentListListSchema.parse(response);
3118
- } catch (error) {
3119
- consola.consola.error("\u274C Zod Validation Failed");
3120
- consola.consola.box(`getKnowbaseDocumentsList
3121
- Path: /cfg/knowbase/documents/
3122
- Method: GET`);
3123
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3124
- consola.consola.error("Validation Issues:");
3125
- error.issues.forEach((issue, index) => {
3126
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3127
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3128
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3129
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3130
- });
3131
- }
3132
- consola.consola.error("Response data:", response);
3133
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3134
- try {
3135
- const event = new CustomEvent("zod-validation-error", {
3136
- detail: {
3137
- operation: "getKnowbaseDocumentsList",
3138
- path: "/cfg/knowbase/documents/",
3139
- method: "GET",
3140
- error,
3141
- response,
3142
- timestamp: /* @__PURE__ */ new Date()
3143
- },
3144
- bubbles: true,
3145
- cancelable: false
3146
- });
3147
- window.dispatchEvent(event);
3148
- } catch (eventError) {
3149
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3150
- }
3151
- }
3152
- throw error;
3153
- }
3154
- }
3155
- async function getKnowbaseDocumentsRetrieve(id, client) {
3156
- const api = client || getAPIInstance();
3157
- const response = await api.ext_knowbase_knowbase.documentsRetrieve(id);
3158
- try {
3159
- return PublicDocumentSchema.parse(response);
3160
- } catch (error) {
3161
- consola.consola.error("\u274C Zod Validation Failed");
3162
- consola.consola.box(`getKnowbaseDocumentsRetrieve
3163
- Path: /cfg/knowbase/documents/{id}/
3164
- Method: GET`);
3165
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3166
- consola.consola.error("Validation Issues:");
3167
- error.issues.forEach((issue, index) => {
3168
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3169
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3170
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3171
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3172
- });
3173
- }
3174
- consola.consola.error("Response data:", response);
3175
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3176
- try {
3177
- const event = new CustomEvent("zod-validation-error", {
3178
- detail: {
3179
- operation: "getKnowbaseDocumentsRetrieve",
3180
- path: "/cfg/knowbase/documents/{id}/",
3181
- method: "GET",
3182
- error,
3183
- response,
3184
- timestamp: /* @__PURE__ */ new Date()
3185
- },
3186
- bubbles: true,
3187
- cancelable: false
3188
- });
3189
- window.dispatchEvent(event);
3190
- } catch (eventError) {
3191
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3192
- }
3193
- }
3194
- throw error;
3195
- }
3196
- }
3197
- async function getKnowbaseSystemArchivesList(params, client) {
3198
- const api = client || getAPIInstance();
3199
- const response = await api.ext_knowbase_knowbase.systemArchivesList(params?.page, params?.page_size);
3200
- try {
3201
- return PaginatedDocumentArchiveListListSchema.parse(response);
3202
- } catch (error) {
3203
- consola.consola.error("\u274C Zod Validation Failed");
3204
- consola.consola.box(`getKnowbaseSystemArchivesList
3205
- Path: /cfg/knowbase/system/archives/
3206
- Method: GET`);
3207
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3208
- consola.consola.error("Validation Issues:");
3209
- error.issues.forEach((issue, index) => {
3210
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3211
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3212
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3213
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3214
- });
3215
- }
3216
- consola.consola.error("Response data:", response);
3217
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3218
- try {
3219
- const event = new CustomEvent("zod-validation-error", {
3220
- detail: {
3221
- operation: "getKnowbaseSystemArchivesList",
3222
- path: "/cfg/knowbase/system/archives/",
3223
- method: "GET",
3224
- error,
3225
- response,
3226
- timestamp: /* @__PURE__ */ new Date()
3227
- },
3228
- bubbles: true,
3229
- cancelable: false
3230
- });
3231
- window.dispatchEvent(event);
3232
- } catch (eventError) {
3233
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3234
- }
3235
- }
3236
- throw error;
3237
- }
3238
- }
3239
- async function createKnowbaseSystemArchivesCreate(data, client) {
3240
- const api = client || getAPIInstance();
3241
- const response = await api.ext_knowbase_knowbase.systemArchivesCreate(data);
3242
- try {
3243
- return ArchiveProcessingResultSchema.parse(response);
3244
- } catch (error) {
3245
- consola.consola.error("\u274C Zod Validation Failed");
3246
- consola.consola.box(`createKnowbaseSystemArchivesCreate
3247
- Path: /cfg/knowbase/system/archives/
3248
- Method: POST`);
3249
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3250
- consola.consola.error("Validation Issues:");
3251
- error.issues.forEach((issue, index) => {
3252
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3253
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3254
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3255
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3256
- });
3257
- }
3258
- consola.consola.error("Response data:", response);
3259
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3260
- try {
3261
- const event = new CustomEvent("zod-validation-error", {
3262
- detail: {
3263
- operation: "createKnowbaseSystemArchivesCreate",
3264
- path: "/cfg/knowbase/system/archives/",
3265
- method: "POST",
3266
- error,
3267
- response,
3268
- timestamp: /* @__PURE__ */ new Date()
3269
- },
3270
- bubbles: true,
3271
- cancelable: false
3272
- });
3273
- window.dispatchEvent(event);
3274
- } catch (eventError) {
3275
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3276
- }
3277
- }
3278
- throw error;
3279
- }
3280
- }
3281
- async function getKnowbaseSystemArchivesRetrieve(id, client) {
3282
- const api = client || getAPIInstance();
3283
- const response = await api.ext_knowbase_knowbase.systemArchivesRetrieve(id);
3284
- try {
3285
- return DocumentArchiveDetailSchema.parse(response);
3286
- } catch (error) {
3287
- consola.consola.error("\u274C Zod Validation Failed");
3288
- consola.consola.box(`getKnowbaseSystemArchivesRetrieve
3289
- Path: /cfg/knowbase/system/archives/{id}/
3290
- Method: GET`);
3291
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3292
- consola.consola.error("Validation Issues:");
3293
- error.issues.forEach((issue, index) => {
3294
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3295
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3296
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3297
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3298
- });
3299
- }
3300
- consola.consola.error("Response data:", response);
3301
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3302
- try {
3303
- const event = new CustomEvent("zod-validation-error", {
3304
- detail: {
3305
- operation: "getKnowbaseSystemArchivesRetrieve",
3306
- path: "/cfg/knowbase/system/archives/{id}/",
3307
- method: "GET",
3308
- error,
3309
- response,
3310
- timestamp: /* @__PURE__ */ new Date()
3311
- },
3312
- bubbles: true,
3313
- cancelable: false
3314
- });
3315
- window.dispatchEvent(event);
3316
- } catch (eventError) {
3317
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3318
- }
3319
- }
3320
- throw error;
3321
- }
3322
- }
3323
- async function updateKnowbaseSystemArchivesUpdate(id, data, client) {
3324
- const api = client || getAPIInstance();
3325
- const response = await api.ext_knowbase_knowbase.systemArchivesUpdate(id, data);
3326
- try {
3327
- return DocumentArchiveSchema.parse(response);
3328
- } catch (error) {
3329
- consola.consola.error("\u274C Zod Validation Failed");
3330
- consola.consola.box(`updateKnowbaseSystemArchivesUpdate
3331
- Path: /cfg/knowbase/system/archives/{id}/
3332
- Method: PUT`);
3333
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3334
- consola.consola.error("Validation Issues:");
3335
- error.issues.forEach((issue, index) => {
3336
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3337
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3338
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3339
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3340
- });
3341
- }
3342
- consola.consola.error("Response data:", response);
3343
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3344
- try {
3345
- const event = new CustomEvent("zod-validation-error", {
3346
- detail: {
3347
- operation: "updateKnowbaseSystemArchivesUpdate",
3348
- path: "/cfg/knowbase/system/archives/{id}/",
3349
- method: "PUT",
3350
- error,
3351
- response,
3352
- timestamp: /* @__PURE__ */ new Date()
3353
- },
3354
- bubbles: true,
3355
- cancelable: false
3356
- });
3357
- window.dispatchEvent(event);
3358
- } catch (eventError) {
3359
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3360
- }
3361
- }
3362
- throw error;
3363
- }
3364
- }
3365
- async function partialUpdateKnowbaseSystemArchivesPartialUpdate(id, data, client) {
3366
- const api = client || getAPIInstance();
3367
- const response = await api.ext_knowbase_knowbase.systemArchivesPartialUpdate(id, data);
3368
- try {
3369
- return DocumentArchiveSchema.parse(response);
3370
- } catch (error) {
3371
- consola.consola.error("\u274C Zod Validation Failed");
3372
- consola.consola.box(`partialUpdateKnowbaseSystemArchivesPartialUpdate
3373
- Path: /cfg/knowbase/system/archives/{id}/
3374
- Method: PATCH`);
3375
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3376
- consola.consola.error("Validation Issues:");
3377
- error.issues.forEach((issue, index) => {
3378
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3379
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3380
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3381
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3382
- });
3383
- }
3384
- consola.consola.error("Response data:", response);
3385
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3386
- try {
3387
- const event = new CustomEvent("zod-validation-error", {
3388
- detail: {
3389
- operation: "partialUpdateKnowbaseSystemArchivesPartialUpdate",
3390
- path: "/cfg/knowbase/system/archives/{id}/",
3391
- method: "PATCH",
3392
- error,
3393
- response,
3394
- timestamp: /* @__PURE__ */ new Date()
3395
- },
3396
- bubbles: true,
3397
- cancelable: false
3398
- });
3399
- window.dispatchEvent(event);
3400
- } catch (eventError) {
3401
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3402
- }
3403
- }
3404
- throw error;
3405
- }
3406
- }
3407
- async function deleteKnowbaseSystemArchivesDestroy(id, client) {
3408
- const api = client || getAPIInstance();
3409
- const response = await api.ext_knowbase_knowbase.systemArchivesDestroy(id);
3410
- return response;
3411
- }
3412
- async function getKnowbaseSystemArchivesFileTreeRetrieve(id, client) {
3413
- const api = client || getAPIInstance();
3414
- const response = await api.ext_knowbase_knowbase.systemArchivesFileTreeRetrieve(id);
3415
- return response;
3416
- }
3417
- async function getKnowbaseSystemArchivesItemsList(id, params, client) {
3418
- const api = client || getAPIInstance();
3419
- const response = await api.ext_knowbase_knowbase.systemArchivesItemsList(id, params?.page, params?.page_size);
3420
- try {
3421
- return PaginatedArchiveItemListSchema.parse(response);
3422
- } catch (error) {
3423
- consola.consola.error("\u274C Zod Validation Failed");
3424
- consola.consola.box(`getKnowbaseSystemArchivesItemsList
3425
- Path: /cfg/knowbase/system/archives/{id}/items/
3426
- Method: GET`);
3427
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3428
- consola.consola.error("Validation Issues:");
3429
- error.issues.forEach((issue, index) => {
3430
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3431
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3432
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3433
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3434
- });
3435
- }
3436
- consola.consola.error("Response data:", response);
3437
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3438
- try {
3439
- const event = new CustomEvent("zod-validation-error", {
3440
- detail: {
3441
- operation: "getKnowbaseSystemArchivesItemsList",
3442
- path: "/cfg/knowbase/system/archives/{id}/items/",
3443
- method: "GET",
3444
- error,
3445
- response,
3446
- timestamp: /* @__PURE__ */ new Date()
3447
- },
3448
- bubbles: true,
3449
- cancelable: false
3450
- });
3451
- window.dispatchEvent(event);
3452
- } catch (eventError) {
3453
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3454
- }
3455
- }
3456
- throw error;
3457
- }
3458
- }
3459
- async function createKnowbaseSystemArchivesSearchCreate(id, data, params, client) {
3460
- const api = client || getAPIInstance();
3461
- const response = await api.ext_knowbase_knowbase.systemArchivesSearchCreate(id, data, params?.page, params?.page_size);
3462
- try {
3463
- return PaginatedArchiveSearchResultListSchema.parse(response);
3464
- } catch (error) {
3465
- consola.consola.error("\u274C Zod Validation Failed");
3466
- consola.consola.box(`createKnowbaseSystemArchivesSearchCreate
3467
- Path: /cfg/knowbase/system/archives/{id}/search/
3468
- Method: POST`);
3469
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3470
- consola.consola.error("Validation Issues:");
3471
- error.issues.forEach((issue, index) => {
3472
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3473
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3474
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3475
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3476
- });
3477
- }
3478
- consola.consola.error("Response data:", response);
3479
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3480
- try {
3481
- const event = new CustomEvent("zod-validation-error", {
3482
- detail: {
3483
- operation: "createKnowbaseSystemArchivesSearchCreate",
3484
- path: "/cfg/knowbase/system/archives/{id}/search/",
3485
- method: "POST",
3486
- error,
3487
- response,
3488
- timestamp: /* @__PURE__ */ new Date()
3489
- },
3490
- bubbles: true,
3491
- cancelable: false
3492
- });
3493
- window.dispatchEvent(event);
3494
- } catch (eventError) {
3495
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3496
- }
3497
- }
3498
- throw error;
3499
- }
3500
- }
3501
- async function createKnowbaseSystemArchivesRevectorizeCreate(data, client) {
3502
- const api = client || getAPIInstance();
3503
- const response = await api.ext_knowbase_knowbase.systemArchivesRevectorizeCreate(data);
3504
- try {
3505
- return VectorizationResultSchema.parse(response);
3506
- } catch (error) {
3507
- consola.consola.error("\u274C Zod Validation Failed");
3508
- consola.consola.box(`createKnowbaseSystemArchivesRevectorizeCreate
3509
- Path: /cfg/knowbase/system/archives/revectorize/
3510
- Method: POST`);
3511
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3512
- consola.consola.error("Validation Issues:");
3513
- error.issues.forEach((issue, index) => {
3514
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3515
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3516
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3517
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3518
- });
3519
- }
3520
- consola.consola.error("Response data:", response);
3521
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3522
- try {
3523
- const event = new CustomEvent("zod-validation-error", {
3524
- detail: {
3525
- operation: "createKnowbaseSystemArchivesRevectorizeCreate",
3526
- path: "/cfg/knowbase/system/archives/revectorize/",
3527
- method: "POST",
3528
- error,
3529
- response,
3530
- timestamp: /* @__PURE__ */ new Date()
3531
- },
3532
- bubbles: true,
3533
- cancelable: false
3534
- });
3535
- window.dispatchEvent(event);
3536
- } catch (eventError) {
3537
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3538
- }
3539
- }
3540
- throw error;
3541
- }
3542
- }
3543
- async function getKnowbaseSystemArchivesStatisticsRetrieve(client) {
3544
- const api = client || getAPIInstance();
3545
- const response = await api.ext_knowbase_knowbase.systemArchivesStatisticsRetrieve();
3546
- try {
3547
- return ArchiveStatisticsSchema.parse(response);
3548
- } catch (error) {
3549
- consola.consola.error("\u274C Zod Validation Failed");
3550
- consola.consola.box(`getKnowbaseSystemArchivesStatisticsRetrieve
3551
- Path: /cfg/knowbase/system/archives/statistics/
3552
- Method: GET`);
3553
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3554
- consola.consola.error("Validation Issues:");
3555
- error.issues.forEach((issue, index) => {
3556
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3557
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3558
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3559
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3560
- });
3561
- }
3562
- consola.consola.error("Response data:", response);
3563
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3564
- try {
3565
- const event = new CustomEvent("zod-validation-error", {
3566
- detail: {
3567
- operation: "getKnowbaseSystemArchivesStatisticsRetrieve",
3568
- path: "/cfg/knowbase/system/archives/statistics/",
3569
- method: "GET",
3570
- error,
3571
- response,
3572
- timestamp: /* @__PURE__ */ new Date()
3573
- },
3574
- bubbles: true,
3575
- cancelable: false
3576
- });
3577
- window.dispatchEvent(event);
3578
- } catch (eventError) {
3579
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3580
- }
3581
- }
3582
- throw error;
3583
- }
3584
- }
3585
- async function getKnowbaseSystemArchivesVectorizationStatsRetrieve(client) {
3586
- const api = client || getAPIInstance();
3587
- const response = await api.ext_knowbase_knowbase.systemArchivesVectorizationStatsRetrieve();
3588
- try {
3589
- return VectorizationStatisticsSchema.parse(response);
3590
- } catch (error) {
3591
- consola.consola.error("\u274C Zod Validation Failed");
3592
- consola.consola.box(`getKnowbaseSystemArchivesVectorizationStatsRetrieve
3593
- Path: /cfg/knowbase/system/archives/vectorization_stats/
3594
- Method: GET`);
3595
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3596
- consola.consola.error("Validation Issues:");
3597
- error.issues.forEach((issue, index) => {
3598
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3599
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3600
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3601
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3602
- });
3603
- }
3604
- consola.consola.error("Response data:", response);
3605
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3606
- try {
3607
- const event = new CustomEvent("zod-validation-error", {
3608
- detail: {
3609
- operation: "getKnowbaseSystemArchivesVectorizationStatsRetrieve",
3610
- path: "/cfg/knowbase/system/archives/vectorization_stats/",
3611
- method: "GET",
3612
- error,
3613
- response,
3614
- timestamp: /* @__PURE__ */ new Date()
3615
- },
3616
- bubbles: true,
3617
- cancelable: false
3618
- });
3619
- window.dispatchEvent(event);
3620
- } catch (eventError) {
3621
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3622
- }
3623
- }
3624
- throw error;
3625
- }
3626
- }
3627
- async function getKnowbaseSystemChunksList(params, client) {
3628
- const api = client || getAPIInstance();
3629
- const response = await api.ext_knowbase_knowbase.systemChunksList(params?.page, params?.page_size);
3630
- try {
3631
- return PaginatedArchiveItemChunkListSchema.parse(response);
3632
- } catch (error) {
3633
- consola.consola.error("\u274C Zod Validation Failed");
3634
- consola.consola.box(`getKnowbaseSystemChunksList
3635
- Path: /cfg/knowbase/system/chunks/
3636
- Method: GET`);
3637
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3638
- consola.consola.error("Validation Issues:");
3639
- error.issues.forEach((issue, index) => {
3640
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3641
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3642
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3643
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3644
- });
3645
- }
3646
- consola.consola.error("Response data:", response);
3647
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3648
- try {
3649
- const event = new CustomEvent("zod-validation-error", {
3650
- detail: {
3651
- operation: "getKnowbaseSystemChunksList",
3652
- path: "/cfg/knowbase/system/chunks/",
3653
- method: "GET",
3654
- error,
3655
- response,
3656
- timestamp: /* @__PURE__ */ new Date()
3657
- },
3658
- bubbles: true,
3659
- cancelable: false
3660
- });
3661
- window.dispatchEvent(event);
3662
- } catch (eventError) {
3663
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3664
- }
3665
- }
3666
- throw error;
3667
- }
3668
- }
3669
- async function createKnowbaseSystemChunksCreate(data, client) {
3670
- const api = client || getAPIInstance();
3671
- const response = await api.ext_knowbase_knowbase.systemChunksCreate(data);
3672
- try {
3673
- return ArchiveItemChunkSchema.parse(response);
3674
- } catch (error) {
3675
- consola.consola.error("\u274C Zod Validation Failed");
3676
- consola.consola.box(`createKnowbaseSystemChunksCreate
3677
- Path: /cfg/knowbase/system/chunks/
3678
- Method: POST`);
3679
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3680
- consola.consola.error("Validation Issues:");
3681
- error.issues.forEach((issue, index) => {
3682
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3683
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3684
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3685
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3686
- });
3687
- }
3688
- consola.consola.error("Response data:", response);
3689
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3690
- try {
3691
- const event = new CustomEvent("zod-validation-error", {
3692
- detail: {
3693
- operation: "createKnowbaseSystemChunksCreate",
3694
- path: "/cfg/knowbase/system/chunks/",
3695
- method: "POST",
3696
- error,
3697
- response,
3698
- timestamp: /* @__PURE__ */ new Date()
3699
- },
3700
- bubbles: true,
3701
- cancelable: false
3702
- });
3703
- window.dispatchEvent(event);
3704
- } catch (eventError) {
3705
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3706
- }
3707
- }
3708
- throw error;
3709
- }
3710
- }
3711
- async function getKnowbaseSystemChunksRetrieve(id, client) {
3712
- const api = client || getAPIInstance();
3713
- const response = await api.ext_knowbase_knowbase.systemChunksRetrieve(id);
3714
- try {
3715
- return ArchiveItemChunkDetailSchema.parse(response);
3716
- } catch (error) {
3717
- consola.consola.error("\u274C Zod Validation Failed");
3718
- consola.consola.box(`getKnowbaseSystemChunksRetrieve
3719
- Path: /cfg/knowbase/system/chunks/{id}/
3720
- Method: GET`);
3721
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3722
- consola.consola.error("Validation Issues:");
3723
- error.issues.forEach((issue, index) => {
3724
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3725
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3726
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3727
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3728
- });
3729
- }
3730
- consola.consola.error("Response data:", response);
3731
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3732
- try {
3733
- const event = new CustomEvent("zod-validation-error", {
3734
- detail: {
3735
- operation: "getKnowbaseSystemChunksRetrieve",
3736
- path: "/cfg/knowbase/system/chunks/{id}/",
3737
- method: "GET",
3738
- error,
3739
- response,
3740
- timestamp: /* @__PURE__ */ new Date()
3741
- },
3742
- bubbles: true,
3743
- cancelable: false
3744
- });
3745
- window.dispatchEvent(event);
3746
- } catch (eventError) {
3747
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3748
- }
3749
- }
3750
- throw error;
3751
- }
3752
- }
3753
- async function updateKnowbaseSystemChunksUpdate(id, data, client) {
3754
- const api = client || getAPIInstance();
3755
- const response = await api.ext_knowbase_knowbase.systemChunksUpdate(id, data);
3756
- try {
3757
- return ArchiveItemChunkSchema.parse(response);
3758
- } catch (error) {
3759
- consola.consola.error("\u274C Zod Validation Failed");
3760
- consola.consola.box(`updateKnowbaseSystemChunksUpdate
3761
- Path: /cfg/knowbase/system/chunks/{id}/
3762
- Method: PUT`);
3763
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3764
- consola.consola.error("Validation Issues:");
3765
- error.issues.forEach((issue, index) => {
3766
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3767
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3768
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3769
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3770
- });
3771
- }
3772
- consola.consola.error("Response data:", response);
3773
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3774
- try {
3775
- const event = new CustomEvent("zod-validation-error", {
3776
- detail: {
3777
- operation: "updateKnowbaseSystemChunksUpdate",
3778
- path: "/cfg/knowbase/system/chunks/{id}/",
3779
- method: "PUT",
3780
- error,
3781
- response,
3782
- timestamp: /* @__PURE__ */ new Date()
3783
- },
3784
- bubbles: true,
3785
- cancelable: false
3786
- });
3787
- window.dispatchEvent(event);
3788
- } catch (eventError) {
3789
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3790
- }
3791
- }
3792
- throw error;
3793
- }
3794
- }
3795
- async function partialUpdateKnowbaseSystemChunksPartialUpdate(id, data, client) {
3796
- const api = client || getAPIInstance();
3797
- const response = await api.ext_knowbase_knowbase.systemChunksPartialUpdate(id, data);
3798
- try {
3799
- return ArchiveItemChunkSchema.parse(response);
3800
- } catch (error) {
3801
- consola.consola.error("\u274C Zod Validation Failed");
3802
- consola.consola.box(`partialUpdateKnowbaseSystemChunksPartialUpdate
3803
- Path: /cfg/knowbase/system/chunks/{id}/
3804
- Method: PATCH`);
3805
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3806
- consola.consola.error("Validation Issues:");
3807
- error.issues.forEach((issue, index) => {
3808
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3809
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3810
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3811
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3812
- });
3813
- }
3814
- consola.consola.error("Response data:", response);
3815
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3816
- try {
3817
- const event = new CustomEvent("zod-validation-error", {
3818
- detail: {
3819
- operation: "partialUpdateKnowbaseSystemChunksPartialUpdate",
3820
- path: "/cfg/knowbase/system/chunks/{id}/",
3821
- method: "PATCH",
3822
- error,
3823
- response,
3824
- timestamp: /* @__PURE__ */ new Date()
3825
- },
3826
- bubbles: true,
3827
- cancelable: false
3828
- });
3829
- window.dispatchEvent(event);
3830
- } catch (eventError) {
3831
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3832
- }
3833
- }
3834
- throw error;
3835
- }
3836
- }
3837
- async function deleteKnowbaseSystemChunksDestroy(id, client) {
3838
- const api = client || getAPIInstance();
3839
- const response = await api.ext_knowbase_knowbase.systemChunksDestroy(id);
3840
- return response;
3841
- }
3842
- async function getKnowbaseSystemChunksContextRetrieve(id, client) {
3843
- const api = client || getAPIInstance();
3844
- const response = await api.ext_knowbase_knowbase.systemChunksContextRetrieve(id);
3845
- try {
3846
- return ArchiveItemChunkDetailSchema.parse(response);
3847
- } catch (error) {
3848
- consola.consola.error("\u274C Zod Validation Failed");
3849
- consola.consola.box(`getKnowbaseSystemChunksContextRetrieve
3850
- Path: /cfg/knowbase/system/chunks/{id}/context/
3851
- Method: GET`);
3852
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3853
- consola.consola.error("Validation Issues:");
3854
- error.issues.forEach((issue, index) => {
3855
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3856
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3857
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3858
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3859
- });
3860
- }
3861
- consola.consola.error("Response data:", response);
3862
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3863
- try {
3864
- const event = new CustomEvent("zod-validation-error", {
3865
- detail: {
3866
- operation: "getKnowbaseSystemChunksContextRetrieve",
3867
- path: "/cfg/knowbase/system/chunks/{id}/context/",
3868
- method: "GET",
3869
- error,
3870
- response,
3871
- timestamp: /* @__PURE__ */ new Date()
3872
- },
3873
- bubbles: true,
3874
- cancelable: false
3875
- });
3876
- window.dispatchEvent(event);
3877
- } catch (eventError) {
3878
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3879
- }
3880
- }
3881
- throw error;
3882
- }
3883
- }
3884
- async function createKnowbaseSystemChunksVectorizeCreate(id, data, client) {
3885
- const api = client || getAPIInstance();
3886
- const response = await api.ext_knowbase_knowbase.systemChunksVectorizeCreate(id, data);
3887
- return response;
3888
- }
3889
- async function getKnowbaseSystemItemsList(params, client) {
3890
- const api = client || getAPIInstance();
3891
- const response = await api.ext_knowbase_knowbase.systemItemsList(params?.page, params?.page_size);
3892
- try {
3893
- return PaginatedArchiveItemListSchema.parse(response);
3894
- } catch (error) {
3895
- consola.consola.error("\u274C Zod Validation Failed");
3896
- consola.consola.box(`getKnowbaseSystemItemsList
3897
- Path: /cfg/knowbase/system/items/
3898
- Method: GET`);
3899
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3900
- consola.consola.error("Validation Issues:");
3901
- error.issues.forEach((issue, index) => {
3902
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3903
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3904
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3905
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3906
- });
3907
- }
3908
- consola.consola.error("Response data:", response);
3909
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3910
- try {
3911
- const event = new CustomEvent("zod-validation-error", {
3912
- detail: {
3913
- operation: "getKnowbaseSystemItemsList",
3914
- path: "/cfg/knowbase/system/items/",
3915
- method: "GET",
3916
- error,
3917
- response,
3918
- timestamp: /* @__PURE__ */ new Date()
3919
- },
3920
- bubbles: true,
3921
- cancelable: false
3922
- });
3923
- window.dispatchEvent(event);
3924
- } catch (eventError) {
3925
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3926
- }
3927
- }
3928
- throw error;
3929
- }
3930
- }
3931
- async function createKnowbaseSystemItemsCreate(data, client) {
3932
- const api = client || getAPIInstance();
3933
- const response = await api.ext_knowbase_knowbase.systemItemsCreate(data);
3934
- try {
3935
- return ArchiveItemSchema.parse(response);
3936
- } catch (error) {
3937
- consola.consola.error("\u274C Zod Validation Failed");
3938
- consola.consola.box(`createKnowbaseSystemItemsCreate
3939
- Path: /cfg/knowbase/system/items/
3940
- Method: POST`);
3941
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3942
- consola.consola.error("Validation Issues:");
3943
- error.issues.forEach((issue, index) => {
3944
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3945
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3946
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3947
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3948
- });
3949
- }
3950
- consola.consola.error("Response data:", response);
3951
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3952
- try {
3953
- const event = new CustomEvent("zod-validation-error", {
3954
- detail: {
3955
- operation: "createKnowbaseSystemItemsCreate",
3956
- path: "/cfg/knowbase/system/items/",
3957
- method: "POST",
3958
- error,
3959
- response,
3960
- timestamp: /* @__PURE__ */ new Date()
3961
- },
3962
- bubbles: true,
3963
- cancelable: false
3964
- });
3965
- window.dispatchEvent(event);
3966
- } catch (eventError) {
3967
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
3968
- }
3969
- }
3970
- throw error;
3971
- }
3972
- }
3973
- async function getKnowbaseSystemItemsRetrieve(id, client) {
3974
- const api = client || getAPIInstance();
3975
- const response = await api.ext_knowbase_knowbase.systemItemsRetrieve(id);
3976
- try {
3977
- return ArchiveItemDetailSchema.parse(response);
3978
- } catch (error) {
3979
- consola.consola.error("\u274C Zod Validation Failed");
3980
- consola.consola.box(`getKnowbaseSystemItemsRetrieve
3981
- Path: /cfg/knowbase/system/items/{id}/
3982
- Method: GET`);
3983
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3984
- consola.consola.error("Validation Issues:");
3985
- error.issues.forEach((issue, index) => {
3986
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3987
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
3988
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
3989
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
3990
- });
3991
- }
3992
- consola.consola.error("Response data:", response);
3993
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3994
- try {
3995
- const event = new CustomEvent("zod-validation-error", {
3996
- detail: {
3997
- operation: "getKnowbaseSystemItemsRetrieve",
3998
- path: "/cfg/knowbase/system/items/{id}/",
3999
- method: "GET",
4000
- error,
4001
- response,
4002
- timestamp: /* @__PURE__ */ new Date()
4003
- },
4004
- bubbles: true,
4005
- cancelable: false
4006
- });
4007
- window.dispatchEvent(event);
4008
- } catch (eventError) {
4009
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
4010
- }
4011
- }
4012
- throw error;
4013
- }
4014
- }
4015
- async function updateKnowbaseSystemItemsUpdate(id, data, client) {
4016
- const api = client || getAPIInstance();
4017
- const response = await api.ext_knowbase_knowbase.systemItemsUpdate(id, data);
4018
- try {
4019
- return ArchiveItemSchema.parse(response);
4020
- } catch (error) {
4021
- consola.consola.error("\u274C Zod Validation Failed");
4022
- consola.consola.box(`updateKnowbaseSystemItemsUpdate
4023
- Path: /cfg/knowbase/system/items/{id}/
4024
- Method: PUT`);
4025
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4026
- consola.consola.error("Validation Issues:");
4027
- error.issues.forEach((issue, index) => {
4028
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4029
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
4030
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
4031
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
4032
- });
4033
- }
4034
- consola.consola.error("Response data:", response);
4035
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4036
- try {
4037
- const event = new CustomEvent("zod-validation-error", {
4038
- detail: {
4039
- operation: "updateKnowbaseSystemItemsUpdate",
4040
- path: "/cfg/knowbase/system/items/{id}/",
4041
- method: "PUT",
4042
- error,
4043
- response,
4044
- timestamp: /* @__PURE__ */ new Date()
4045
- },
4046
- bubbles: true,
4047
- cancelable: false
4048
- });
4049
- window.dispatchEvent(event);
4050
- } catch (eventError) {
4051
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
4052
- }
4053
- }
4054
- throw error;
4055
- }
4056
- }
4057
- async function partialUpdateKnowbaseSystemItemsPartialUpdate(id, data, client) {
4058
- const api = client || getAPIInstance();
4059
- const response = await api.ext_knowbase_knowbase.systemItemsPartialUpdate(id, data);
4060
- try {
4061
- return ArchiveItemSchema.parse(response);
4062
- } catch (error) {
4063
- consola.consola.error("\u274C Zod Validation Failed");
4064
- consola.consola.box(`partialUpdateKnowbaseSystemItemsPartialUpdate
4065
- Path: /cfg/knowbase/system/items/{id}/
4066
- Method: PATCH`);
4067
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4068
- consola.consola.error("Validation Issues:");
4069
- error.issues.forEach((issue, index) => {
4070
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4071
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
4072
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
4073
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
4074
- });
4075
- }
4076
- consola.consola.error("Response data:", response);
4077
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4078
- try {
4079
- const event = new CustomEvent("zod-validation-error", {
4080
- detail: {
4081
- operation: "partialUpdateKnowbaseSystemItemsPartialUpdate",
4082
- path: "/cfg/knowbase/system/items/{id}/",
4083
- method: "PATCH",
4084
- error,
4085
- response,
4086
- timestamp: /* @__PURE__ */ new Date()
4087
- },
4088
- bubbles: true,
4089
- cancelable: false
4090
- });
4091
- window.dispatchEvent(event);
4092
- } catch (eventError) {
4093
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
4094
- }
4095
- }
4096
- throw error;
4097
- }
4098
- }
4099
- async function deleteKnowbaseSystemItemsDestroy(id, client) {
4100
- const api = client || getAPIInstance();
4101
- const response = await api.ext_knowbase_knowbase.systemItemsDestroy(id);
4102
- return response;
4103
- }
4104
- async function getKnowbaseSystemItemsChunksList(id, params, client) {
4105
- const api = client || getAPIInstance();
4106
- const response = await api.ext_knowbase_knowbase.systemItemsChunksList(id, params?.page, params?.page_size);
4107
- try {
4108
- return PaginatedArchiveItemChunkListSchema.parse(response);
4109
- } catch (error) {
4110
- consola.consola.error("\u274C Zod Validation Failed");
4111
- consola.consola.box(`getKnowbaseSystemItemsChunksList
4112
- Path: /cfg/knowbase/system/items/{id}/chunks/
4113
- Method: GET`);
4114
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4115
- consola.consola.error("Validation Issues:");
4116
- error.issues.forEach((issue, index) => {
4117
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4118
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
4119
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
4120
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
4121
- });
4122
- }
4123
- consola.consola.error("Response data:", response);
4124
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4125
- try {
4126
- const event = new CustomEvent("zod-validation-error", {
4127
- detail: {
4128
- operation: "getKnowbaseSystemItemsChunksList",
4129
- path: "/cfg/knowbase/system/items/{id}/chunks/",
4130
- method: "GET",
4131
- error,
4132
- response,
4133
- timestamp: /* @__PURE__ */ new Date()
4134
- },
4135
- bubbles: true,
4136
- cancelable: false
4137
- });
4138
- window.dispatchEvent(event);
4139
- } catch (eventError) {
4140
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
4141
- }
4142
- }
4143
- throw error;
4144
- }
4145
- }
4146
- async function getKnowbaseSystemItemsContentRetrieve(id, client) {
4147
- const api = client || getAPIInstance();
4148
- const response = await api.ext_knowbase_knowbase.systemItemsContentRetrieve(id);
4149
- try {
4150
- return ArchiveItemDetailSchema.parse(response);
4151
- } catch (error) {
4152
- consola.consola.error("\u274C Zod Validation Failed");
4153
- consola.consola.box(`getKnowbaseSystemItemsContentRetrieve
4154
- Path: /cfg/knowbase/system/items/{id}/content/
4155
- Method: GET`);
4156
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4157
- consola.consola.error("Validation Issues:");
4158
- error.issues.forEach((issue, index) => {
4159
- consola.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4160
- consola.consola.error(` \u251C\u2500 Message: ${issue.message}`);
4161
- if (issue.expected) consola.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
4162
- if (issue.received) consola.consola.error(` \u2514\u2500 Received: ${issue.received}`);
4163
- });
4164
- }
4165
- consola.consola.error("Response data:", response);
4166
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4167
- try {
4168
- const event = new CustomEvent("zod-validation-error", {
4169
- detail: {
4170
- operation: "getKnowbaseSystemItemsContentRetrieve",
4171
- path: "/cfg/knowbase/system/items/{id}/content/",
4172
- method: "GET",
4173
- error,
4174
- response,
4175
- timestamp: /* @__PURE__ */ new Date()
4176
- },
4177
- bubbles: true,
4178
- cancelable: false
4179
- });
4180
- window.dispatchEvent(event);
4181
- } catch (eventError) {
4182
- consola.consola.warn("Failed to dispatch validation error event:", eventError);
4183
- }
4184
- }
4185
- throw error;
4186
- }
4187
- }
4188
-
4189
- // src/api/generated/ext_knowbase/index.ts
4190
- var TOKEN_KEY = "auth_token";
4191
- var REFRESH_TOKEN_KEY = "refresh_token";
4192
- var API = class {
4193
- baseUrl;
4194
- _client;
4195
- _token = null;
4196
- _refreshToken = null;
4197
- storage;
4198
- options;
4199
- // Sub-clients
4200
- ext_knowbase_knowbase;
4201
- constructor(baseUrl, options) {
4202
- this.baseUrl = baseUrl;
4203
- this.options = options;
4204
- const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
4205
- this.storage = options?.storage || new LocalStorageAdapter(logger);
4206
- this._loadTokensFromStorage();
4207
- this._client = new APIClient(this.baseUrl, {
4208
- retryConfig: this.options?.retryConfig,
4209
- loggerConfig: this.options?.loggerConfig
4210
- });
4211
- this._injectAuthHeader();
4212
- this.ext_knowbase_knowbase = this._client.ext_knowbase_knowbase;
4213
- }
4214
- _loadTokensFromStorage() {
4215
- this._token = this.storage.getItem(TOKEN_KEY);
4216
- this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);
4217
- }
4218
- _reinitClients() {
4219
- this._client = new APIClient(this.baseUrl, {
4220
- retryConfig: this.options?.retryConfig,
4221
- loggerConfig: this.options?.loggerConfig
4222
- });
4223
- this._injectAuthHeader();
4224
- this.ext_knowbase_knowbase = this._client.ext_knowbase_knowbase;
4225
- }
4226
- _injectAuthHeader() {
4227
- const originalRequest = this._client.request.bind(this._client);
4228
- this._client.request = async (method, path, options) => {
4229
- const token = this.getToken();
4230
- const mergedOptions = {
4231
- ...options,
4232
- headers: {
4233
- ...options?.headers || {},
4234
- ...token ? { "Authorization": `Bearer ${token}` } : {}
4235
- }
4236
- };
4237
- return originalRequest(method, path, mergedOptions);
4238
- };
4239
- }
4240
- /**
4241
- * Get current JWT token
4242
- */
4243
- getToken() {
4244
- return this.storage.getItem(TOKEN_KEY);
4245
- }
4246
- /**
4247
- * Get current refresh token
4248
- */
4249
- getRefreshToken() {
4250
- return this.storage.getItem(REFRESH_TOKEN_KEY);
4251
- }
4252
- /**
4253
- * Set JWT token and refresh token
4254
- * @param token - JWT access token
4255
- * @param refreshToken - JWT refresh token (optional)
4256
- */
4257
- setToken(token, refreshToken) {
4258
- this._token = token;
4259
- this.storage.setItem(TOKEN_KEY, token);
4260
- if (refreshToken) {
4261
- this._refreshToken = refreshToken;
4262
- this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);
4263
- }
4264
- this._reinitClients();
4265
- }
4266
- /**
4267
- * Clear all tokens
4268
- */
4269
- clearTokens() {
4270
- this._token = null;
4271
- this._refreshToken = null;
4272
- this.storage.removeItem(TOKEN_KEY);
4273
- this.storage.removeItem(REFRESH_TOKEN_KEY);
4274
- this._reinitClients();
4275
- }
4276
- /**
4277
- * Check if user is authenticated
4278
- */
4279
- isAuthenticated() {
4280
- return !!this.getToken();
4281
- }
4282
- /**
4283
- * Update base URL and reinitialize clients
4284
- * @param url - New base URL
4285
- */
4286
- setBaseUrl(url) {
4287
- this.baseUrl = url;
4288
- this._reinitClients();
4289
- }
4290
- /**
4291
- * Get current base URL
4292
- */
4293
- getBaseUrl() {
4294
- return this.baseUrl;
4295
- }
4296
- /**
4297
- * Get OpenAPI schema path
4298
- * @returns Path to the OpenAPI schema JSON file
4299
- *
4300
- * Note: The OpenAPI schema is available in the schema.json file.
4301
- * You can load it dynamically using:
4302
- * ```typescript
4303
- * const schema = await fetch('./schema.json').then(r => r.json());
4304
- * // or using fs in Node.js:
4305
- * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
4306
- * ```
4307
- */
4308
- getSchemaPath() {
4309
- return "./schema.json";
4310
- }
4311
- };
4312
- var apiKnowbase = api.createExtensionAPI(API);
4313
-
4314
- exports.API = API;
4315
- exports.APIClient = APIClient;
4316
- exports.APIError = APIError;
4317
- exports.APILogger = APILogger;
4318
- exports.ArchiveItemChunkDetailSchema = ArchiveItemChunkDetailSchema;
4319
- exports.ArchiveItemChunkRequestSchema = ArchiveItemChunkRequestSchema;
4320
- exports.ArchiveItemChunkSchema = ArchiveItemChunkSchema;
4321
- exports.ArchiveItemDetailSchema = ArchiveItemDetailSchema;
4322
- exports.ArchiveItemRequestSchema = ArchiveItemRequestSchema;
4323
- exports.ArchiveItemSchema = ArchiveItemSchema;
4324
- exports.ArchiveProcessingResultSchema = ArchiveProcessingResultSchema;
4325
- exports.ArchiveSearchRequestRequestSchema = ArchiveSearchRequestRequestSchema;
4326
- exports.ArchiveSearchResultSchema = ArchiveSearchResultSchema;
4327
- exports.ArchiveStatisticsSchema = ArchiveStatisticsSchema;
4328
- exports.ChatHistorySchema = ChatHistorySchema;
4329
- exports.ChatMessageSchema = ChatMessageSchema;
4330
- exports.ChatQueryRequestSchema = ChatQueryRequestSchema;
4331
- exports.ChatResponseRequestSchema = ChatResponseRequestSchema;
4332
- exports.ChatResponseSchema = ChatResponseSchema;
4333
- exports.ChatSessionCreateRequestSchema = ChatSessionCreateRequestSchema;
4334
- exports.ChatSessionRequestSchema = ChatSessionRequestSchema;
4335
- exports.ChatSessionSchema = ChatSessionSchema;
4336
- exports.ChatSourceRequestSchema = ChatSourceRequestSchema;
4337
- exports.ChatSourceSchema = ChatSourceSchema;
4338
- exports.ChunkRevectorizationRequestRequestSchema = ChunkRevectorizationRequestRequestSchema;
4339
- exports.CookieStorageAdapter = CookieStorageAdapter;
4340
- exports.DEFAULT_RETRY_CONFIG = DEFAULT_RETRY_CONFIG;
4341
- exports.DocumentArchiveDetailSchema = DocumentArchiveDetailSchema;
4342
- exports.DocumentArchiveListSchema = DocumentArchiveListSchema;
4343
- exports.DocumentArchiveRequestSchema = DocumentArchiveRequestSchema;
4344
- exports.DocumentArchiveSchema = DocumentArchiveSchema;
4345
- exports.DocumentCategoryRequestSchema = DocumentCategoryRequestSchema;
4346
- exports.DocumentCategorySchema = DocumentCategorySchema;
4347
- exports.DocumentCreateRequestSchema = DocumentCreateRequestSchema;
4348
- exports.DocumentProcessingStatusSchema = DocumentProcessingStatusSchema;
4349
- exports.DocumentRequestSchema = DocumentRequestSchema;
4350
- exports.DocumentSchema = DocumentSchema;
4351
- exports.DocumentStatsSchema = DocumentStatsSchema;
4352
- exports.Enums = enums_exports;
4353
- exports.ExtKnowbaseKnowbaseTypes = models_exports;
4354
- exports.FetchAdapter = FetchAdapter;
4355
- exports.Fetchers = fetchers_exports;
4356
- exports.LocalStorageAdapter = LocalStorageAdapter;
4357
- exports.MemoryStorageAdapter = MemoryStorageAdapter;
4358
- exports.NetworkError = NetworkError;
4359
- exports.PaginatedArchiveItemChunkListSchema = PaginatedArchiveItemChunkListSchema;
4360
- exports.PaginatedArchiveItemListSchema = PaginatedArchiveItemListSchema;
4361
- exports.PaginatedArchiveSearchResultListSchema = PaginatedArchiveSearchResultListSchema;
4362
- exports.PaginatedChatResponseListSchema = PaginatedChatResponseListSchema;
4363
- exports.PaginatedChatSessionListSchema = PaginatedChatSessionListSchema;
4364
- exports.PaginatedDocumentArchiveListListSchema = PaginatedDocumentArchiveListListSchema;
4365
- exports.PaginatedDocumentListSchema = PaginatedDocumentListSchema;
4366
- exports.PaginatedPublicCategoryListSchema = PaginatedPublicCategoryListSchema;
4367
- exports.PaginatedPublicDocumentListListSchema = PaginatedPublicDocumentListListSchema;
4368
- exports.PatchedArchiveItemChunkRequestSchema = PatchedArchiveItemChunkRequestSchema;
4369
- exports.PatchedArchiveItemRequestSchema = PatchedArchiveItemRequestSchema;
4370
- exports.PatchedChatResponseRequestSchema = PatchedChatResponseRequestSchema;
4371
- exports.PatchedChatSessionRequestSchema = PatchedChatSessionRequestSchema;
4372
- exports.PatchedDocumentArchiveRequestSchema = PatchedDocumentArchiveRequestSchema;
4373
- exports.PatchedDocumentRequestSchema = PatchedDocumentRequestSchema;
4374
- exports.PublicCategorySchema = PublicCategorySchema;
4375
- exports.PublicDocumentListSchema = PublicDocumentListSchema;
4376
- exports.PublicDocumentSchema = PublicDocumentSchema;
4377
- exports.REFRESH_TOKEN_KEY = REFRESH_TOKEN_KEY;
4378
- exports.Schemas = schemas_exports;
4379
- exports.TOKEN_KEY = TOKEN_KEY;
4380
- exports.VectorizationResultSchema = VectorizationResultSchema;
4381
- exports.VectorizationStatisticsSchema = VectorizationStatisticsSchema;
4382
- exports.apiKnowbase = apiKnowbase;
4383
- exports.clearAPITokens = clearAPITokens;
4384
- exports.configureAPI = configureAPI;
4385
- exports.createKnowbaseAdminChatCreate = createKnowbaseAdminChatCreate;
4386
- exports.createKnowbaseAdminChatQueryCreate = createKnowbaseAdminChatQueryCreate;
4387
- exports.createKnowbaseAdminDocumentsCreate = createKnowbaseAdminDocumentsCreate;
4388
- exports.createKnowbaseAdminDocumentsReprocessCreate = createKnowbaseAdminDocumentsReprocessCreate;
4389
- exports.createKnowbaseAdminSessionsActivateCreate = createKnowbaseAdminSessionsActivateCreate;
4390
- exports.createKnowbaseAdminSessionsArchiveCreate = createKnowbaseAdminSessionsArchiveCreate;
4391
- exports.createKnowbaseAdminSessionsCreate = createKnowbaseAdminSessionsCreate;
4392
- exports.createKnowbaseSystemArchivesCreate = createKnowbaseSystemArchivesCreate;
4393
- exports.createKnowbaseSystemArchivesRevectorizeCreate = createKnowbaseSystemArchivesRevectorizeCreate;
4394
- exports.createKnowbaseSystemArchivesSearchCreate = createKnowbaseSystemArchivesSearchCreate;
4395
- exports.createKnowbaseSystemChunksCreate = createKnowbaseSystemChunksCreate;
4396
- exports.createKnowbaseSystemChunksVectorizeCreate = createKnowbaseSystemChunksVectorizeCreate;
4397
- exports.createKnowbaseSystemItemsCreate = createKnowbaseSystemItemsCreate;
4398
- exports.deleteKnowbaseAdminChatDestroy = deleteKnowbaseAdminChatDestroy;
4399
- exports.deleteKnowbaseAdminDocumentsDestroy = deleteKnowbaseAdminDocumentsDestroy;
4400
- exports.deleteKnowbaseAdminSessionsDestroy = deleteKnowbaseAdminSessionsDestroy;
4401
- exports.deleteKnowbaseSystemArchivesDestroy = deleteKnowbaseSystemArchivesDestroy;
4402
- exports.deleteKnowbaseSystemChunksDestroy = deleteKnowbaseSystemChunksDestroy;
4403
- exports.deleteKnowbaseSystemItemsDestroy = deleteKnowbaseSystemItemsDestroy;
4404
- exports.dispatchValidationError = dispatchValidationError;
4405
- exports.formatZodError = formatZodError;
4406
- exports.getAPIInstance = getAPIInstance;
4407
- exports.getKnowbaseAdminChatHistoryRetrieve = getKnowbaseAdminChatHistoryRetrieve;
4408
- exports.getKnowbaseAdminChatList = getKnowbaseAdminChatList;
4409
- exports.getKnowbaseAdminChatRetrieve = getKnowbaseAdminChatRetrieve;
4410
- exports.getKnowbaseAdminDocumentsList = getKnowbaseAdminDocumentsList;
4411
- exports.getKnowbaseAdminDocumentsRetrieve = getKnowbaseAdminDocumentsRetrieve;
4412
- exports.getKnowbaseAdminDocumentsStatsRetrieve = getKnowbaseAdminDocumentsStatsRetrieve;
4413
- exports.getKnowbaseAdminDocumentsStatusRetrieve = getKnowbaseAdminDocumentsStatusRetrieve;
4414
- exports.getKnowbaseAdminSessionsList = getKnowbaseAdminSessionsList;
4415
- exports.getKnowbaseAdminSessionsRetrieve = getKnowbaseAdminSessionsRetrieve;
4416
- exports.getKnowbaseCategoriesList = getKnowbaseCategoriesList;
4417
- exports.getKnowbaseCategoriesRetrieve = getKnowbaseCategoriesRetrieve;
4418
- exports.getKnowbaseDocumentsList = getKnowbaseDocumentsList;
4419
- exports.getKnowbaseDocumentsRetrieve = getKnowbaseDocumentsRetrieve;
4420
- exports.getKnowbaseSystemArchivesFileTreeRetrieve = getKnowbaseSystemArchivesFileTreeRetrieve;
4421
- exports.getKnowbaseSystemArchivesItemsList = getKnowbaseSystemArchivesItemsList;
4422
- exports.getKnowbaseSystemArchivesList = getKnowbaseSystemArchivesList;
4423
- exports.getKnowbaseSystemArchivesRetrieve = getKnowbaseSystemArchivesRetrieve;
4424
- exports.getKnowbaseSystemArchivesStatisticsRetrieve = getKnowbaseSystemArchivesStatisticsRetrieve;
4425
- exports.getKnowbaseSystemArchivesVectorizationStatsRetrieve = getKnowbaseSystemArchivesVectorizationStatsRetrieve;
4426
- exports.getKnowbaseSystemChunksContextRetrieve = getKnowbaseSystemChunksContextRetrieve;
4427
- exports.getKnowbaseSystemChunksList = getKnowbaseSystemChunksList;
4428
- exports.getKnowbaseSystemChunksRetrieve = getKnowbaseSystemChunksRetrieve;
4429
- exports.getKnowbaseSystemItemsChunksList = getKnowbaseSystemItemsChunksList;
4430
- exports.getKnowbaseSystemItemsContentRetrieve = getKnowbaseSystemItemsContentRetrieve;
4431
- exports.getKnowbaseSystemItemsList = getKnowbaseSystemItemsList;
4432
- exports.getKnowbaseSystemItemsRetrieve = getKnowbaseSystemItemsRetrieve;
4433
- exports.isAPIConfigured = isAPIConfigured;
4434
- exports.onValidationError = onValidationError;
4435
- exports.partialUpdateKnowbaseAdminChatPartialUpdate = partialUpdateKnowbaseAdminChatPartialUpdate;
4436
- exports.partialUpdateKnowbaseAdminDocumentsPartialUpdate = partialUpdateKnowbaseAdminDocumentsPartialUpdate;
4437
- exports.partialUpdateKnowbaseAdminSessionsPartialUpdate = partialUpdateKnowbaseAdminSessionsPartialUpdate;
4438
- exports.partialUpdateKnowbaseSystemArchivesPartialUpdate = partialUpdateKnowbaseSystemArchivesPartialUpdate;
4439
- exports.partialUpdateKnowbaseSystemChunksPartialUpdate = partialUpdateKnowbaseSystemChunksPartialUpdate;
4440
- exports.partialUpdateKnowbaseSystemItemsPartialUpdate = partialUpdateKnowbaseSystemItemsPartialUpdate;
4441
- exports.reconfigureAPI = reconfigureAPI;
4442
- exports.resetAPI = resetAPI;
4443
- exports.shouldRetry = shouldRetry;
4444
- exports.updateKnowbaseAdminChatUpdate = updateKnowbaseAdminChatUpdate;
4445
- exports.updateKnowbaseAdminDocumentsUpdate = updateKnowbaseAdminDocumentsUpdate;
4446
- exports.updateKnowbaseAdminSessionsUpdate = updateKnowbaseAdminSessionsUpdate;
4447
- exports.updateKnowbaseSystemArchivesUpdate = updateKnowbaseSystemArchivesUpdate;
4448
- exports.updateKnowbaseSystemChunksUpdate = updateKnowbaseSystemChunksUpdate;
4449
- exports.updateKnowbaseSystemItemsUpdate = updateKnowbaseSystemItemsUpdate;
4450
- exports.withRetry = withRetry;