@djangocfg/ext-knowbase 1.0.0

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