@common_ch/common 1.0.480 → 1.0.481
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.
|
@@ -3,11 +3,34 @@ import { AiAttrs, AiDoc } from './ai';
|
|
|
3
3
|
import { ContentGemini, ContentRoleClaudeEnum } from '../../enums/message';
|
|
4
4
|
import { AiOptionAttrs, AiOptionDoc } from './ai-option';
|
|
5
5
|
import { FileReferenceGeminiDoc } from './fileReferenceGemini';
|
|
6
|
+
export type ContentClaude = {
|
|
7
|
+
type: 'text';
|
|
8
|
+
text: string;
|
|
9
|
+
} | {
|
|
10
|
+
type: 'image';
|
|
11
|
+
source: {
|
|
12
|
+
type: 'file';
|
|
13
|
+
file_id: string;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
type: 'document';
|
|
17
|
+
source: {
|
|
18
|
+
type: 'file';
|
|
19
|
+
file_id: string;
|
|
20
|
+
};
|
|
21
|
+
} | {
|
|
22
|
+
type: 'audio';
|
|
23
|
+
source: {
|
|
24
|
+
type: 'file';
|
|
25
|
+
file_id: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
6
28
|
export type MessageClaude = {
|
|
7
29
|
role: ContentRoleClaudeEnum;
|
|
8
|
-
content:
|
|
30
|
+
content: ContentClaude[];
|
|
9
31
|
aiOptionId: Types.ObjectId | AiOptionAttrs | AiOptionDoc;
|
|
10
32
|
prompt?: boolean;
|
|
33
|
+
attachments?: Attachment[];
|
|
11
34
|
};
|
|
12
35
|
export type Content = {
|
|
13
36
|
type: 'input_image';
|
|
@@ -115,5 +138,33 @@ export declare const ContentSchema: mongoose.Schema<any, mongoose.Model<any, any
|
|
|
115
138
|
} & {
|
|
116
139
|
__v: number;
|
|
117
140
|
}>;
|
|
141
|
+
export declare const ContentClaudeSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
142
|
+
_id: false;
|
|
143
|
+
}, {
|
|
144
|
+
type: "image" | "text" | "document" | "audio";
|
|
145
|
+
text?: string | null | undefined;
|
|
146
|
+
source?: {
|
|
147
|
+
type?: "file" | null | undefined;
|
|
148
|
+
file_id?: string | null | undefined;
|
|
149
|
+
} | null | undefined;
|
|
150
|
+
}, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
|
|
151
|
+
type: "image" | "text" | "document" | "audio";
|
|
152
|
+
text?: string | null | undefined;
|
|
153
|
+
source?: {
|
|
154
|
+
type?: "file" | null | undefined;
|
|
155
|
+
file_id?: string | null | undefined;
|
|
156
|
+
} | null | undefined;
|
|
157
|
+
}>> & mongoose.FlatRecord<{
|
|
158
|
+
type: "image" | "text" | "document" | "audio";
|
|
159
|
+
text?: string | null | undefined;
|
|
160
|
+
source?: {
|
|
161
|
+
type?: "file" | null | undefined;
|
|
162
|
+
file_id?: string | null | undefined;
|
|
163
|
+
} | null | undefined;
|
|
164
|
+
}> & {
|
|
165
|
+
_id: Types.ObjectId;
|
|
166
|
+
} & {
|
|
167
|
+
__v: number;
|
|
168
|
+
}>;
|
|
118
169
|
declare const Message: MessageModel;
|
|
119
170
|
export { Message };
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Message = exports.ContentSchema = void 0;
|
|
6
|
+
exports.Message = exports.ContentClaudeSchema = exports.ContentSchema = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const message_1 = require("../../enums/message");
|
|
9
9
|
exports.ContentSchema = new mongoose_1.default.Schema({
|
|
@@ -32,6 +32,34 @@ exports.ContentSchema = new mongoose_1.default.Schema({
|
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
}, { _id: false });
|
|
35
|
+
exports.ContentClaudeSchema = new mongoose_1.default.Schema({
|
|
36
|
+
type: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: true,
|
|
39
|
+
enum: ["image", "document", "text", "audio"],
|
|
40
|
+
},
|
|
41
|
+
source: {
|
|
42
|
+
type: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: function () {
|
|
45
|
+
return this.type === 'audio' || this.type === 'image' || this.type === 'document';
|
|
46
|
+
},
|
|
47
|
+
enum: ['file'],
|
|
48
|
+
},
|
|
49
|
+
file_id: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: function () {
|
|
52
|
+
return this.type === 'audio' || this.type === 'image' || this.type === 'document';
|
|
53
|
+
},
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
text: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: function () {
|
|
59
|
+
return this.type === "text";
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}, { _id: false });
|
|
35
63
|
const messageSchema = new mongoose_1.default.Schema({
|
|
36
64
|
userId: {
|
|
37
65
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -141,7 +169,7 @@ const messageSchema = new mongoose_1.default.Schema({
|
|
|
141
169
|
enum: Object.values(message_1.ContentRoleClaudeEnum),
|
|
142
170
|
},
|
|
143
171
|
content: {
|
|
144
|
-
type:
|
|
172
|
+
type: [exports.ContentClaudeSchema],
|
|
145
173
|
required: true,
|
|
146
174
|
},
|
|
147
175
|
aiOptionId: {
|
|
@@ -151,7 +179,21 @@ const messageSchema = new mongoose_1.default.Schema({
|
|
|
151
179
|
prompt: {
|
|
152
180
|
type: Boolean,
|
|
153
181
|
required: false,
|
|
154
|
-
}
|
|
182
|
+
},
|
|
183
|
+
attachments: [{
|
|
184
|
+
contentType: {
|
|
185
|
+
type: String,
|
|
186
|
+
required: true,
|
|
187
|
+
},
|
|
188
|
+
path: {
|
|
189
|
+
type: String,
|
|
190
|
+
required: true,
|
|
191
|
+
},
|
|
192
|
+
name: {
|
|
193
|
+
type: String,
|
|
194
|
+
required: true,
|
|
195
|
+
}
|
|
196
|
+
}],
|
|
155
197
|
}
|
|
156
198
|
],
|
|
157
199
|
threadChatgptId: {
|