chatifai 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +69 -27
- package/dist/index.js +23 -9
- package/dist/types.d.ts +126 -57
- package/dist/types.js +44 -16
- package/index.ts +23 -9
- package/package.json +1 -1
- package/types.ts +45 -16
package/dist/index.d.ts
CHANGED
|
@@ -229,9 +229,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
229
229
|
created_at?: number | null | undefined;
|
|
230
230
|
updated_at?: number | null | undefined;
|
|
231
231
|
organization_id?: string | null | undefined;
|
|
232
|
-
|
|
233
|
-
description?: string | null | undefined;
|
|
232
|
+
ai_description?: string | null | undefined;
|
|
234
233
|
note?: string | null | undefined;
|
|
234
|
+
file_id?: string | null | undefined;
|
|
235
235
|
file_url?: string | null | undefined;
|
|
236
236
|
file_gcs_url?: string | null | undefined;
|
|
237
237
|
file_name?: string | null | undefined;
|
|
@@ -254,9 +254,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
254
254
|
created_at?: number | null | undefined;
|
|
255
255
|
updated_at?: number | null | undefined;
|
|
256
256
|
organization_id?: string | null | undefined;
|
|
257
|
-
|
|
258
|
-
description?: string | null | undefined;
|
|
257
|
+
ai_description?: string | null | undefined;
|
|
259
258
|
note?: string | null | undefined;
|
|
259
|
+
file_id?: string | null | undefined;
|
|
260
260
|
file_url?: string | null | undefined;
|
|
261
261
|
file_gcs_url?: string | null | undefined;
|
|
262
262
|
file_name?: string | null | undefined;
|
|
@@ -279,9 +279,9 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
279
279
|
created_at?: number | null | undefined;
|
|
280
280
|
updated_at?: number | null | undefined;
|
|
281
281
|
organization_id?: string | null | undefined;
|
|
282
|
-
|
|
283
|
-
description?: string | null | undefined;
|
|
282
|
+
ai_description?: string | null | undefined;
|
|
284
283
|
note?: string | null | undefined;
|
|
284
|
+
file_id?: string | null | undefined;
|
|
285
285
|
file_url?: string | null | undefined;
|
|
286
286
|
file_gcs_url?: string | null | undefined;
|
|
287
287
|
file_name?: string | null | undefined;
|
|
@@ -312,43 +312,85 @@ export declare const ChunkSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
312
312
|
createdAt: NativeDate;
|
|
313
313
|
updatedAt: NativeDate;
|
|
314
314
|
} & {
|
|
315
|
-
|
|
315
|
+
type: string;
|
|
316
|
+
organization_id: string;
|
|
317
|
+
context_id: string;
|
|
318
|
+
text: string;
|
|
319
|
+
page_start: number;
|
|
320
|
+
page_end: number;
|
|
321
|
+
hierarchy: string[];
|
|
322
|
+
characters_length: number;
|
|
323
|
+
words_length: number;
|
|
324
|
+
embeddings: number[];
|
|
316
325
|
created_at?: number | null | undefined;
|
|
326
|
+
updated_at?: number | null | undefined;
|
|
327
|
+
chunk_id?: string | null | undefined;
|
|
328
|
+
embeddings_meta_data?: {
|
|
329
|
+
model: string;
|
|
330
|
+
dimensions: number;
|
|
331
|
+
text_length: number;
|
|
332
|
+
processing_time: number;
|
|
333
|
+
} | null | undefined;
|
|
317
334
|
metadata?: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
chunk_index: number;
|
|
322
|
-
text_preview: string;
|
|
323
|
-
page_number?: number | null | undefined;
|
|
335
|
+
block_id: string;
|
|
336
|
+
level: number;
|
|
337
|
+
has_children: boolean;
|
|
324
338
|
} | null | undefined;
|
|
325
339
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
326
340
|
createdAt: NativeDate;
|
|
327
341
|
updatedAt: NativeDate;
|
|
328
342
|
} & {
|
|
329
|
-
|
|
343
|
+
type: string;
|
|
344
|
+
organization_id: string;
|
|
345
|
+
context_id: string;
|
|
346
|
+
text: string;
|
|
347
|
+
page_start: number;
|
|
348
|
+
page_end: number;
|
|
349
|
+
hierarchy: string[];
|
|
350
|
+
characters_length: number;
|
|
351
|
+
words_length: number;
|
|
352
|
+
embeddings: number[];
|
|
330
353
|
created_at?: number | null | undefined;
|
|
354
|
+
updated_at?: number | null | undefined;
|
|
355
|
+
chunk_id?: string | null | undefined;
|
|
356
|
+
embeddings_meta_data?: {
|
|
357
|
+
model: string;
|
|
358
|
+
dimensions: number;
|
|
359
|
+
text_length: number;
|
|
360
|
+
processing_time: number;
|
|
361
|
+
} | null | undefined;
|
|
331
362
|
metadata?: {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
chunk_index: number;
|
|
336
|
-
text_preview: string;
|
|
337
|
-
page_number?: number | null | undefined;
|
|
363
|
+
block_id: string;
|
|
364
|
+
level: number;
|
|
365
|
+
has_children: boolean;
|
|
338
366
|
} | null | undefined;
|
|
339
367
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
340
368
|
createdAt: NativeDate;
|
|
341
369
|
updatedAt: NativeDate;
|
|
342
370
|
} & {
|
|
343
|
-
|
|
371
|
+
type: string;
|
|
372
|
+
organization_id: string;
|
|
373
|
+
context_id: string;
|
|
374
|
+
text: string;
|
|
375
|
+
page_start: number;
|
|
376
|
+
page_end: number;
|
|
377
|
+
hierarchy: string[];
|
|
378
|
+
characters_length: number;
|
|
379
|
+
words_length: number;
|
|
380
|
+
embeddings: number[];
|
|
344
381
|
created_at?: number | null | undefined;
|
|
382
|
+
updated_at?: number | null | undefined;
|
|
383
|
+
chunk_id?: string | null | undefined;
|
|
384
|
+
embeddings_meta_data?: {
|
|
385
|
+
model: string;
|
|
386
|
+
dimensions: number;
|
|
387
|
+
text_length: number;
|
|
388
|
+
processing_time: number;
|
|
389
|
+
} | null | undefined;
|
|
345
390
|
metadata?: {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
chunk_index: number;
|
|
350
|
-
text_preview: string;
|
|
351
|
-
page_number?: number | null | undefined;
|
|
391
|
+
block_id: string;
|
|
392
|
+
level: number;
|
|
393
|
+
has_children: boolean;
|
|
352
394
|
} | null | undefined;
|
|
353
395
|
}> & {
|
|
354
396
|
_id: import("mongoose").Types.ObjectId;
|
package/dist/index.js
CHANGED
|
@@ -82,10 +82,10 @@ exports.AgentSchema = new mongoose_1.Schema({
|
|
|
82
82
|
});
|
|
83
83
|
exports.ContextSchema = new mongoose_1.Schema({
|
|
84
84
|
organization_id: { type: String },
|
|
85
|
-
file_id: { type: String },
|
|
86
85
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
87
|
-
|
|
86
|
+
ai_description: { type: String, minlength: 1, maxlength: 500 },
|
|
88
87
|
note: { type: String, maxlength: 500 },
|
|
88
|
+
file_id: { type: String },
|
|
89
89
|
file_url: { type: String },
|
|
90
90
|
file_gcs_url: { type: String },
|
|
91
91
|
file_name: { type: String },
|
|
@@ -111,16 +111,30 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
111
111
|
// encryptionType: 'csfle',
|
|
112
112
|
});
|
|
113
113
|
exports.ChunkSchema = new mongoose_1.Schema({
|
|
114
|
-
|
|
114
|
+
chunk_id: { type: String },
|
|
115
|
+
organization_id: { type: String, required: true },
|
|
116
|
+
context_id: { type: String, required: true },
|
|
117
|
+
text: { type: String, required: true },
|
|
118
|
+
type: { type: String, required: true },
|
|
119
|
+
page_start: { type: Number, required: true },
|
|
120
|
+
page_end: { type: Number, required: true },
|
|
121
|
+
hierarchy: { type: [String], required: true },
|
|
122
|
+
characters_length: { type: Number, required: true },
|
|
123
|
+
words_length: { type: Number, required: true },
|
|
124
|
+
embeddings: { type: [Number], required: true },
|
|
125
|
+
embeddings_meta_data: {
|
|
126
|
+
model: { type: String, required: true },
|
|
127
|
+
dimensions: { type: Number, required: true },
|
|
128
|
+
text_length: { type: Number, required: true },
|
|
129
|
+
processing_time: { type: Number, required: true },
|
|
130
|
+
},
|
|
115
131
|
metadata: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
page_number: { type: Number },
|
|
120
|
-
chunk_index: { type: Number, required: true },
|
|
121
|
-
text_preview: { type: String, required: true },
|
|
132
|
+
block_id: { type: String, required: true },
|
|
133
|
+
level: { type: Number, required: true },
|
|
134
|
+
has_children: { type: Boolean, required: true },
|
|
122
135
|
},
|
|
123
136
|
created_at: { type: Number },
|
|
137
|
+
updated_at: { type: Number },
|
|
124
138
|
}, {
|
|
125
139
|
versionKey: false,
|
|
126
140
|
toJSON: { virtuals: true },
|
package/dist/types.d.ts
CHANGED
|
@@ -84,10 +84,10 @@ export declare const zodUserSchema: z.ZodObject<{
|
|
|
84
84
|
export declare const zodContextSchema: z.ZodObject<{
|
|
85
85
|
_id: z.ZodOptional<z.ZodString>;
|
|
86
86
|
organization_id: z.ZodOptional<z.ZodString>;
|
|
87
|
-
file_id: z.ZodOptional<z.ZodString>;
|
|
88
87
|
title: z.ZodString;
|
|
89
|
-
|
|
88
|
+
ai_description: z.ZodOptional<z.ZodString>;
|
|
90
89
|
note: z.ZodOptional<z.ZodString>;
|
|
90
|
+
file_id: z.ZodOptional<z.ZodString>;
|
|
91
91
|
file_url: z.ZodOptional<z.ZodString>;
|
|
92
92
|
file_gcs_url: z.ZodOptional<z.ZodString>;
|
|
93
93
|
file_name: z.ZodOptional<z.ZodString>;
|
|
@@ -119,9 +119,9 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
119
119
|
created_at?: number | undefined;
|
|
120
120
|
updated_at?: number | undefined;
|
|
121
121
|
organization_id?: string | undefined;
|
|
122
|
-
|
|
123
|
-
description?: string | undefined;
|
|
122
|
+
ai_description?: string | undefined;
|
|
124
123
|
note?: string | undefined;
|
|
124
|
+
file_id?: string | undefined;
|
|
125
125
|
file_url?: string | undefined;
|
|
126
126
|
file_gcs_url?: string | undefined;
|
|
127
127
|
file_name?: string | undefined;
|
|
@@ -142,9 +142,9 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
142
142
|
created_at?: number | undefined;
|
|
143
143
|
updated_at?: number | undefined;
|
|
144
144
|
organization_id?: string | undefined;
|
|
145
|
-
|
|
146
|
-
description?: string | undefined;
|
|
145
|
+
ai_description?: string | undefined;
|
|
147
146
|
note?: string | undefined;
|
|
147
|
+
file_id?: string | undefined;
|
|
148
148
|
file_url?: string | undefined;
|
|
149
149
|
file_gcs_url?: string | undefined;
|
|
150
150
|
file_name?: string | undefined;
|
|
@@ -159,57 +159,6 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
159
159
|
bucket_name?: string | undefined;
|
|
160
160
|
processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
161
161
|
}>;
|
|
162
|
-
export declare const zodChunkSchema: z.ZodObject<{
|
|
163
|
-
_id: z.ZodOptional<z.ZodString>;
|
|
164
|
-
embedding: z.ZodArray<z.ZodNumber, "many">;
|
|
165
|
-
metadata: z.ZodObject<{
|
|
166
|
-
organization_id: z.ZodString;
|
|
167
|
-
context_id: z.ZodString;
|
|
168
|
-
file_id: z.ZodString;
|
|
169
|
-
page_number: z.ZodOptional<z.ZodNumber>;
|
|
170
|
-
chunk_index: z.ZodNumber;
|
|
171
|
-
text_preview: z.ZodString;
|
|
172
|
-
}, "strip", z.ZodTypeAny, {
|
|
173
|
-
organization_id: string;
|
|
174
|
-
file_id: string;
|
|
175
|
-
context_id: string;
|
|
176
|
-
chunk_index: number;
|
|
177
|
-
text_preview: string;
|
|
178
|
-
page_number?: number | undefined;
|
|
179
|
-
}, {
|
|
180
|
-
organization_id: string;
|
|
181
|
-
file_id: string;
|
|
182
|
-
context_id: string;
|
|
183
|
-
chunk_index: number;
|
|
184
|
-
text_preview: string;
|
|
185
|
-
page_number?: number | undefined;
|
|
186
|
-
}>;
|
|
187
|
-
created_at: z.ZodOptional<z.ZodNumber>;
|
|
188
|
-
}, "strip", z.ZodTypeAny, {
|
|
189
|
-
embedding: number[];
|
|
190
|
-
metadata: {
|
|
191
|
-
organization_id: string;
|
|
192
|
-
file_id: string;
|
|
193
|
-
context_id: string;
|
|
194
|
-
chunk_index: number;
|
|
195
|
-
text_preview: string;
|
|
196
|
-
page_number?: number | undefined;
|
|
197
|
-
};
|
|
198
|
-
_id?: string | undefined;
|
|
199
|
-
created_at?: number | undefined;
|
|
200
|
-
}, {
|
|
201
|
-
embedding: number[];
|
|
202
|
-
metadata: {
|
|
203
|
-
organization_id: string;
|
|
204
|
-
file_id: string;
|
|
205
|
-
context_id: string;
|
|
206
|
-
chunk_index: number;
|
|
207
|
-
text_preview: string;
|
|
208
|
-
page_number?: number | undefined;
|
|
209
|
-
};
|
|
210
|
-
_id?: string | undefined;
|
|
211
|
-
created_at?: number | undefined;
|
|
212
|
-
}>;
|
|
213
162
|
export declare const zodAgentSchema: z.ZodObject<{
|
|
214
163
|
_id: z.ZodOptional<z.ZodString>;
|
|
215
164
|
organization_id: z.ZodOptional<z.ZodString>;
|
|
@@ -284,6 +233,119 @@ export declare const zodQuerySchema: z.ZodObject<{
|
|
|
284
233
|
context_ids?: string[] | undefined;
|
|
285
234
|
users_ids?: string[] | undefined;
|
|
286
235
|
}>;
|
|
236
|
+
export declare const zodChunkSchema: z.ZodObject<{
|
|
237
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
238
|
+
chunk_id: z.ZodOptional<z.ZodString>;
|
|
239
|
+
organization_id: z.ZodString;
|
|
240
|
+
context_id: z.ZodString;
|
|
241
|
+
text: z.ZodString;
|
|
242
|
+
type: z.ZodString;
|
|
243
|
+
page_start: z.ZodNumber;
|
|
244
|
+
page_end: z.ZodNumber;
|
|
245
|
+
hierarchy: z.ZodArray<z.ZodString, "many">;
|
|
246
|
+
characters_length: z.ZodNumber;
|
|
247
|
+
words_length: z.ZodNumber;
|
|
248
|
+
embeddings: z.ZodArray<z.ZodNumber, "many">;
|
|
249
|
+
embeddings_meta_data: z.ZodObject<{
|
|
250
|
+
model: z.ZodString;
|
|
251
|
+
dimensions: z.ZodNumber;
|
|
252
|
+
text_length: z.ZodNumber;
|
|
253
|
+
processing_time: z.ZodNumber;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
model: string;
|
|
256
|
+
dimensions: number;
|
|
257
|
+
text_length: number;
|
|
258
|
+
processing_time: number;
|
|
259
|
+
}, {
|
|
260
|
+
model: string;
|
|
261
|
+
dimensions: number;
|
|
262
|
+
text_length: number;
|
|
263
|
+
processing_time: number;
|
|
264
|
+
}>;
|
|
265
|
+
metadata: z.ZodObject<{
|
|
266
|
+
block_id: z.ZodString;
|
|
267
|
+
level: z.ZodNumber;
|
|
268
|
+
has_children: z.ZodBoolean;
|
|
269
|
+
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
block_id: string;
|
|
271
|
+
level: number;
|
|
272
|
+
has_children: boolean;
|
|
273
|
+
}, {
|
|
274
|
+
block_id: string;
|
|
275
|
+
level: number;
|
|
276
|
+
has_children: boolean;
|
|
277
|
+
}>;
|
|
278
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
type: string;
|
|
282
|
+
organization_id: string;
|
|
283
|
+
context_id: string;
|
|
284
|
+
text: string;
|
|
285
|
+
page_start: number;
|
|
286
|
+
page_end: number;
|
|
287
|
+
hierarchy: string[];
|
|
288
|
+
characters_length: number;
|
|
289
|
+
words_length: number;
|
|
290
|
+
embeddings: number[];
|
|
291
|
+
embeddings_meta_data: {
|
|
292
|
+
model: string;
|
|
293
|
+
dimensions: number;
|
|
294
|
+
text_length: number;
|
|
295
|
+
processing_time: number;
|
|
296
|
+
};
|
|
297
|
+
metadata: {
|
|
298
|
+
block_id: string;
|
|
299
|
+
level: number;
|
|
300
|
+
has_children: boolean;
|
|
301
|
+
};
|
|
302
|
+
_id?: string | undefined;
|
|
303
|
+
created_at?: number | undefined;
|
|
304
|
+
updated_at?: number | undefined;
|
|
305
|
+
chunk_id?: string | undefined;
|
|
306
|
+
}, {
|
|
307
|
+
type: string;
|
|
308
|
+
organization_id: string;
|
|
309
|
+
context_id: string;
|
|
310
|
+
text: string;
|
|
311
|
+
page_start: number;
|
|
312
|
+
page_end: number;
|
|
313
|
+
hierarchy: string[];
|
|
314
|
+
characters_length: number;
|
|
315
|
+
words_length: number;
|
|
316
|
+
embeddings: number[];
|
|
317
|
+
embeddings_meta_data: {
|
|
318
|
+
model: string;
|
|
319
|
+
dimensions: number;
|
|
320
|
+
text_length: number;
|
|
321
|
+
processing_time: number;
|
|
322
|
+
};
|
|
323
|
+
metadata: {
|
|
324
|
+
block_id: string;
|
|
325
|
+
level: number;
|
|
326
|
+
has_children: boolean;
|
|
327
|
+
};
|
|
328
|
+
_id?: string | undefined;
|
|
329
|
+
created_at?: number | undefined;
|
|
330
|
+
updated_at?: number | undefined;
|
|
331
|
+
chunk_id?: string | undefined;
|
|
332
|
+
}>;
|
|
333
|
+
export declare const zodFullTextSchema: z.ZodObject<{
|
|
334
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
335
|
+
organization_id: z.ZodString;
|
|
336
|
+
context_id: z.ZodString;
|
|
337
|
+
full_text: z.ZodString;
|
|
338
|
+
}, "strip", z.ZodTypeAny, {
|
|
339
|
+
organization_id: string;
|
|
340
|
+
context_id: string;
|
|
341
|
+
full_text: string;
|
|
342
|
+
_id?: string | undefined;
|
|
343
|
+
}, {
|
|
344
|
+
organization_id: string;
|
|
345
|
+
context_id: string;
|
|
346
|
+
full_text: string;
|
|
347
|
+
_id?: string | undefined;
|
|
348
|
+
}>;
|
|
287
349
|
export type EventAttributeType = {
|
|
288
350
|
http_request: {
|
|
289
351
|
client_ip?: string;
|
|
@@ -298,3 +360,10 @@ export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
|
298
360
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
299
361
|
export type ModelType = (typeof modelsList)[number];
|
|
300
362
|
export type UserRoleType = (typeof userRoles)[number];
|
|
363
|
+
export declare enum FileType {
|
|
364
|
+
PDF = "application/pdf",
|
|
365
|
+
WORD = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
366
|
+
PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
367
|
+
XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
368
|
+
HTML = "text/html"
|
|
369
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FileType = exports.zodFullTextSchema = exports.zodChunkSchema = exports.zodQuerySchema = exports.zodAgentSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.userRoles = exports.modelsList = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.modelsList = [
|
|
6
6
|
'gemini-2.5-flash-lite',
|
|
@@ -44,10 +44,10 @@ exports.zodUserSchema = zod_1.z.object({
|
|
|
44
44
|
exports.zodContextSchema = zod_1.z.object({
|
|
45
45
|
_id: zod_1.z.string().optional(),
|
|
46
46
|
organization_id: zod_1.z.string().optional(),
|
|
47
|
-
file_id: zod_1.z.string().optional(),
|
|
48
47
|
title: zod_1.z.string().min(1).max(100),
|
|
49
|
-
|
|
48
|
+
ai_description: zod_1.z.string().min(1).max(500).optional(),
|
|
50
49
|
note: zod_1.z.string().max(500).optional(),
|
|
50
|
+
file_id: zod_1.z.string().optional(),
|
|
51
51
|
file_url: zod_1.z.string().optional(),
|
|
52
52
|
file_gcs_url: zod_1.z.string().optional(),
|
|
53
53
|
file_name: zod_1.z.string().optional(),
|
|
@@ -69,19 +69,6 @@ exports.zodContextSchema = zod_1.z.object({
|
|
|
69
69
|
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
70
70
|
.optional(),
|
|
71
71
|
});
|
|
72
|
-
exports.zodChunkSchema = zod_1.z.object({
|
|
73
|
-
_id: zod_1.z.string().optional(),
|
|
74
|
-
embedding: zod_1.z.array(zod_1.z.number()),
|
|
75
|
-
metadata: zod_1.z.object({
|
|
76
|
-
organization_id: zod_1.z.string(),
|
|
77
|
-
context_id: zod_1.z.string(),
|
|
78
|
-
file_id: zod_1.z.string(),
|
|
79
|
-
page_number: zod_1.z.number().optional(),
|
|
80
|
-
chunk_index: zod_1.z.number(),
|
|
81
|
-
text_preview: zod_1.z.string(),
|
|
82
|
-
}),
|
|
83
|
-
created_at: zod_1.z.number().optional(),
|
|
84
|
-
});
|
|
85
72
|
exports.zodAgentSchema = zod_1.z.object({
|
|
86
73
|
_id: zod_1.z.string().optional(),
|
|
87
74
|
organization_id: zod_1.z.string().optional(),
|
|
@@ -108,3 +95,44 @@ exports.zodQuerySchema = zod_1.z.object({
|
|
|
108
95
|
created_at: zod_1.z.number().optional(),
|
|
109
96
|
updated_at: zod_1.z.number().optional(),
|
|
110
97
|
});
|
|
98
|
+
exports.zodChunkSchema = zod_1.z.object({
|
|
99
|
+
_id: zod_1.z.string().optional(),
|
|
100
|
+
chunk_id: zod_1.z.string().optional(),
|
|
101
|
+
organization_id: zod_1.z.string(),
|
|
102
|
+
context_id: zod_1.z.string(),
|
|
103
|
+
text: zod_1.z.string(),
|
|
104
|
+
type: zod_1.z.string(),
|
|
105
|
+
page_start: zod_1.z.number(),
|
|
106
|
+
page_end: zod_1.z.number(),
|
|
107
|
+
hierarchy: zod_1.z.array(zod_1.z.string()),
|
|
108
|
+
characters_length: zod_1.z.number(),
|
|
109
|
+
words_length: zod_1.z.number(),
|
|
110
|
+
embeddings: zod_1.z.array(zod_1.z.number()),
|
|
111
|
+
embeddings_meta_data: zod_1.z.object({
|
|
112
|
+
model: zod_1.z.string(),
|
|
113
|
+
dimensions: zod_1.z.number(),
|
|
114
|
+
text_length: zod_1.z.number(),
|
|
115
|
+
processing_time: zod_1.z.number(),
|
|
116
|
+
}),
|
|
117
|
+
metadata: zod_1.z.object({
|
|
118
|
+
block_id: zod_1.z.string(),
|
|
119
|
+
level: zod_1.z.number(),
|
|
120
|
+
has_children: zod_1.z.boolean(),
|
|
121
|
+
}),
|
|
122
|
+
created_at: zod_1.z.number().optional(),
|
|
123
|
+
updated_at: zod_1.z.number().optional(),
|
|
124
|
+
});
|
|
125
|
+
exports.zodFullTextSchema = zod_1.z.object({
|
|
126
|
+
_id: zod_1.z.string().optional(),
|
|
127
|
+
organization_id: zod_1.z.string(),
|
|
128
|
+
context_id: zod_1.z.string(),
|
|
129
|
+
full_text: zod_1.z.string(),
|
|
130
|
+
});
|
|
131
|
+
var FileType;
|
|
132
|
+
(function (FileType) {
|
|
133
|
+
FileType["PDF"] = "application/pdf";
|
|
134
|
+
FileType["WORD"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
135
|
+
FileType["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
136
|
+
FileType["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
137
|
+
FileType["HTML"] = "text/html";
|
|
138
|
+
})(FileType = exports.FileType || (exports.FileType = {}));
|
package/index.ts
CHANGED
|
@@ -80,10 +80,10 @@ export const AgentSchema = new Schema(
|
|
|
80
80
|
export const ContextSchema = new Schema(
|
|
81
81
|
{
|
|
82
82
|
organization_id: { type: String },
|
|
83
|
-
file_id: { type: String },
|
|
84
83
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
85
|
-
|
|
84
|
+
ai_description: { type: String, minlength: 1, maxlength: 500 },
|
|
86
85
|
note: { type: String, maxlength: 500 },
|
|
86
|
+
file_id: { type: String },
|
|
87
87
|
file_url: { type: String },
|
|
88
88
|
file_gcs_url: { type: String },
|
|
89
89
|
file_name: { type: String },
|
|
@@ -113,16 +113,30 @@ export const ContextSchema = new Schema(
|
|
|
113
113
|
|
|
114
114
|
export const ChunkSchema = new Schema(
|
|
115
115
|
{
|
|
116
|
-
|
|
116
|
+
chunk_id: { type: String },
|
|
117
|
+
organization_id: { type: String, required: true },
|
|
118
|
+
context_id: { type: String, required: true },
|
|
119
|
+
text: { type: String, required: true },
|
|
120
|
+
type: { type: String, required: true },
|
|
121
|
+
page_start: { type: Number, required: true },
|
|
122
|
+
page_end: { type: Number, required: true },
|
|
123
|
+
hierarchy: { type: [String], required: true },
|
|
124
|
+
characters_length: { type: Number, required: true },
|
|
125
|
+
words_length: { type: Number, required: true },
|
|
126
|
+
embeddings: { type: [Number], required: true },
|
|
127
|
+
embeddings_meta_data: {
|
|
128
|
+
model: { type: String, required: true },
|
|
129
|
+
dimensions: { type: Number, required: true },
|
|
130
|
+
text_length: { type: Number, required: true },
|
|
131
|
+
processing_time: { type: Number, required: true },
|
|
132
|
+
},
|
|
117
133
|
metadata: {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
page_number: { type: Number },
|
|
122
|
-
chunk_index: { type: Number, required: true },
|
|
123
|
-
text_preview: { type: String, required: true },
|
|
134
|
+
block_id: { type: String, required: true },
|
|
135
|
+
level: { type: Number, required: true },
|
|
136
|
+
has_children: { type: Boolean, required: true },
|
|
124
137
|
},
|
|
125
138
|
created_at: { type: Number },
|
|
139
|
+
updated_at: { type: Number },
|
|
126
140
|
},
|
|
127
141
|
{
|
|
128
142
|
versionKey: false,
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -46,10 +46,10 @@ export const zodUserSchema = z.object({
|
|
|
46
46
|
export const zodContextSchema = z.object({
|
|
47
47
|
_id: z.string().optional(),
|
|
48
48
|
organization_id: z.string().optional(),
|
|
49
|
-
file_id: z.string().optional(),
|
|
50
49
|
title: z.string().min(1).max(100),
|
|
51
|
-
|
|
50
|
+
ai_description: z.string().min(1).max(500).optional(), // Generated by AI
|
|
52
51
|
note: z.string().max(500).optional(),
|
|
52
|
+
file_id: z.string().optional(),
|
|
53
53
|
file_url: z.string().optional(),
|
|
54
54
|
file_gcs_url: z.string().optional(),
|
|
55
55
|
file_name: z.string().optional(),
|
|
@@ -72,20 +72,6 @@ export const zodContextSchema = z.object({
|
|
|
72
72
|
.optional(),
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
export const zodChunkSchema = z.object({
|
|
76
|
-
_id: z.string().optional(),
|
|
77
|
-
embedding: z.array(z.number()),
|
|
78
|
-
metadata: z.object({
|
|
79
|
-
organization_id: z.string(),
|
|
80
|
-
context_id: z.string(),
|
|
81
|
-
file_id: z.string(),
|
|
82
|
-
page_number: z.number().optional(),
|
|
83
|
-
chunk_index: z.number(),
|
|
84
|
-
text_preview: z.string(),
|
|
85
|
-
}),
|
|
86
|
-
created_at: z.number().optional(),
|
|
87
|
-
});
|
|
88
|
-
|
|
89
75
|
export const zodAgentSchema = z.object({
|
|
90
76
|
_id: z.string().optional(),
|
|
91
77
|
organization_id: z.string().optional(),
|
|
@@ -114,6 +100,41 @@ export const zodQuerySchema = z.object({
|
|
|
114
100
|
updated_at: z.number().optional(),
|
|
115
101
|
});
|
|
116
102
|
|
|
103
|
+
export const zodChunkSchema = z.object({
|
|
104
|
+
_id: z.string().optional(),
|
|
105
|
+
chunk_id: z.string().optional(),
|
|
106
|
+
organization_id: z.string(),
|
|
107
|
+
context_id: z.string(),
|
|
108
|
+
text: z.string(),
|
|
109
|
+
type: z.string(),
|
|
110
|
+
page_start: z.number(),
|
|
111
|
+
page_end: z.number(),
|
|
112
|
+
hierarchy: z.array(z.string()),
|
|
113
|
+
characters_length: z.number(),
|
|
114
|
+
words_length: z.number(),
|
|
115
|
+
embeddings: z.array(z.number()),
|
|
116
|
+
embeddings_meta_data: z.object({
|
|
117
|
+
model: z.string(),
|
|
118
|
+
dimensions: z.number(),
|
|
119
|
+
text_length: z.number(),
|
|
120
|
+
processing_time: z.number(),
|
|
121
|
+
}),
|
|
122
|
+
metadata: z.object({
|
|
123
|
+
block_id: z.string(),
|
|
124
|
+
level: z.number(),
|
|
125
|
+
has_children: z.boolean(),
|
|
126
|
+
}),
|
|
127
|
+
created_at: z.number().optional(),
|
|
128
|
+
updated_at: z.number().optional(),
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export const zodFullTextSchema = z.object({
|
|
132
|
+
_id: z.string().optional(),
|
|
133
|
+
organization_id: z.string(),
|
|
134
|
+
context_id: z.string(),
|
|
135
|
+
full_text: z.string(),
|
|
136
|
+
});
|
|
137
|
+
|
|
117
138
|
export type EventAttributeType = {
|
|
118
139
|
http_request: {
|
|
119
140
|
client_ip?: string;
|
|
@@ -129,3 +150,11 @@ export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
|
129
150
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
130
151
|
export type ModelType = (typeof modelsList)[number];
|
|
131
152
|
export type UserRoleType = (typeof userRoles)[number];
|
|
153
|
+
|
|
154
|
+
export enum FileType {
|
|
155
|
+
PDF = 'application/pdf',
|
|
156
|
+
WORD = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
157
|
+
PPTX = 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
158
|
+
XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
159
|
+
HTML = 'text/html',
|
|
160
|
+
}
|