chatifai 1.0.14 → 1.0.16
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 +75 -36
- package/dist/index.js +25 -18
- package/dist/types.d.ts +132 -66
- package/dist/types.js +46 -21
- package/index.ts +25 -18
- package/package.json +1 -1
- package/types.ts +47 -22
package/dist/index.d.ts
CHANGED
|
@@ -224,14 +224,17 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
224
224
|
} & {
|
|
225
225
|
title: string;
|
|
226
226
|
is_active: boolean;
|
|
227
|
+
processing_status: "pending" | "processing" | "completed" | "failed";
|
|
227
228
|
type?: string | null | undefined;
|
|
228
229
|
created_at?: number | null | undefined;
|
|
229
230
|
updated_at?: number | null | undefined;
|
|
230
231
|
organization_id?: string | null | undefined;
|
|
231
|
-
|
|
232
|
-
description?: string | null | undefined;
|
|
232
|
+
ai_description?: string | null | undefined;
|
|
233
233
|
note?: string | null | undefined;
|
|
234
|
+
file_id?: string | null | undefined;
|
|
234
235
|
file_url?: string | null | undefined;
|
|
236
|
+
file_gcs_url?: string | null | undefined;
|
|
237
|
+
file_name?: string | null | undefined;
|
|
235
238
|
size?: number | null | undefined;
|
|
236
239
|
tokens?: number | null | undefined;
|
|
237
240
|
uploaded_by?: {
|
|
@@ -240,23 +243,23 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
240
243
|
last_name?: string | null | undefined;
|
|
241
244
|
} | null | undefined;
|
|
242
245
|
bucket_name?: string | null | undefined;
|
|
243
|
-
file_name?: string | null | undefined;
|
|
244
|
-
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
245
|
-
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
246
246
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
247
247
|
createdAt: NativeDate;
|
|
248
248
|
updatedAt: NativeDate;
|
|
249
249
|
} & {
|
|
250
250
|
title: string;
|
|
251
251
|
is_active: boolean;
|
|
252
|
+
processing_status: "pending" | "processing" | "completed" | "failed";
|
|
252
253
|
type?: string | null | undefined;
|
|
253
254
|
created_at?: number | null | undefined;
|
|
254
255
|
updated_at?: number | null | undefined;
|
|
255
256
|
organization_id?: string | null | undefined;
|
|
256
|
-
|
|
257
|
-
description?: string | null | undefined;
|
|
257
|
+
ai_description?: string | null | undefined;
|
|
258
258
|
note?: string | null | undefined;
|
|
259
|
+
file_id?: string | null | undefined;
|
|
259
260
|
file_url?: string | null | undefined;
|
|
261
|
+
file_gcs_url?: string | null | undefined;
|
|
262
|
+
file_name?: string | null | undefined;
|
|
260
263
|
size?: number | null | undefined;
|
|
261
264
|
tokens?: number | null | undefined;
|
|
262
265
|
uploaded_by?: {
|
|
@@ -265,23 +268,23 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
265
268
|
last_name?: string | null | undefined;
|
|
266
269
|
} | null | undefined;
|
|
267
270
|
bucket_name?: string | null | undefined;
|
|
268
|
-
file_name?: string | null | undefined;
|
|
269
|
-
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
270
|
-
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
271
271
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
272
272
|
createdAt: NativeDate;
|
|
273
273
|
updatedAt: NativeDate;
|
|
274
274
|
} & {
|
|
275
275
|
title: string;
|
|
276
276
|
is_active: boolean;
|
|
277
|
+
processing_status: "pending" | "processing" | "completed" | "failed";
|
|
277
278
|
type?: string | null | undefined;
|
|
278
279
|
created_at?: number | null | undefined;
|
|
279
280
|
updated_at?: number | null | undefined;
|
|
280
281
|
organization_id?: string | null | undefined;
|
|
281
|
-
|
|
282
|
-
description?: string | null | undefined;
|
|
282
|
+
ai_description?: string | null | undefined;
|
|
283
283
|
note?: string | null | undefined;
|
|
284
|
+
file_id?: string | null | undefined;
|
|
284
285
|
file_url?: string | null | undefined;
|
|
286
|
+
file_gcs_url?: string | null | undefined;
|
|
287
|
+
file_name?: string | null | undefined;
|
|
285
288
|
size?: number | null | undefined;
|
|
286
289
|
tokens?: number | null | undefined;
|
|
287
290
|
uploaded_by?: {
|
|
@@ -290,9 +293,6 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
290
293
|
last_name?: string | null | undefined;
|
|
291
294
|
} | null | undefined;
|
|
292
295
|
bucket_name?: string | null | undefined;
|
|
293
|
-
file_name?: string | null | undefined;
|
|
294
|
-
ocr_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
295
|
-
vector_index_status?: "pending" | "processing" | "completed" | "failed" | null | undefined;
|
|
296
296
|
}> & {
|
|
297
297
|
_id: import("mongoose").Types.ObjectId;
|
|
298
298
|
} & {
|
|
@@ -312,43 +312,82 @@ 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
|
+
embeddings_meta_data?: {
|
|
328
|
+
model: string;
|
|
329
|
+
dimensions: number;
|
|
330
|
+
text_length: number;
|
|
331
|
+
processing_time: number;
|
|
332
|
+
} | null | undefined;
|
|
317
333
|
metadata?: {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
chunk_index: number;
|
|
322
|
-
text_preview: string;
|
|
323
|
-
page_number?: number | null | undefined;
|
|
334
|
+
block_id: string;
|
|
335
|
+
level: number;
|
|
336
|
+
has_children: boolean;
|
|
324
337
|
} | null | undefined;
|
|
325
338
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
326
339
|
createdAt: NativeDate;
|
|
327
340
|
updatedAt: NativeDate;
|
|
328
341
|
} & {
|
|
329
|
-
|
|
342
|
+
type: string;
|
|
343
|
+
organization_id: string;
|
|
344
|
+
context_id: string;
|
|
345
|
+
text: string;
|
|
346
|
+
page_start: number;
|
|
347
|
+
page_end: number;
|
|
348
|
+
hierarchy: string[];
|
|
349
|
+
characters_length: number;
|
|
350
|
+
words_length: number;
|
|
351
|
+
embeddings: number[];
|
|
330
352
|
created_at?: number | null | undefined;
|
|
353
|
+
updated_at?: number | null | undefined;
|
|
354
|
+
embeddings_meta_data?: {
|
|
355
|
+
model: string;
|
|
356
|
+
dimensions: number;
|
|
357
|
+
text_length: number;
|
|
358
|
+
processing_time: number;
|
|
359
|
+
} | null | undefined;
|
|
331
360
|
metadata?: {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
chunk_index: number;
|
|
336
|
-
text_preview: string;
|
|
337
|
-
page_number?: number | null | undefined;
|
|
361
|
+
block_id: string;
|
|
362
|
+
level: number;
|
|
363
|
+
has_children: boolean;
|
|
338
364
|
} | null | undefined;
|
|
339
365
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
340
366
|
createdAt: NativeDate;
|
|
341
367
|
updatedAt: NativeDate;
|
|
342
368
|
} & {
|
|
343
|
-
|
|
369
|
+
type: string;
|
|
370
|
+
organization_id: string;
|
|
371
|
+
context_id: string;
|
|
372
|
+
text: string;
|
|
373
|
+
page_start: number;
|
|
374
|
+
page_end: number;
|
|
375
|
+
hierarchy: string[];
|
|
376
|
+
characters_length: number;
|
|
377
|
+
words_length: number;
|
|
378
|
+
embeddings: number[];
|
|
344
379
|
created_at?: number | null | undefined;
|
|
380
|
+
updated_at?: number | null | undefined;
|
|
381
|
+
embeddings_meta_data?: {
|
|
382
|
+
model: string;
|
|
383
|
+
dimensions: number;
|
|
384
|
+
text_length: number;
|
|
385
|
+
processing_time: number;
|
|
386
|
+
} | null | undefined;
|
|
345
387
|
metadata?: {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
chunk_index: number;
|
|
350
|
-
text_preview: string;
|
|
351
|
-
page_number?: number | null | undefined;
|
|
388
|
+
block_id: string;
|
|
389
|
+
level: number;
|
|
390
|
+
has_children: boolean;
|
|
352
391
|
} | null | undefined;
|
|
353
392
|
}> & {
|
|
354
393
|
_id: import("mongoose").Types.ObjectId;
|
package/dist/index.js
CHANGED
|
@@ -82,11 +82,13 @@ 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
|
+
file_gcs_url: { type: String },
|
|
91
|
+
file_name: { type: String },
|
|
90
92
|
type: { type: String, minlength: 1, maxlength: 100 },
|
|
91
93
|
size: { type: Number },
|
|
92
94
|
tokens: { type: Number },
|
|
@@ -97,15 +99,7 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
97
99
|
email: { type: String },
|
|
98
100
|
},
|
|
99
101
|
bucket_name: { type: String },
|
|
100
|
-
|
|
101
|
-
ocr_status: {
|
|
102
|
-
type: String,
|
|
103
|
-
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
104
|
-
},
|
|
105
|
-
vector_index_status: {
|
|
106
|
-
type: String,
|
|
107
|
-
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
108
|
-
},
|
|
102
|
+
processing_status: { type: String, enum: ['pending', 'processing', 'completed', 'failed'], default: 'pending' },
|
|
109
103
|
created_at: { type: Number },
|
|
110
104
|
updated_at: { type: Number },
|
|
111
105
|
}, {
|
|
@@ -117,16 +111,29 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
117
111
|
// encryptionType: 'csfle',
|
|
118
112
|
});
|
|
119
113
|
exports.ChunkSchema = new mongoose_1.Schema({
|
|
120
|
-
|
|
114
|
+
organization_id: { type: String, required: true },
|
|
115
|
+
context_id: { type: String, required: true },
|
|
116
|
+
text: { type: String, required: true },
|
|
117
|
+
type: { type: String, required: true },
|
|
118
|
+
page_start: { type: Number, required: true },
|
|
119
|
+
page_end: { type: Number, required: true },
|
|
120
|
+
hierarchy: { type: [String], required: true },
|
|
121
|
+
characters_length: { type: Number, required: true },
|
|
122
|
+
words_length: { type: Number, required: true },
|
|
123
|
+
embeddings: { type: [Number], required: true },
|
|
124
|
+
embeddings_meta_data: {
|
|
125
|
+
model: { type: String, required: true },
|
|
126
|
+
dimensions: { type: Number, required: true },
|
|
127
|
+
text_length: { type: Number, required: true },
|
|
128
|
+
processing_time: { type: Number, required: true },
|
|
129
|
+
},
|
|
121
130
|
metadata: {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
page_number: { type: Number },
|
|
126
|
-
chunk_index: { type: Number, required: true },
|
|
127
|
-
text_preview: { type: String, required: true },
|
|
131
|
+
block_id: { type: String, required: true },
|
|
132
|
+
level: { type: Number, required: true },
|
|
133
|
+
has_children: { type: Boolean, required: true },
|
|
128
134
|
},
|
|
129
135
|
created_at: { type: Number },
|
|
136
|
+
updated_at: { type: Number },
|
|
130
137
|
}, {
|
|
131
138
|
versionKey: false,
|
|
132
139
|
toJSON: { virtuals: true },
|
package/dist/types.d.ts
CHANGED
|
@@ -84,11 +84,13 @@ 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
|
+
file_gcs_url: z.ZodOptional<z.ZodString>;
|
|
93
|
+
file_name: z.ZodOptional<z.ZodString>;
|
|
92
94
|
type: z.ZodOptional<z.ZodString>;
|
|
93
95
|
size: z.ZodOptional<z.ZodNumber>;
|
|
94
96
|
tokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -109,9 +111,7 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
109
111
|
last_name?: string | undefined;
|
|
110
112
|
}>>;
|
|
111
113
|
bucket_name: z.ZodOptional<z.ZodString>;
|
|
112
|
-
|
|
113
|
-
ocr_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
114
|
-
vector_index_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
114
|
+
processing_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
115
115
|
}, "strip", z.ZodTypeAny, {
|
|
116
116
|
title: string;
|
|
117
117
|
_id?: string | undefined;
|
|
@@ -119,10 +119,12 @@ 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
|
+
file_gcs_url?: string | undefined;
|
|
127
|
+
file_name?: string | undefined;
|
|
126
128
|
size?: number | undefined;
|
|
127
129
|
tokens?: number | undefined;
|
|
128
130
|
is_active?: boolean | undefined;
|
|
@@ -132,9 +134,7 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
132
134
|
last_name?: string | undefined;
|
|
133
135
|
} | undefined;
|
|
134
136
|
bucket_name?: string | undefined;
|
|
135
|
-
|
|
136
|
-
ocr_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
137
|
-
vector_index_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
137
|
+
processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
138
138
|
}, {
|
|
139
139
|
title: string;
|
|
140
140
|
_id?: string | undefined;
|
|
@@ -142,10 +142,12 @@ 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
|
+
file_gcs_url?: string | undefined;
|
|
150
|
+
file_name?: string | undefined;
|
|
149
151
|
size?: number | undefined;
|
|
150
152
|
tokens?: number | undefined;
|
|
151
153
|
is_active?: boolean | undefined;
|
|
@@ -155,60 +157,7 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
155
157
|
last_name?: string | undefined;
|
|
156
158
|
} | undefined;
|
|
157
159
|
bucket_name?: string | undefined;
|
|
158
|
-
|
|
159
|
-
ocr_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
160
|
-
vector_index_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
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;
|
|
160
|
+
processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
212
161
|
}>;
|
|
213
162
|
export declare const zodAgentSchema: z.ZodObject<{
|
|
214
163
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -284,6 +233,116 @@ 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
|
+
organization_id: z.ZodString;
|
|
239
|
+
context_id: z.ZodString;
|
|
240
|
+
text: z.ZodString;
|
|
241
|
+
type: z.ZodString;
|
|
242
|
+
page_start: z.ZodNumber;
|
|
243
|
+
page_end: z.ZodNumber;
|
|
244
|
+
hierarchy: z.ZodArray<z.ZodString, "many">;
|
|
245
|
+
characters_length: z.ZodNumber;
|
|
246
|
+
words_length: z.ZodNumber;
|
|
247
|
+
embeddings: z.ZodArray<z.ZodNumber, "many">;
|
|
248
|
+
embeddings_meta_data: z.ZodObject<{
|
|
249
|
+
model: z.ZodString;
|
|
250
|
+
dimensions: z.ZodNumber;
|
|
251
|
+
text_length: z.ZodNumber;
|
|
252
|
+
processing_time: z.ZodNumber;
|
|
253
|
+
}, "strip", z.ZodTypeAny, {
|
|
254
|
+
model: string;
|
|
255
|
+
dimensions: number;
|
|
256
|
+
text_length: number;
|
|
257
|
+
processing_time: number;
|
|
258
|
+
}, {
|
|
259
|
+
model: string;
|
|
260
|
+
dimensions: number;
|
|
261
|
+
text_length: number;
|
|
262
|
+
processing_time: number;
|
|
263
|
+
}>;
|
|
264
|
+
metadata: z.ZodObject<{
|
|
265
|
+
block_id: z.ZodString;
|
|
266
|
+
level: z.ZodNumber;
|
|
267
|
+
has_children: z.ZodBoolean;
|
|
268
|
+
}, "strip", z.ZodTypeAny, {
|
|
269
|
+
block_id: string;
|
|
270
|
+
level: number;
|
|
271
|
+
has_children: boolean;
|
|
272
|
+
}, {
|
|
273
|
+
block_id: string;
|
|
274
|
+
level: number;
|
|
275
|
+
has_children: boolean;
|
|
276
|
+
}>;
|
|
277
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
type: string;
|
|
281
|
+
organization_id: string;
|
|
282
|
+
context_id: string;
|
|
283
|
+
text: string;
|
|
284
|
+
page_start: number;
|
|
285
|
+
page_end: number;
|
|
286
|
+
hierarchy: string[];
|
|
287
|
+
characters_length: number;
|
|
288
|
+
words_length: number;
|
|
289
|
+
embeddings: number[];
|
|
290
|
+
embeddings_meta_data: {
|
|
291
|
+
model: string;
|
|
292
|
+
dimensions: number;
|
|
293
|
+
text_length: number;
|
|
294
|
+
processing_time: number;
|
|
295
|
+
};
|
|
296
|
+
metadata: {
|
|
297
|
+
block_id: string;
|
|
298
|
+
level: number;
|
|
299
|
+
has_children: boolean;
|
|
300
|
+
};
|
|
301
|
+
_id?: string | undefined;
|
|
302
|
+
created_at?: number | undefined;
|
|
303
|
+
updated_at?: number | undefined;
|
|
304
|
+
}, {
|
|
305
|
+
type: string;
|
|
306
|
+
organization_id: string;
|
|
307
|
+
context_id: string;
|
|
308
|
+
text: string;
|
|
309
|
+
page_start: number;
|
|
310
|
+
page_end: number;
|
|
311
|
+
hierarchy: string[];
|
|
312
|
+
characters_length: number;
|
|
313
|
+
words_length: number;
|
|
314
|
+
embeddings: number[];
|
|
315
|
+
embeddings_meta_data: {
|
|
316
|
+
model: string;
|
|
317
|
+
dimensions: number;
|
|
318
|
+
text_length: number;
|
|
319
|
+
processing_time: number;
|
|
320
|
+
};
|
|
321
|
+
metadata: {
|
|
322
|
+
block_id: string;
|
|
323
|
+
level: number;
|
|
324
|
+
has_children: boolean;
|
|
325
|
+
};
|
|
326
|
+
_id?: string | undefined;
|
|
327
|
+
created_at?: number | undefined;
|
|
328
|
+
updated_at?: number | undefined;
|
|
329
|
+
}>;
|
|
330
|
+
export declare const zodFullTextSchema: z.ZodObject<{
|
|
331
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
332
|
+
organization_id: z.ZodString;
|
|
333
|
+
context_id: z.ZodString;
|
|
334
|
+
full_text: z.ZodString;
|
|
335
|
+
}, "strip", z.ZodTypeAny, {
|
|
336
|
+
organization_id: string;
|
|
337
|
+
context_id: string;
|
|
338
|
+
full_text: string;
|
|
339
|
+
_id?: string | undefined;
|
|
340
|
+
}, {
|
|
341
|
+
organization_id: string;
|
|
342
|
+
context_id: string;
|
|
343
|
+
full_text: string;
|
|
344
|
+
_id?: string | undefined;
|
|
345
|
+
}>;
|
|
287
346
|
export type EventAttributeType = {
|
|
288
347
|
http_request: {
|
|
289
348
|
client_ip?: string;
|
|
@@ -298,3 +357,10 @@ export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
|
298
357
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
299
358
|
export type ModelType = (typeof modelsList)[number];
|
|
300
359
|
export type UserRoleType = (typeof userRoles)[number];
|
|
360
|
+
export declare enum FileType {
|
|
361
|
+
PDF = "application/pdf",
|
|
362
|
+
WORD = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
363
|
+
PPTX = "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
364
|
+
XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
365
|
+
HTML = "text/html"
|
|
366
|
+
}
|
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,11 +44,13 @@ 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
|
+
file_gcs_url: zod_1.z.string().optional(),
|
|
53
|
+
file_name: zod_1.z.string().optional(),
|
|
52
54
|
type: zod_1.z.string().min(1).max(100).optional(),
|
|
53
55
|
size: zod_1.z.number().optional(),
|
|
54
56
|
tokens: zod_1.z.number().optional(),
|
|
@@ -63,27 +65,10 @@ exports.zodContextSchema = zod_1.z.object({
|
|
|
63
65
|
})
|
|
64
66
|
.optional(),
|
|
65
67
|
bucket_name: zod_1.z.string().optional(),
|
|
66
|
-
|
|
67
|
-
ocr_status: zod_1.z
|
|
68
|
-
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
69
|
-
.optional(),
|
|
70
|
-
vector_index_status: zod_1.z
|
|
68
|
+
processing_status: zod_1.z
|
|
71
69
|
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
70
|
.optional(),
|
|
73
71
|
});
|
|
74
|
-
exports.zodChunkSchema = zod_1.z.object({
|
|
75
|
-
_id: zod_1.z.string().optional(),
|
|
76
|
-
embedding: zod_1.z.array(zod_1.z.number()),
|
|
77
|
-
metadata: zod_1.z.object({
|
|
78
|
-
organization_id: zod_1.z.string(),
|
|
79
|
-
context_id: zod_1.z.string(),
|
|
80
|
-
file_id: zod_1.z.string(),
|
|
81
|
-
page_number: zod_1.z.number().optional(),
|
|
82
|
-
chunk_index: zod_1.z.number(),
|
|
83
|
-
text_preview: zod_1.z.string(),
|
|
84
|
-
}),
|
|
85
|
-
created_at: zod_1.z.number().optional(),
|
|
86
|
-
});
|
|
87
72
|
exports.zodAgentSchema = zod_1.z.object({
|
|
88
73
|
_id: zod_1.z.string().optional(),
|
|
89
74
|
organization_id: zod_1.z.string().optional(),
|
|
@@ -110,3 +95,43 @@ exports.zodQuerySchema = zod_1.z.object({
|
|
|
110
95
|
created_at: zod_1.z.number().optional(),
|
|
111
96
|
updated_at: zod_1.z.number().optional(),
|
|
112
97
|
});
|
|
98
|
+
exports.zodChunkSchema = zod_1.z.object({
|
|
99
|
+
_id: zod_1.z.string().optional(),
|
|
100
|
+
organization_id: zod_1.z.string(),
|
|
101
|
+
context_id: zod_1.z.string(),
|
|
102
|
+
text: zod_1.z.string(),
|
|
103
|
+
type: zod_1.z.string(),
|
|
104
|
+
page_start: zod_1.z.number(),
|
|
105
|
+
page_end: zod_1.z.number(),
|
|
106
|
+
hierarchy: zod_1.z.array(zod_1.z.string()),
|
|
107
|
+
characters_length: zod_1.z.number(),
|
|
108
|
+
words_length: zod_1.z.number(),
|
|
109
|
+
embeddings: zod_1.z.array(zod_1.z.number()),
|
|
110
|
+
embeddings_meta_data: zod_1.z.object({
|
|
111
|
+
model: zod_1.z.string(),
|
|
112
|
+
dimensions: zod_1.z.number(),
|
|
113
|
+
text_length: zod_1.z.number(),
|
|
114
|
+
processing_time: zod_1.z.number(),
|
|
115
|
+
}),
|
|
116
|
+
metadata: zod_1.z.object({
|
|
117
|
+
block_id: zod_1.z.string(),
|
|
118
|
+
level: zod_1.z.number(),
|
|
119
|
+
has_children: zod_1.z.boolean(),
|
|
120
|
+
}),
|
|
121
|
+
created_at: zod_1.z.number().optional(),
|
|
122
|
+
updated_at: zod_1.z.number().optional(),
|
|
123
|
+
});
|
|
124
|
+
exports.zodFullTextSchema = zod_1.z.object({
|
|
125
|
+
_id: zod_1.z.string().optional(),
|
|
126
|
+
organization_id: zod_1.z.string(),
|
|
127
|
+
context_id: zod_1.z.string(),
|
|
128
|
+
full_text: zod_1.z.string(),
|
|
129
|
+
});
|
|
130
|
+
var FileType;
|
|
131
|
+
(function (FileType) {
|
|
132
|
+
FileType["PDF"] = "application/pdf";
|
|
133
|
+
FileType["WORD"] = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
|
|
134
|
+
FileType["PPTX"] = "application/vnd.openxmlformats-officedocument.presentationml.presentation";
|
|
135
|
+
FileType["XLSX"] = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
|
|
136
|
+
FileType["HTML"] = "text/html";
|
|
137
|
+
})(FileType = exports.FileType || (exports.FileType = {}));
|
package/index.ts
CHANGED
|
@@ -80,11 +80,13 @@ 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
|
+
file_gcs_url: { type: String },
|
|
89
|
+
file_name: { type: String },
|
|
88
90
|
type: { type: String, minlength: 1, maxlength: 100 },
|
|
89
91
|
size: { type: Number },
|
|
90
92
|
tokens: { type: Number },
|
|
@@ -95,15 +97,7 @@ export const ContextSchema = new Schema(
|
|
|
95
97
|
email: { type: String },
|
|
96
98
|
},
|
|
97
99
|
bucket_name: { type: String },
|
|
98
|
-
|
|
99
|
-
ocr_status: {
|
|
100
|
-
type: String,
|
|
101
|
-
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
102
|
-
},
|
|
103
|
-
vector_index_status: {
|
|
104
|
-
type: String,
|
|
105
|
-
enum: ['pending', 'processing', 'completed', 'failed'],
|
|
106
|
-
},
|
|
100
|
+
processing_status: { type: String, enum: ['pending', 'processing', 'completed', 'failed'] , default: 'pending' },
|
|
107
101
|
created_at: { type: Number },
|
|
108
102
|
updated_at: { type: Number },
|
|
109
103
|
},
|
|
@@ -119,16 +113,29 @@ export const ContextSchema = new Schema(
|
|
|
119
113
|
|
|
120
114
|
export const ChunkSchema = new Schema(
|
|
121
115
|
{
|
|
122
|
-
|
|
116
|
+
organization_id: { type: String, required: true },
|
|
117
|
+
context_id: { type: String, required: true },
|
|
118
|
+
text: { type: String, required: true },
|
|
119
|
+
type: { type: String, required: true },
|
|
120
|
+
page_start: { type: Number, required: true },
|
|
121
|
+
page_end: { type: Number, required: true },
|
|
122
|
+
hierarchy: { type: [String], required: true },
|
|
123
|
+
characters_length: { type: Number, required: true },
|
|
124
|
+
words_length: { type: Number, required: true },
|
|
125
|
+
embeddings: { type: [Number], required: true },
|
|
126
|
+
embeddings_meta_data: {
|
|
127
|
+
model: { type: String, required: true },
|
|
128
|
+
dimensions: { type: Number, required: true },
|
|
129
|
+
text_length: { type: Number, required: true },
|
|
130
|
+
processing_time: { type: Number, required: true },
|
|
131
|
+
},
|
|
123
132
|
metadata: {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
page_number: { type: Number },
|
|
128
|
-
chunk_index: { type: Number, required: true },
|
|
129
|
-
text_preview: { type: String, required: true },
|
|
133
|
+
block_id: { type: String, required: true },
|
|
134
|
+
level: { type: Number, required: true },
|
|
135
|
+
has_children: { type: Boolean, required: true },
|
|
130
136
|
},
|
|
131
137
|
created_at: { type: Number },
|
|
138
|
+
updated_at: { type: Number },
|
|
132
139
|
},
|
|
133
140
|
{
|
|
134
141
|
versionKey: false,
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -46,11 +46,13 @@ 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
|
+
file_gcs_url: z.string().optional(),
|
|
55
|
+
file_name: z.string().optional(),
|
|
54
56
|
type: z.string().min(1).max(100).optional(),
|
|
55
57
|
size: z.number().optional(),
|
|
56
58
|
tokens: z.number().optional(),
|
|
@@ -64,31 +66,12 @@ export const zodContextSchema = z.object({
|
|
|
64
66
|
email: z.string().email().optional(),
|
|
65
67
|
})
|
|
66
68
|
.optional(),
|
|
67
|
-
|
|
68
69
|
bucket_name: z.string().optional(),
|
|
69
|
-
|
|
70
|
-
ocr_status: z
|
|
71
|
-
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
-
.optional(),
|
|
73
|
-
vector_index_status: z
|
|
70
|
+
processing_status: z
|
|
74
71
|
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
75
72
|
.optional(),
|
|
76
73
|
});
|
|
77
74
|
|
|
78
|
-
export const zodChunkSchema = z.object({
|
|
79
|
-
_id: z.string().optional(),
|
|
80
|
-
embedding: z.array(z.number()),
|
|
81
|
-
metadata: z.object({
|
|
82
|
-
organization_id: z.string(),
|
|
83
|
-
context_id: z.string(),
|
|
84
|
-
file_id: z.string(),
|
|
85
|
-
page_number: z.number().optional(),
|
|
86
|
-
chunk_index: z.number(),
|
|
87
|
-
text_preview: z.string(),
|
|
88
|
-
}),
|
|
89
|
-
created_at: z.number().optional(),
|
|
90
|
-
});
|
|
91
|
-
|
|
92
75
|
export const zodAgentSchema = z.object({
|
|
93
76
|
_id: z.string().optional(),
|
|
94
77
|
organization_id: z.string().optional(),
|
|
@@ -117,6 +100,40 @@ export const zodQuerySchema = z.object({
|
|
|
117
100
|
updated_at: z.number().optional(),
|
|
118
101
|
});
|
|
119
102
|
|
|
103
|
+
export const zodChunkSchema = z.object({
|
|
104
|
+
_id: z.string().optional(),
|
|
105
|
+
organization_id: z.string(),
|
|
106
|
+
context_id: z.string(),
|
|
107
|
+
text: z.string(),
|
|
108
|
+
type: z.string(),
|
|
109
|
+
page_start: z.number(),
|
|
110
|
+
page_end: z.number(),
|
|
111
|
+
hierarchy: z.array(z.string()),
|
|
112
|
+
characters_length: z.number(),
|
|
113
|
+
words_length: z.number(),
|
|
114
|
+
embeddings: z.array(z.number()),
|
|
115
|
+
embeddings_meta_data: z.object({
|
|
116
|
+
model: z.string(),
|
|
117
|
+
dimensions: z.number(),
|
|
118
|
+
text_length: z.number(),
|
|
119
|
+
processing_time: z.number(),
|
|
120
|
+
}),
|
|
121
|
+
metadata: z.object({
|
|
122
|
+
block_id: z.string(),
|
|
123
|
+
level: z.number(),
|
|
124
|
+
has_children: z.boolean(),
|
|
125
|
+
}),
|
|
126
|
+
created_at: z.number().optional(),
|
|
127
|
+
updated_at: z.number().optional(),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
export const zodFullTextSchema = z.object({
|
|
131
|
+
_id: z.string().optional(),
|
|
132
|
+
organization_id: z.string(),
|
|
133
|
+
context_id: z.string(),
|
|
134
|
+
full_text: z.string(),
|
|
135
|
+
});
|
|
136
|
+
|
|
120
137
|
export type EventAttributeType = {
|
|
121
138
|
http_request: {
|
|
122
139
|
client_ip?: string;
|
|
@@ -132,3 +149,11 @@ export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
|
132
149
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
133
150
|
export type ModelType = (typeof modelsList)[number];
|
|
134
151
|
export type UserRoleType = (typeof userRoles)[number];
|
|
152
|
+
|
|
153
|
+
export enum FileType {
|
|
154
|
+
PDF = 'application/pdf',
|
|
155
|
+
WORD = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
156
|
+
PPTX = 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
157
|
+
XLSX = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
158
|
+
HTML = 'text/html',
|
|
159
|
+
}
|