chatifai 1.0.21 → 1.0.23
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 +1 -4
- package/dist/index.js +6 -6
- package/dist/types.d.ts +61 -45
- package/dist/types.js +25 -17
- package/index.ts +5 -5
- package/package.json +1 -1
- package/types.ts +30 -23
package/dist/index.d.ts
CHANGED
|
@@ -168,7 +168,6 @@ export declare const AgentSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
168
168
|
description?: string | null | undefined;
|
|
169
169
|
instructions?: string | null | undefined;
|
|
170
170
|
temperature?: number | null | undefined;
|
|
171
|
-
max_tokens?: number | null | undefined;
|
|
172
171
|
elevenlabs_voice_id?: string | null | undefined;
|
|
173
172
|
message_count_limit?: number | null | undefined;
|
|
174
173
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
@@ -184,7 +183,6 @@ export declare const AgentSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
184
183
|
description?: string | null | undefined;
|
|
185
184
|
instructions?: string | null | undefined;
|
|
186
185
|
temperature?: number | null | undefined;
|
|
187
|
-
max_tokens?: number | null | undefined;
|
|
188
186
|
elevenlabs_voice_id?: string | null | undefined;
|
|
189
187
|
message_count_limit?: number | null | undefined;
|
|
190
188
|
}>, {}> & import("mongoose").FlatRecord<{
|
|
@@ -200,7 +198,6 @@ export declare const AgentSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
200
198
|
description?: string | null | undefined;
|
|
201
199
|
instructions?: string | null | undefined;
|
|
202
200
|
temperature?: number | null | undefined;
|
|
203
|
-
max_tokens?: number | null | undefined;
|
|
204
201
|
elevenlabs_voice_id?: string | null | undefined;
|
|
205
202
|
message_count_limit?: number | null | undefined;
|
|
206
203
|
}> & {
|
|
@@ -397,7 +394,7 @@ export declare const ChunkSchema: Schema<any, import("mongoose").Model<any, any,
|
|
|
397
394
|
} & {
|
|
398
395
|
__v: number;
|
|
399
396
|
}>;
|
|
400
|
-
export declare const
|
|
397
|
+
export declare const PreDefinedQuerySchema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
401
398
|
versionKey: false;
|
|
402
399
|
toJSON: {
|
|
403
400
|
virtuals: true;
|
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.FullFileTextSchema = exports.
|
|
17
|
+
exports.FullFileTextSchema = exports.PreDefinedQuerySchema = 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");
|
|
@@ -62,14 +62,14 @@ exports.UserSchema = new mongoose_1.Schema({
|
|
|
62
62
|
exports.AgentSchema = new mongoose_1.Schema({
|
|
63
63
|
organization_id: { type: String },
|
|
64
64
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
65
|
-
description: { type: String
|
|
65
|
+
description: { type: String },
|
|
66
66
|
instructions: { type: String, minlength: 1, maxlength: 1000 },
|
|
67
67
|
model: { type: String, enum: types_1.modelsList, required: true },
|
|
68
68
|
temperature: { type: Number, min: 0, max: 1 },
|
|
69
|
-
max_tokens: { type: Number, min: 1, max: 4000 },
|
|
70
|
-
elevenlabs_voice_id: { type: String
|
|
69
|
+
// max_tokens: { type: Number, min: 1, max: 4000 },
|
|
70
|
+
elevenlabs_voice_id: { type: String },
|
|
71
71
|
message_count_limit: { type: Number, min: 1 },
|
|
72
|
-
is_editable: { type: Boolean, default:
|
|
72
|
+
is_editable: { type: Boolean, default: false },
|
|
73
73
|
created_at: { type: Number },
|
|
74
74
|
updated_at: { type: Number },
|
|
75
75
|
}, {
|
|
@@ -143,7 +143,7 @@ exports.ChunkSchema = new mongoose_1.Schema({
|
|
|
143
143
|
id: true,
|
|
144
144
|
// encryptionType: 'csfle',
|
|
145
145
|
});
|
|
146
|
-
exports.
|
|
146
|
+
exports.PreDefinedQuerySchema = new mongoose_1.Schema({
|
|
147
147
|
organization_id: { type: String },
|
|
148
148
|
title: { type: String, minlength: 1, maxlength: 100 },
|
|
149
149
|
query: { type: String, required: true },
|
package/dist/types.d.ts
CHANGED
|
@@ -164,75 +164,41 @@ export declare const zodAgentSchema: z.ZodObject<{
|
|
|
164
164
|
organization_id: z.ZodOptional<z.ZodString>;
|
|
165
165
|
title: z.ZodString;
|
|
166
166
|
description: z.ZodOptional<z.ZodString>;
|
|
167
|
-
instructions: z.
|
|
167
|
+
instructions: z.ZodString;
|
|
168
168
|
model: z.ZodEnum<["gemini-2.5-flash-lite", "gemini-2.5-flash", "gemini-2.5-pro", "grok-4-fast-non-reasoning", "grok-4-fast-reasoning", "gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano"]>;
|
|
169
169
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
170
|
-
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
171
170
|
elevenlabs_voice_id: z.ZodOptional<z.ZodString>;
|
|
172
171
|
message_count_limit: z.ZodOptional<z.ZodNumber>;
|
|
173
|
-
is_editable: z.ZodOptional<z.
|
|
172
|
+
is_editable: z.ZodOptional<z.ZodBoolean>;
|
|
174
173
|
created_at: z.ZodOptional<z.ZodNumber>;
|
|
175
174
|
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
176
175
|
}, "strip", z.ZodTypeAny, {
|
|
177
176
|
title: string;
|
|
177
|
+
instructions: string;
|
|
178
178
|
model: "gemini-2.5-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro" | "grok-4-fast-non-reasoning" | "grok-4-fast-reasoning" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
|
|
179
179
|
_id?: string | undefined;
|
|
180
180
|
created_at?: number | undefined;
|
|
181
181
|
updated_at?: number | undefined;
|
|
182
182
|
organization_id?: string | undefined;
|
|
183
183
|
description?: string | undefined;
|
|
184
|
-
instructions?: string | undefined;
|
|
185
184
|
temperature?: number | undefined;
|
|
186
|
-
max_tokens?: number | undefined;
|
|
187
185
|
elevenlabs_voice_id?: string | undefined;
|
|
188
186
|
message_count_limit?: number | undefined;
|
|
189
187
|
is_editable?: boolean | undefined;
|
|
190
188
|
}, {
|
|
191
189
|
title: string;
|
|
190
|
+
instructions: string;
|
|
192
191
|
model: "gemini-2.5-flash-lite" | "gemini-2.5-flash" | "gemini-2.5-pro" | "grok-4-fast-non-reasoning" | "grok-4-fast-reasoning" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano";
|
|
193
192
|
_id?: string | undefined;
|
|
194
193
|
created_at?: number | undefined;
|
|
195
194
|
updated_at?: number | undefined;
|
|
196
195
|
organization_id?: string | undefined;
|
|
197
196
|
description?: string | undefined;
|
|
198
|
-
instructions?: string | undefined;
|
|
199
197
|
temperature?: number | undefined;
|
|
200
|
-
max_tokens?: number | undefined;
|
|
201
198
|
elevenlabs_voice_id?: string | undefined;
|
|
202
199
|
message_count_limit?: number | undefined;
|
|
203
200
|
is_editable?: boolean | undefined;
|
|
204
201
|
}>;
|
|
205
|
-
export declare const zodQuerySchema: z.ZodObject<{
|
|
206
|
-
_id: z.ZodOptional<z.ZodString>;
|
|
207
|
-
organization_id: z.ZodOptional<z.ZodString>;
|
|
208
|
-
title: z.ZodOptional<z.ZodString>;
|
|
209
|
-
query: z.ZodString;
|
|
210
|
-
context_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
211
|
-
status: z.ZodDefault<z.ZodEnum<["active", "inactive", "archived"]>>;
|
|
212
|
-
users_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
213
|
-
created_at: z.ZodOptional<z.ZodNumber>;
|
|
214
|
-
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
215
|
-
}, "strip", z.ZodTypeAny, {
|
|
216
|
-
status: "active" | "inactive" | "archived";
|
|
217
|
-
query: string;
|
|
218
|
-
_id?: string | undefined;
|
|
219
|
-
title?: string | undefined;
|
|
220
|
-
created_at?: number | undefined;
|
|
221
|
-
updated_at?: number | undefined;
|
|
222
|
-
organization_id?: string | undefined;
|
|
223
|
-
context_ids?: string[] | undefined;
|
|
224
|
-
users_ids?: string[] | undefined;
|
|
225
|
-
}, {
|
|
226
|
-
query: string;
|
|
227
|
-
_id?: string | undefined;
|
|
228
|
-
title?: string | undefined;
|
|
229
|
-
status?: "active" | "inactive" | "archived" | undefined;
|
|
230
|
-
created_at?: number | undefined;
|
|
231
|
-
updated_at?: number | undefined;
|
|
232
|
-
organization_id?: string | undefined;
|
|
233
|
-
context_ids?: string[] | undefined;
|
|
234
|
-
users_ids?: string[] | undefined;
|
|
235
|
-
}>;
|
|
236
202
|
export declare const zodChunkSchema: z.ZodObject<{
|
|
237
203
|
_id: z.ZodOptional<z.ZodString>;
|
|
238
204
|
chunk_id: z.ZodOptional<z.ZodString>;
|
|
@@ -346,6 +312,59 @@ export declare const zodFullTextSchema: z.ZodObject<{
|
|
|
346
312
|
full_text: string;
|
|
347
313
|
_id?: string | undefined;
|
|
348
314
|
}>;
|
|
315
|
+
export declare const zodPreDefinedQuerySchema: z.ZodObject<{
|
|
316
|
+
_id: z.ZodOptional<z.ZodString>;
|
|
317
|
+
organization_id: z.ZodOptional<z.ZodString>;
|
|
318
|
+
title: z.ZodOptional<z.ZodString>;
|
|
319
|
+
query: z.ZodString;
|
|
320
|
+
context_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
321
|
+
status: z.ZodDefault<z.ZodEnum<["active", "inactive", "archived"]>>;
|
|
322
|
+
users_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
323
|
+
created_at: z.ZodOptional<z.ZodNumber>;
|
|
324
|
+
updated_at: z.ZodOptional<z.ZodNumber>;
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
326
|
+
status: "active" | "inactive" | "archived";
|
|
327
|
+
query: string;
|
|
328
|
+
_id?: string | undefined;
|
|
329
|
+
title?: string | undefined;
|
|
330
|
+
created_at?: number | undefined;
|
|
331
|
+
updated_at?: number | undefined;
|
|
332
|
+
organization_id?: string | undefined;
|
|
333
|
+
context_ids?: string[] | undefined;
|
|
334
|
+
users_ids?: string[] | undefined;
|
|
335
|
+
}, {
|
|
336
|
+
query: string;
|
|
337
|
+
_id?: string | undefined;
|
|
338
|
+
title?: string | undefined;
|
|
339
|
+
status?: "active" | "inactive" | "archived" | undefined;
|
|
340
|
+
created_at?: number | undefined;
|
|
341
|
+
updated_at?: number | undefined;
|
|
342
|
+
organization_id?: string | undefined;
|
|
343
|
+
context_ids?: string[] | undefined;
|
|
344
|
+
users_ids?: string[] | undefined;
|
|
345
|
+
}>;
|
|
346
|
+
export declare const zodQuerySchema: z.ZodObject<{
|
|
347
|
+
thread_id: z.ZodOptional<z.ZodString>;
|
|
348
|
+
context_ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
349
|
+
organization_id: z.ZodString;
|
|
350
|
+
user_id: z.ZodString;
|
|
351
|
+
query: z.ZodString;
|
|
352
|
+
timestamp: z.ZodNumber;
|
|
353
|
+
}, "strip", z.ZodTypeAny, {
|
|
354
|
+
organization_id: string;
|
|
355
|
+
query: string;
|
|
356
|
+
user_id: string;
|
|
357
|
+
timestamp: number;
|
|
358
|
+
context_ids?: string[] | undefined;
|
|
359
|
+
thread_id?: string | undefined;
|
|
360
|
+
}, {
|
|
361
|
+
organization_id: string;
|
|
362
|
+
query: string;
|
|
363
|
+
user_id: string;
|
|
364
|
+
timestamp: number;
|
|
365
|
+
context_ids?: string[] | undefined;
|
|
366
|
+
thread_id?: string | undefined;
|
|
367
|
+
}>;
|
|
349
368
|
export type EventAttributeType = {
|
|
350
369
|
http_request: {
|
|
351
370
|
client_ip?: string;
|
|
@@ -353,12 +372,8 @@ export type EventAttributeType = {
|
|
|
353
372
|
};
|
|
354
373
|
};
|
|
355
374
|
/**
|
|
356
|
-
*
|
|
357
|
-
|
|
358
|
-
organization_id: context.organization_id,
|
|
359
|
-
data: context,
|
|
360
|
-
timestamp: Date.now(),
|
|
361
|
-
},
|
|
375
|
+
* Used for queue message bodies
|
|
376
|
+
* Used in context processing queue
|
|
362
377
|
*/
|
|
363
378
|
export type QueueMessageBodyType<T> = {
|
|
364
379
|
organization_id: string;
|
|
@@ -370,10 +385,11 @@ export type UserType = z.infer<typeof zodUserSchema>;
|
|
|
370
385
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
371
386
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
372
387
|
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
373
|
-
export type
|
|
388
|
+
export type PreDefinedQueryType = z.infer<typeof zodPreDefinedQuerySchema>;
|
|
374
389
|
export type ModelType = (typeof modelsList)[number];
|
|
375
390
|
export type UserRoleType = (typeof userRoles)[number];
|
|
376
391
|
export type FullFileTextType = z.infer<typeof zodFullTextSchema>;
|
|
392
|
+
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
377
393
|
export declare enum FileType {
|
|
378
394
|
PDF = "application/pdf",
|
|
379
395
|
WORD = "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QueuesList = exports.FileType = exports.
|
|
3
|
+
exports.QueuesList = exports.FileType = exports.zodQuerySchema = exports.zodPreDefinedQuerySchema = exports.zodFullTextSchema = exports.zodChunkSchema = 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',
|
|
@@ -73,25 +73,14 @@ exports.zodAgentSchema = zod_1.z.object({
|
|
|
73
73
|
_id: zod_1.z.string().optional(),
|
|
74
74
|
organization_id: zod_1.z.string().optional(),
|
|
75
75
|
title: zod_1.z.string().min(1).max(100),
|
|
76
|
-
description: zod_1.z.string().
|
|
77
|
-
instructions: zod_1.z.string().min(1).max(1000)
|
|
76
|
+
description: zod_1.z.string().optional(),
|
|
77
|
+
instructions: zod_1.z.string().min(1).max(1000),
|
|
78
78
|
model: zod_1.z.enum(exports.modelsList),
|
|
79
79
|
temperature: zod_1.z.number().min(0).max(1).optional(),
|
|
80
|
-
max_tokens:
|
|
81
|
-
elevenlabs_voice_id: zod_1.z.string().
|
|
80
|
+
// max_tokens: z.number().min(1).max(4000).optional(),
|
|
81
|
+
elevenlabs_voice_id: zod_1.z.string().optional(),
|
|
82
82
|
message_count_limit: zod_1.z.number().min(1).optional(),
|
|
83
|
-
is_editable: zod_1.z.boolean().
|
|
84
|
-
created_at: zod_1.z.number().optional(),
|
|
85
|
-
updated_at: zod_1.z.number().optional(),
|
|
86
|
-
});
|
|
87
|
-
exports.zodQuerySchema = zod_1.z.object({
|
|
88
|
-
_id: zod_1.z.string().optional(),
|
|
89
|
-
organization_id: zod_1.z.string().optional(),
|
|
90
|
-
title: zod_1.z.string().min(1).max(100).optional(),
|
|
91
|
-
query: zod_1.z.string().min(1),
|
|
92
|
-
context_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
93
|
-
status: zod_1.z.enum(['active', 'inactive', 'archived']).default('active'),
|
|
94
|
-
users_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
83
|
+
is_editable: zod_1.z.boolean().optional(),
|
|
95
84
|
created_at: zod_1.z.number().optional(),
|
|
96
85
|
updated_at: zod_1.z.number().optional(),
|
|
97
86
|
});
|
|
@@ -128,6 +117,25 @@ exports.zodFullTextSchema = zod_1.z.object({
|
|
|
128
117
|
context_id: zod_1.z.string(),
|
|
129
118
|
full_text: zod_1.z.string(),
|
|
130
119
|
});
|
|
120
|
+
exports.zodPreDefinedQuerySchema = zod_1.z.object({
|
|
121
|
+
_id: zod_1.z.string().optional(),
|
|
122
|
+
organization_id: zod_1.z.string().optional(),
|
|
123
|
+
title: zod_1.z.string().min(1).max(100).optional(),
|
|
124
|
+
query: zod_1.z.string().min(1),
|
|
125
|
+
context_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
126
|
+
status: zod_1.z.enum(['active', 'inactive', 'archived']).default('active'),
|
|
127
|
+
users_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
128
|
+
created_at: zod_1.z.number().optional(),
|
|
129
|
+
updated_at: zod_1.z.number().optional(),
|
|
130
|
+
});
|
|
131
|
+
exports.zodQuerySchema = zod_1.z.object({
|
|
132
|
+
thread_id: zod_1.z.string().optional(),
|
|
133
|
+
context_ids: zod_1.z.array(zod_1.z.string()).optional(),
|
|
134
|
+
organization_id: zod_1.z.string(),
|
|
135
|
+
user_id: zod_1.z.string(),
|
|
136
|
+
query: zod_1.z.string().min(1),
|
|
137
|
+
timestamp: zod_1.z.number(),
|
|
138
|
+
});
|
|
131
139
|
var FileType;
|
|
132
140
|
(function (FileType) {
|
|
133
141
|
FileType["PDF"] = "application/pdf";
|
package/index.ts
CHANGED
|
@@ -56,14 +56,14 @@ export const AgentSchema = new Schema(
|
|
|
56
56
|
{
|
|
57
57
|
organization_id: { type: String },
|
|
58
58
|
title: { type: String, required: true, minlength: 1, maxlength: 100 },
|
|
59
|
-
description: { type: String
|
|
59
|
+
description: { type: String },
|
|
60
60
|
instructions: { type: String, minlength: 1, maxlength: 1000 },
|
|
61
61
|
model: { type: String, enum: modelsList, required: true },
|
|
62
62
|
temperature: { type: Number, min: 0, max: 1 },
|
|
63
|
-
max_tokens: { type: Number, min: 1, max: 4000 },
|
|
64
|
-
elevenlabs_voice_id: { type: String
|
|
63
|
+
// max_tokens: { type: Number, min: 1, max: 4000 },
|
|
64
|
+
elevenlabs_voice_id: { type: String },
|
|
65
65
|
message_count_limit: { type: Number, min: 1 },
|
|
66
|
-
is_editable: { type: Boolean, default:
|
|
66
|
+
is_editable: { type: Boolean, default: false },
|
|
67
67
|
created_at: { type: Number },
|
|
68
68
|
updated_at: { type: Number },
|
|
69
69
|
},
|
|
@@ -148,7 +148,7 @@ export const ChunkSchema = new Schema(
|
|
|
148
148
|
}
|
|
149
149
|
);
|
|
150
150
|
|
|
151
|
-
export const
|
|
151
|
+
export const PreDefinedQuerySchema = new Schema(
|
|
152
152
|
{
|
|
153
153
|
organization_id: { type: String },
|
|
154
154
|
title: { type: String, minlength: 1, maxlength: 100 },
|
package/package.json
CHANGED
package/types.ts
CHANGED
|
@@ -76,29 +76,18 @@ export const zodAgentSchema = z.object({
|
|
|
76
76
|
_id: z.string().optional(),
|
|
77
77
|
organization_id: z.string().optional(),
|
|
78
78
|
title: z.string().min(1).max(100),
|
|
79
|
-
description: z.string().
|
|
80
|
-
instructions: z.string().min(1).max(1000)
|
|
79
|
+
description: z.string().optional(),
|
|
80
|
+
instructions: z.string().min(1).max(1000),
|
|
81
81
|
model: z.enum(modelsList),
|
|
82
82
|
temperature: z.number().min(0).max(1).optional(),
|
|
83
|
-
max_tokens: z.number().min(1).max(4000).optional(),
|
|
84
|
-
elevenlabs_voice_id: z.string().
|
|
83
|
+
// max_tokens: z.number().min(1).max(4000).optional(),
|
|
84
|
+
elevenlabs_voice_id: z.string().optional(),
|
|
85
85
|
message_count_limit: z.number().min(1).optional(),
|
|
86
|
-
is_editable: z.boolean().
|
|
86
|
+
is_editable: z.boolean().optional(),
|
|
87
87
|
created_at: z.number().optional(),
|
|
88
88
|
updated_at: z.number().optional(),
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
-
export const zodQuerySchema = z.object({
|
|
92
|
-
_id: z.string().optional(),
|
|
93
|
-
organization_id: z.string().optional(),
|
|
94
|
-
title: z.string().min(1).max(100).optional(),
|
|
95
|
-
query: z.string().min(1),
|
|
96
|
-
context_ids: z.array(z.string()).optional(),
|
|
97
|
-
status: z.enum(['active', 'inactive', 'archived']).default('active'),
|
|
98
|
-
users_ids: z.array(z.string()).optional(),
|
|
99
|
-
created_at: z.number().optional(),
|
|
100
|
-
updated_at: z.number().optional(),
|
|
101
|
-
});
|
|
102
91
|
|
|
103
92
|
export const zodChunkSchema = z.object({
|
|
104
93
|
_id: z.string().optional(),
|
|
@@ -135,6 +124,27 @@ export const zodFullTextSchema = z.object({
|
|
|
135
124
|
full_text: z.string(),
|
|
136
125
|
});
|
|
137
126
|
|
|
127
|
+
export const zodPreDefinedQuerySchema = z.object({
|
|
128
|
+
_id: z.string().optional(),
|
|
129
|
+
organization_id: z.string().optional(),
|
|
130
|
+
title: z.string().min(1).max(100).optional(),
|
|
131
|
+
query: z.string().min(1),
|
|
132
|
+
context_ids: z.array(z.string()).optional(),
|
|
133
|
+
status: z.enum(['active', 'inactive', 'archived']).default('active'),
|
|
134
|
+
users_ids: z.array(z.string()).optional(),
|
|
135
|
+
created_at: z.number().optional(),
|
|
136
|
+
updated_at: z.number().optional(),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export const zodQuerySchema = z.object({
|
|
140
|
+
thread_id: z.string().optional(), // If there is not thread id provided, a new thread will be created
|
|
141
|
+
context_ids: z.array(z.string()).optional(), // Run on all organization files unless specific file ids are provided
|
|
142
|
+
organization_id: z.string(), // Will be used to fetch the agent, contexts, chunks, etc.
|
|
143
|
+
user_id: z.string(),
|
|
144
|
+
query: z.string().min(1),
|
|
145
|
+
timestamp: z.number(),
|
|
146
|
+
})
|
|
147
|
+
|
|
138
148
|
export type EventAttributeType = {
|
|
139
149
|
http_request: {
|
|
140
150
|
client_ip?: string;
|
|
@@ -143,12 +153,8 @@ export type EventAttributeType = {
|
|
|
143
153
|
};
|
|
144
154
|
|
|
145
155
|
/**
|
|
146
|
-
*
|
|
147
|
-
|
|
148
|
-
organization_id: context.organization_id,
|
|
149
|
-
data: context,
|
|
150
|
-
timestamp: Date.now(),
|
|
151
|
-
},
|
|
156
|
+
* Used for queue message bodies
|
|
157
|
+
* Used in context processing queue
|
|
152
158
|
*/
|
|
153
159
|
export type QueueMessageBodyType<T> = {
|
|
154
160
|
organization_id: string;
|
|
@@ -161,10 +167,11 @@ export type UserType = z.infer<typeof zodUserSchema>;
|
|
|
161
167
|
export type AgentType = z.infer<typeof zodAgentSchema>;
|
|
162
168
|
export type ContextType = z.infer<typeof zodContextSchema>;
|
|
163
169
|
export type ChunkType = z.infer<typeof zodChunkSchema>;
|
|
164
|
-
export type
|
|
170
|
+
export type PreDefinedQueryType = z.infer<typeof zodPreDefinedQuerySchema>;
|
|
165
171
|
export type ModelType = (typeof modelsList)[number];
|
|
166
172
|
export type UserRoleType = (typeof userRoles)[number];
|
|
167
173
|
export type FullFileTextType = z.infer<typeof zodFullTextSchema>;
|
|
174
|
+
export type QueryType = z.infer<typeof zodQuerySchema>;
|
|
168
175
|
|
|
169
176
|
export enum FileType {
|
|
170
177
|
PDF = 'application/pdf',
|