@common_ch/common 1.0.481 → 1.0.484
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/build/models/app/ai.d.ts
CHANGED
|
@@ -27,10 +27,6 @@ export interface AiDoc extends mongoose.Document {
|
|
|
27
27
|
}
|
|
28
28
|
interface AiModel extends mongoose.Model<AiDoc> {
|
|
29
29
|
build(attrs: AiAttrs): AiDoc;
|
|
30
|
-
findByEvent(event: {
|
|
31
|
-
id: Types.ObjectId;
|
|
32
|
-
version: number;
|
|
33
|
-
}): Promise<AiDoc | null>;
|
|
34
30
|
}
|
|
35
31
|
declare const Ai: AiModel;
|
|
36
32
|
export { Ai };
|
package/build/models/app/ai.js
CHANGED
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Ai = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
+
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
8
9
|
const ai_1 = require("../../events/types_/ai");
|
|
9
10
|
const aiSchema = new mongoose_1.default.Schema({
|
|
10
11
|
name: {
|
|
@@ -49,23 +50,11 @@ const aiSchema = new mongoose_1.default.Schema({
|
|
|
49
50
|
timestamps: true,
|
|
50
51
|
});
|
|
51
52
|
aiSchema.set('versionKey', 'version');
|
|
52
|
-
aiSchema.
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
this.$where = {
|
|
55
|
-
version: this.get('version') - 1,
|
|
56
|
-
};
|
|
57
|
-
done();
|
|
58
|
-
});
|
|
53
|
+
aiSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
|
|
59
54
|
aiSchema.index({ name: 1 });
|
|
60
55
|
aiSchema.index({ status: 1 });
|
|
61
56
|
aiSchema.statics.build = (attrs) => {
|
|
62
57
|
return new Ai(attrs);
|
|
63
58
|
};
|
|
64
|
-
aiSchema.statics.findByEvent = (event) => {
|
|
65
|
-
return Ai.findOne({
|
|
66
|
-
_id: event.id,
|
|
67
|
-
version: event.version - 1,
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
59
|
const Ai = mongoose_1.default.model('Ai', aiSchema);
|
|
71
60
|
exports.Ai = Ai;
|
|
@@ -18,12 +18,6 @@ export type ContentClaude = {
|
|
|
18
18
|
type: 'file';
|
|
19
19
|
file_id: string;
|
|
20
20
|
};
|
|
21
|
-
} | {
|
|
22
|
-
type: 'audio';
|
|
23
|
-
source: {
|
|
24
|
-
type: 'file';
|
|
25
|
-
file_id: string;
|
|
26
|
-
};
|
|
27
21
|
};
|
|
28
22
|
export type MessageClaude = {
|
|
29
23
|
role: ContentRoleClaudeEnum;
|
|
@@ -141,21 +135,21 @@ export declare const ContentSchema: mongoose.Schema<any, mongoose.Model<any, any
|
|
|
141
135
|
export declare const ContentClaudeSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
142
136
|
_id: false;
|
|
143
137
|
}, {
|
|
144
|
-
type: "image" | "text" | "document"
|
|
138
|
+
type: "image" | "text" | "document";
|
|
145
139
|
text?: string | null | undefined;
|
|
146
140
|
source?: {
|
|
147
141
|
type?: "file" | null | undefined;
|
|
148
142
|
file_id?: string | null | undefined;
|
|
149
143
|
} | null | undefined;
|
|
150
144
|
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
151
|
-
type: "image" | "text" | "document"
|
|
145
|
+
type: "image" | "text" | "document";
|
|
152
146
|
text?: string | null | undefined;
|
|
153
147
|
source?: {
|
|
154
148
|
type?: "file" | null | undefined;
|
|
155
149
|
file_id?: string | null | undefined;
|
|
156
150
|
} | null | undefined;
|
|
157
151
|
}>> & mongoose.FlatRecord<{
|
|
158
|
-
type: "image" | "text" | "document"
|
|
152
|
+
type: "image" | "text" | "document";
|
|
159
153
|
text?: string | null | undefined;
|
|
160
154
|
source?: {
|
|
161
155
|
type?: "file" | null | undefined;
|
|
@@ -36,20 +36,20 @@ exports.ContentClaudeSchema = new mongoose_1.default.Schema({
|
|
|
36
36
|
type: {
|
|
37
37
|
type: String,
|
|
38
38
|
required: true,
|
|
39
|
-
enum: ["image", "document", "text"
|
|
39
|
+
enum: ["image", "document", "text"],
|
|
40
40
|
},
|
|
41
41
|
source: {
|
|
42
42
|
type: {
|
|
43
43
|
type: String,
|
|
44
44
|
required: function () {
|
|
45
|
-
return this.type === '
|
|
45
|
+
return this.type === 'image' || this.type === 'document';
|
|
46
46
|
},
|
|
47
47
|
enum: ['file'],
|
|
48
48
|
},
|
|
49
49
|
file_id: {
|
|
50
50
|
type: String,
|
|
51
51
|
required: function () {
|
|
52
|
-
return this.type === '
|
|
52
|
+
return this.type === 'image' || this.type === 'document';
|
|
53
53
|
},
|
|
54
54
|
}
|
|
55
55
|
},
|