@djangocfg/ext-knowbase 1.0.1 → 1.0.3

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