chatifai 1.0.13 → 1.0.14
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 -0
- package/dist/index.js +30 -1
- package/dist/types.d.ts +64 -0
- package/dist/types.js +26 -3
- package/index.ts +33 -0
- package/package.json +1 -1
- package/types.ts +31 -5
package/dist/index.d.ts
CHANGED
|
@@ -239,6 +239,10 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
239
239
|
first_name?: string | null | undefined;
|
|
240
240
|
last_name?: string | null | undefined;
|
|
241
241
|
} | null | undefined;
|
|
242
|
+
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;
|
|
242
246
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
243
247
|
createdAt: NativeDate;
|
|
244
248
|
updatedAt: NativeDate;
|
|
@@ -260,6 +264,10 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
260
264
|
first_name?: string | null | undefined;
|
|
261
265
|
last_name?: string | null | undefined;
|
|
262
266
|
} | null | undefined;
|
|
267
|
+
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;
|
|
263
271
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
264
272
|
createdAt: NativeDate;
|
|
265
273
|
updatedAt: NativeDate;
|
|
@@ -281,6 +289,67 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
281
289
|
first_name?: string | null | undefined;
|
|
282
290
|
last_name?: string | null | undefined;
|
|
283
291
|
} | null | undefined;
|
|
292
|
+
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
|
+
}> & {
|
|
297
|
+
_id: import("mongoose").Types.ObjectId;
|
|
298
|
+
} & {
|
|
299
|
+
__v: number;
|
|
300
|
+
}>;
|
|
301
|
+
export declare const ChunkSchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
302
|
+
versionKey: false;
|
|
303
|
+
toJSON: {
|
|
304
|
+
virtuals: true;
|
|
305
|
+
};
|
|
306
|
+
toObject: {
|
|
307
|
+
virtuals: true;
|
|
308
|
+
};
|
|
309
|
+
timestamps: true;
|
|
310
|
+
id: true;
|
|
311
|
+
}, {
|
|
312
|
+
createdAt: NativeDate;
|
|
313
|
+
updatedAt: NativeDate;
|
|
314
|
+
} & {
|
|
315
|
+
embedding: number[];
|
|
316
|
+
created_at?: number | null | undefined;
|
|
317
|
+
metadata?: {
|
|
318
|
+
organization_id: string;
|
|
319
|
+
file_id: string;
|
|
320
|
+
context_id: string;
|
|
321
|
+
chunk_index: number;
|
|
322
|
+
text_preview: string;
|
|
323
|
+
page_number?: number | null | undefined;
|
|
324
|
+
} | null | undefined;
|
|
325
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
326
|
+
createdAt: NativeDate;
|
|
327
|
+
updatedAt: NativeDate;
|
|
328
|
+
} & {
|
|
329
|
+
embedding: number[];
|
|
330
|
+
created_at?: number | null | undefined;
|
|
331
|
+
metadata?: {
|
|
332
|
+
organization_id: string;
|
|
333
|
+
file_id: string;
|
|
334
|
+
context_id: string;
|
|
335
|
+
chunk_index: number;
|
|
336
|
+
text_preview: string;
|
|
337
|
+
page_number?: number | null | undefined;
|
|
338
|
+
} | null | undefined;
|
|
339
|
+
}>, {}> & import("mongoose").FlatRecord<{
|
|
340
|
+
createdAt: NativeDate;
|
|
341
|
+
updatedAt: NativeDate;
|
|
342
|
+
} & {
|
|
343
|
+
embedding: number[];
|
|
344
|
+
created_at?: number | null | undefined;
|
|
345
|
+
metadata?: {
|
|
346
|
+
organization_id: string;
|
|
347
|
+
file_id: string;
|
|
348
|
+
context_id: string;
|
|
349
|
+
chunk_index: number;
|
|
350
|
+
text_preview: string;
|
|
351
|
+
page_number?: number | null | undefined;
|
|
352
|
+
} | null | undefined;
|
|
284
353
|
}> & {
|
|
285
354
|
_id: import("mongoose").Types.ObjectId;
|
|
286
355
|
} & {
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.QuerySchema = exports.ContextSchema = exports.AgentSchema = exports.UserSchema = exports.OrganizationSchema = void 0;
|
|
17
|
+
exports.QuerySchema = exports.ChunkSchema = exports.ContextSchema = exports.AgentSchema = exports.UserSchema = exports.OrganizationSchema = void 0;
|
|
18
18
|
// Export types for consumers
|
|
19
19
|
__exportStar(require("./types"), exports);
|
|
20
20
|
const mongoose_1 = require("mongoose");
|
|
@@ -96,6 +96,16 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
96
96
|
last_name: { type: String },
|
|
97
97
|
email: { type: String },
|
|
98
98
|
},
|
|
99
|
+
bucket_name: { type: String },
|
|
100
|
+
file_name: { type: String },
|
|
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
|
+
},
|
|
99
109
|
created_at: { type: Number },
|
|
100
110
|
updated_at: { type: Number },
|
|
101
111
|
}, {
|
|
@@ -106,6 +116,25 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
106
116
|
id: true,
|
|
107
117
|
// encryptionType: 'csfle',
|
|
108
118
|
});
|
|
119
|
+
exports.ChunkSchema = new mongoose_1.Schema({
|
|
120
|
+
embedding: { type: [Number], required: true },
|
|
121
|
+
metadata: {
|
|
122
|
+
organization_id: { type: String, required: true },
|
|
123
|
+
context_id: { type: String, required: true },
|
|
124
|
+
file_id: { type: String, required: true },
|
|
125
|
+
page_number: { type: Number },
|
|
126
|
+
chunk_index: { type: Number, required: true },
|
|
127
|
+
text_preview: { type: String, required: true },
|
|
128
|
+
},
|
|
129
|
+
created_at: { type: Number },
|
|
130
|
+
}, {
|
|
131
|
+
versionKey: false,
|
|
132
|
+
toJSON: { virtuals: true },
|
|
133
|
+
toObject: { virtuals: true },
|
|
134
|
+
timestamps: true,
|
|
135
|
+
id: true,
|
|
136
|
+
// encryptionType: 'csfle',
|
|
137
|
+
});
|
|
109
138
|
exports.QuerySchema = new mongoose_1.Schema({
|
|
110
139
|
organization_id: { type: String },
|
|
111
140
|
title: { type: String, minlength: 1, maxlength: 100 },
|
package/dist/types.d.ts
CHANGED
|
@@ -108,6 +108,10 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
108
108
|
first_name?: string | undefined;
|
|
109
109
|
last_name?: string | undefined;
|
|
110
110
|
}>>;
|
|
111
|
+
bucket_name: z.ZodOptional<z.ZodString>;
|
|
112
|
+
file_name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
ocr_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
114
|
+
vector_index_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
111
115
|
}, "strip", z.ZodTypeAny, {
|
|
112
116
|
title: string;
|
|
113
117
|
_id?: string | undefined;
|
|
@@ -127,6 +131,10 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
127
131
|
first_name?: string | undefined;
|
|
128
132
|
last_name?: string | undefined;
|
|
129
133
|
} | undefined;
|
|
134
|
+
bucket_name?: string | undefined;
|
|
135
|
+
file_name?: string | undefined;
|
|
136
|
+
ocr_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
137
|
+
vector_index_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
130
138
|
}, {
|
|
131
139
|
title: string;
|
|
132
140
|
_id?: string | undefined;
|
|
@@ -146,6 +154,61 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
146
154
|
first_name?: string | undefined;
|
|
147
155
|
last_name?: string | undefined;
|
|
148
156
|
} | undefined;
|
|
157
|
+
bucket_name?: string | undefined;
|
|
158
|
+
file_name?: string | undefined;
|
|
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;
|
|
149
212
|
}>;
|
|
150
213
|
export declare const zodAgentSchema: z.ZodObject<{
|
|
151
214
|
_id: z.ZodOptional<z.ZodString>;
|
|
@@ -231,6 +294,7 @@ export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
|
|
|
231
294
|
export type UserType = z.infer<typeof zodUserSchema>;
|
|
232
295
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
233
296
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
297
|
+
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
234
298
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
235
299
|
export type ModelType = (typeof modelsList)[number];
|
|
236
300
|
export type UserRoleType = (typeof userRoles)[number];
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.zodQuerySchema = exports.zodAgentSchema = exports.zodContextSchema = exports.zodUserSchema = exports.zodOrganizationSchema = exports.userRoles = exports.modelsList = void 0;
|
|
3
|
+
exports.zodQuerySchema = exports.zodAgentSchema = exports.zodChunkSchema = 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',
|
|
@@ -55,11 +55,34 @@ exports.zodContextSchema = zod_1.z.object({
|
|
|
55
55
|
is_active: zod_1.z.boolean().default(true).optional(),
|
|
56
56
|
created_at: zod_1.z.number().optional(),
|
|
57
57
|
updated_at: zod_1.z.number().optional(),
|
|
58
|
-
uploaded_by: zod_1.z
|
|
58
|
+
uploaded_by: zod_1.z
|
|
59
|
+
.object({
|
|
59
60
|
first_name: zod_1.z.string().optional(),
|
|
60
61
|
last_name: zod_1.z.string().optional(),
|
|
61
62
|
email: zod_1.z.string().email().optional(),
|
|
62
|
-
})
|
|
63
|
+
})
|
|
64
|
+
.optional(),
|
|
65
|
+
bucket_name: zod_1.z.string().optional(),
|
|
66
|
+
file_name: zod_1.z.string().optional(),
|
|
67
|
+
ocr_status: zod_1.z
|
|
68
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
69
|
+
.optional(),
|
|
70
|
+
vector_index_status: zod_1.z
|
|
71
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
+
.optional(),
|
|
73
|
+
});
|
|
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(),
|
|
63
86
|
});
|
|
64
87
|
exports.zodAgentSchema = zod_1.z.object({
|
|
65
88
|
_id: zod_1.z.string().optional(),
|
package/index.ts
CHANGED
|
@@ -94,6 +94,16 @@ export const ContextSchema = new Schema(
|
|
|
94
94
|
last_name: { type: String },
|
|
95
95
|
email: { type: String },
|
|
96
96
|
},
|
|
97
|
+
bucket_name: { type: String },
|
|
98
|
+
file_name: { type: String },
|
|
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
|
+
},
|
|
97
107
|
created_at: { type: Number },
|
|
98
108
|
updated_at: { type: Number },
|
|
99
109
|
},
|
|
@@ -107,6 +117,29 @@ export const ContextSchema = new Schema(
|
|
|
107
117
|
}
|
|
108
118
|
);
|
|
109
119
|
|
|
120
|
+
export const ChunkSchema = new Schema(
|
|
121
|
+
{
|
|
122
|
+
embedding: { type: [Number], required: true },
|
|
123
|
+
metadata: {
|
|
124
|
+
organization_id: { type: String, required: true },
|
|
125
|
+
context_id: { type: String, required: true },
|
|
126
|
+
file_id: { type: String, required: true },
|
|
127
|
+
page_number: { type: Number },
|
|
128
|
+
chunk_index: { type: Number, required: true },
|
|
129
|
+
text_preview: { type: String, required: true },
|
|
130
|
+
},
|
|
131
|
+
created_at: { type: Number },
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
versionKey: false,
|
|
135
|
+
toJSON: { virtuals: true },
|
|
136
|
+
toObject: { virtuals: true },
|
|
137
|
+
timestamps: true,
|
|
138
|
+
id: true,
|
|
139
|
+
// encryptionType: 'csfle',
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
110
143
|
export const QuerySchema = new Schema(
|
|
111
144
|
{
|
|
112
145
|
organization_id: { type: String },
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -57,11 +57,36 @@ export const zodContextSchema = z.object({
|
|
|
57
57
|
is_active: z.boolean().default(true).optional(),
|
|
58
58
|
created_at: z.number().optional(),
|
|
59
59
|
updated_at: z.number().optional(),
|
|
60
|
-
uploaded_by: z
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
uploaded_by: z
|
|
61
|
+
.object({
|
|
62
|
+
first_name: z.string().optional(),
|
|
63
|
+
last_name: z.string().optional(),
|
|
64
|
+
email: z.string().email().optional(),
|
|
65
|
+
})
|
|
66
|
+
.optional(),
|
|
67
|
+
|
|
68
|
+
bucket_name: z.string().optional(),
|
|
69
|
+
file_name: z.string().optional(),
|
|
70
|
+
ocr_status: z
|
|
71
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
+
.optional(),
|
|
73
|
+
vector_index_status: z
|
|
74
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
75
|
+
.optional(),
|
|
76
|
+
});
|
|
77
|
+
|
|
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(),
|
|
65
90
|
});
|
|
66
91
|
|
|
67
92
|
export const zodAgentSchema = z.object({
|
|
@@ -103,6 +128,7 @@ export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
|
|
|
103
128
|
export type UserType = z.infer<typeof zodUserSchema>;
|
|
104
129
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
105
130
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
131
|
+
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
106
132
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
107
133
|
export type ModelType = (typeof modelsList)[number];
|
|
108
134
|
export type UserRoleType = (typeof userRoles)[number];
|