chatifai 1.0.13 → 1.0.15
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 +24 -1
- package/dist/types.d.ts +64 -0
- package/dist/types.js +24 -3
- package/index.ts +27 -0
- package/package.json +1 -1
- package/types.ts +28 -5
package/dist/index.d.ts
CHANGED
|
@@ -224,6 +224,7 @@ 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;
|
|
@@ -232,6 +233,8 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
232
233
|
description?: string | null | undefined;
|
|
233
234
|
note?: 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?: {
|
|
@@ -239,12 +242,14 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
239
242
|
first_name?: string | null | undefined;
|
|
240
243
|
last_name?: string | null | undefined;
|
|
241
244
|
} | null | undefined;
|
|
245
|
+
bucket_name?: string | null | undefined;
|
|
242
246
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
243
247
|
createdAt: NativeDate;
|
|
244
248
|
updatedAt: NativeDate;
|
|
245
249
|
} & {
|
|
246
250
|
title: string;
|
|
247
251
|
is_active: boolean;
|
|
252
|
+
processing_status: "pending" | "processing" | "completed" | "failed";
|
|
248
253
|
type?: string | null | undefined;
|
|
249
254
|
created_at?: number | null | undefined;
|
|
250
255
|
updated_at?: number | null | undefined;
|
|
@@ -253,6 +258,8 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
253
258
|
description?: string | null | undefined;
|
|
254
259
|
note?: string | null | undefined;
|
|
255
260
|
file_url?: string | null | undefined;
|
|
261
|
+
file_gcs_url?: string | null | undefined;
|
|
262
|
+
file_name?: string | null | undefined;
|
|
256
263
|
size?: number | null | undefined;
|
|
257
264
|
tokens?: number | null | undefined;
|
|
258
265
|
uploaded_by?: {
|
|
@@ -260,12 +267,14 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
260
267
|
first_name?: string | null | undefined;
|
|
261
268
|
last_name?: string | null | undefined;
|
|
262
269
|
} | null | undefined;
|
|
270
|
+
bucket_name?: string | null | undefined;
|
|
263
271
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
264
272
|
createdAt: NativeDate;
|
|
265
273
|
updatedAt: NativeDate;
|
|
266
274
|
} & {
|
|
267
275
|
title: string;
|
|
268
276
|
is_active: boolean;
|
|
277
|
+
processing_status: "pending" | "processing" | "completed" | "failed";
|
|
269
278
|
type?: string | null | undefined;
|
|
270
279
|
created_at?: number | null | undefined;
|
|
271
280
|
updated_at?: number | null | undefined;
|
|
@@ -274,6 +283,8 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
274
283
|
description?: string | null | undefined;
|
|
275
284
|
note?: string | null | undefined;
|
|
276
285
|
file_url?: string | null | undefined;
|
|
286
|
+
file_gcs_url?: string | null | undefined;
|
|
287
|
+
file_name?: string | null | undefined;
|
|
277
288
|
size?: number | null | undefined;
|
|
278
289
|
tokens?: number | null | undefined;
|
|
279
290
|
uploaded_by?: {
|
|
@@ -281,6 +292,64 @@ export declare const ContextSchema: Schema<any, import("mongoose").Model<any, an
|
|
|
281
292
|
first_name?: string | null | undefined;
|
|
282
293
|
last_name?: string | null | undefined;
|
|
283
294
|
} | null | undefined;
|
|
295
|
+
bucket_name?: string | 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");
|
|
@@ -87,6 +87,8 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
87
87
|
description: { type: String, minlength: 1, maxlength: 500 },
|
|
88
88
|
note: { type: String, maxlength: 500 },
|
|
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 },
|
|
@@ -96,6 +98,8 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
96
98
|
last_name: { type: String },
|
|
97
99
|
email: { type: String },
|
|
98
100
|
},
|
|
101
|
+
bucket_name: { type: String },
|
|
102
|
+
processing_status: { type: String, enum: ['pending', 'processing', 'completed', 'failed'], default: 'pending' },
|
|
99
103
|
created_at: { type: Number },
|
|
100
104
|
updated_at: { type: Number },
|
|
101
105
|
}, {
|
|
@@ -106,6 +110,25 @@ exports.ContextSchema = new mongoose_1.Schema({
|
|
|
106
110
|
id: true,
|
|
107
111
|
// encryptionType: 'csfle',
|
|
108
112
|
});
|
|
113
|
+
exports.ChunkSchema = new mongoose_1.Schema({
|
|
114
|
+
embedding: { type: [Number], required: true },
|
|
115
|
+
metadata: {
|
|
116
|
+
organization_id: { type: String, required: true },
|
|
117
|
+
context_id: { type: String, required: true },
|
|
118
|
+
file_id: { type: String, required: true },
|
|
119
|
+
page_number: { type: Number },
|
|
120
|
+
chunk_index: { type: Number, required: true },
|
|
121
|
+
text_preview: { type: String, required: true },
|
|
122
|
+
},
|
|
123
|
+
created_at: { type: Number },
|
|
124
|
+
}, {
|
|
125
|
+
versionKey: false,
|
|
126
|
+
toJSON: { virtuals: true },
|
|
127
|
+
toObject: { virtuals: true },
|
|
128
|
+
timestamps: true,
|
|
129
|
+
id: true,
|
|
130
|
+
// encryptionType: 'csfle',
|
|
131
|
+
});
|
|
109
132
|
exports.QuerySchema = new mongoose_1.Schema({
|
|
110
133
|
organization_id: { type: String },
|
|
111
134
|
title: { type: String, minlength: 1, maxlength: 100 },
|
package/dist/types.d.ts
CHANGED
|
@@ -89,6 +89,8 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
89
89
|
description: z.ZodOptional<z.ZodString>;
|
|
90
90
|
note: 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>;
|
|
@@ -108,6 +110,8 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
108
110
|
first_name?: string | undefined;
|
|
109
111
|
last_name?: string | undefined;
|
|
110
112
|
}>>;
|
|
113
|
+
bucket_name: z.ZodOptional<z.ZodString>;
|
|
114
|
+
processing_status: z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>;
|
|
111
115
|
}, "strip", z.ZodTypeAny, {
|
|
112
116
|
title: string;
|
|
113
117
|
_id?: string | undefined;
|
|
@@ -119,6 +123,8 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
119
123
|
description?: string | undefined;
|
|
120
124
|
note?: string | undefined;
|
|
121
125
|
file_url?: string | undefined;
|
|
126
|
+
file_gcs_url?: string | undefined;
|
|
127
|
+
file_name?: string | undefined;
|
|
122
128
|
size?: number | undefined;
|
|
123
129
|
tokens?: number | undefined;
|
|
124
130
|
is_active?: boolean | undefined;
|
|
@@ -127,6 +133,8 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
127
133
|
first_name?: string | undefined;
|
|
128
134
|
last_name?: string | undefined;
|
|
129
135
|
} | undefined;
|
|
136
|
+
bucket_name?: string | undefined;
|
|
137
|
+
processing_status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
130
138
|
}, {
|
|
131
139
|
title: string;
|
|
132
140
|
_id?: string | undefined;
|
|
@@ -138,6 +146,8 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
138
146
|
description?: string | undefined;
|
|
139
147
|
note?: string | undefined;
|
|
140
148
|
file_url?: string | undefined;
|
|
149
|
+
file_gcs_url?: string | undefined;
|
|
150
|
+
file_name?: string | undefined;
|
|
141
151
|
size?: number | undefined;
|
|
142
152
|
tokens?: number | undefined;
|
|
143
153
|
is_active?: boolean | undefined;
|
|
@@ -146,6 +156,59 @@ export declare const zodContextSchema: z.ZodObject<{
|
|
|
146
156
|
first_name?: string | undefined;
|
|
147
157
|
last_name?: string | undefined;
|
|
148
158
|
} | undefined;
|
|
159
|
+
bucket_name?: string | undefined;
|
|
160
|
+
processing_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',
|
|
@@ -49,17 +49,38 @@ exports.zodContextSchema = zod_1.z.object({
|
|
|
49
49
|
description: zod_1.z.string().min(1).max(500).optional(),
|
|
50
50
|
note: zod_1.z.string().max(500).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(),
|
|
55
57
|
is_active: zod_1.z.boolean().default(true).optional(),
|
|
56
58
|
created_at: zod_1.z.number().optional(),
|
|
57
59
|
updated_at: zod_1.z.number().optional(),
|
|
58
|
-
uploaded_by: zod_1.z
|
|
60
|
+
uploaded_by: zod_1.z
|
|
61
|
+
.object({
|
|
59
62
|
first_name: zod_1.z.string().optional(),
|
|
60
63
|
last_name: zod_1.z.string().optional(),
|
|
61
64
|
email: zod_1.z.string().email().optional(),
|
|
62
|
-
})
|
|
65
|
+
})
|
|
66
|
+
.optional(),
|
|
67
|
+
bucket_name: zod_1.z.string().optional(),
|
|
68
|
+
processing_status: zod_1.z
|
|
69
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
70
|
+
.optional(),
|
|
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(),
|
|
63
84
|
});
|
|
64
85
|
exports.zodAgentSchema = zod_1.z.object({
|
|
65
86
|
_id: zod_1.z.string().optional(),
|
package/index.ts
CHANGED
|
@@ -85,6 +85,8 @@ export const ContextSchema = new Schema(
|
|
|
85
85
|
description: { type: String, minlength: 1, maxlength: 500 },
|
|
86
86
|
note: { type: String, maxlength: 500 },
|
|
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 },
|
|
@@ -94,6 +96,8 @@ export const ContextSchema = new Schema(
|
|
|
94
96
|
last_name: { type: String },
|
|
95
97
|
email: { type: String },
|
|
96
98
|
},
|
|
99
|
+
bucket_name: { type: String },
|
|
100
|
+
processing_status: { type: String, enum: ['pending', 'processing', 'completed', 'failed'] , default: 'pending' },
|
|
97
101
|
created_at: { type: Number },
|
|
98
102
|
updated_at: { type: Number },
|
|
99
103
|
},
|
|
@@ -107,6 +111,29 @@ export const ContextSchema = new Schema(
|
|
|
107
111
|
}
|
|
108
112
|
);
|
|
109
113
|
|
|
114
|
+
export const ChunkSchema = new Schema(
|
|
115
|
+
{
|
|
116
|
+
embedding: { type: [Number], required: true },
|
|
117
|
+
metadata: {
|
|
118
|
+
organization_id: { type: String, required: true },
|
|
119
|
+
context_id: { type: String, required: true },
|
|
120
|
+
file_id: { type: String, required: true },
|
|
121
|
+
page_number: { type: Number },
|
|
122
|
+
chunk_index: { type: Number, required: true },
|
|
123
|
+
text_preview: { type: String, required: true },
|
|
124
|
+
},
|
|
125
|
+
created_at: { type: Number },
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
versionKey: false,
|
|
129
|
+
toJSON: { virtuals: true },
|
|
130
|
+
toObject: { virtuals: true },
|
|
131
|
+
timestamps: true,
|
|
132
|
+
id: true,
|
|
133
|
+
// encryptionType: 'csfle',
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
|
|
110
137
|
export const QuerySchema = new Schema(
|
|
111
138
|
{
|
|
112
139
|
organization_id: { type: String },
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -51,17 +51,39 @@ export const zodContextSchema = z.object({
|
|
|
51
51
|
description: z.string().min(1).max(500).optional(),
|
|
52
52
|
note: z.string().max(500).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(),
|
|
57
59
|
is_active: z.boolean().default(true).optional(),
|
|
58
60
|
created_at: z.number().optional(),
|
|
59
61
|
updated_at: z.number().optional(),
|
|
60
|
-
uploaded_by: z
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
uploaded_by: z
|
|
63
|
+
.object({
|
|
64
|
+
first_name: z.string().optional(),
|
|
65
|
+
last_name: z.string().optional(),
|
|
66
|
+
email: z.string().email().optional(),
|
|
67
|
+
})
|
|
68
|
+
.optional(),
|
|
69
|
+
bucket_name: z.string().optional(),
|
|
70
|
+
processing_status: z
|
|
71
|
+
.enum(['pending', 'processing', 'completed', 'failed'])
|
|
72
|
+
.optional(),
|
|
73
|
+
});
|
|
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(),
|
|
65
87
|
});
|
|
66
88
|
|
|
67
89
|
export const zodAgentSchema = z.object({
|
|
@@ -103,6 +125,7 @@ export type OrganizationType = z.infer<typeof zodOrganizationSchema>;
|
|
|
103
125
|
export type UserType = z.infer<typeof zodUserSchema>;
|
|
104
126
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
105
127
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
128
|
+
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
106
129
|
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
107
130
|
export type ModelType = (typeof modelsList)[number];
|
|
108
131
|
export type UserRoleType = (typeof userRoles)[number];
|