@common_ch/common 1.0.480 → 1.0.483

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,28 @@ 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
+ };
6
22
  export type MessageClaude = {
7
23
  role: ContentRoleClaudeEnum;
8
- content: string;
24
+ content: ContentClaude[];
9
25
  aiOptionId: Types.ObjectId | AiOptionAttrs | AiOptionDoc;
10
26
  prompt?: boolean;
27
+ attachments?: Attachment[];
11
28
  };
12
29
  export type Content = {
13
30
  type: 'input_image';
@@ -115,5 +132,33 @@ export declare const ContentSchema: mongoose.Schema<any, mongoose.Model<any, any
115
132
  } & {
116
133
  __v: number;
117
134
  }>;
135
+ export declare const ContentClaudeSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
136
+ _id: false;
137
+ }, {
138
+ type: "image" | "text" | "document";
139
+ text?: string | null | undefined;
140
+ source?: {
141
+ type?: "file" | null | undefined;
142
+ file_id?: string | null | undefined;
143
+ } | null | undefined;
144
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
145
+ type: "image" | "text" | "document";
146
+ text?: string | null | undefined;
147
+ source?: {
148
+ type?: "file" | null | undefined;
149
+ file_id?: string | null | undefined;
150
+ } | null | undefined;
151
+ }>> & mongoose.FlatRecord<{
152
+ type: "image" | "text" | "document";
153
+ text?: string | null | undefined;
154
+ source?: {
155
+ type?: "file" | null | undefined;
156
+ file_id?: string | null | undefined;
157
+ } | null | undefined;
158
+ }> & {
159
+ _id: Types.ObjectId;
160
+ } & {
161
+ __v: number;
162
+ }>;
118
163
  declare const Message: MessageModel;
119
164
  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"],
40
+ },
41
+ source: {
42
+ type: {
43
+ type: String,
44
+ required: function () {
45
+ return this.type === 'image' || this.type === 'document';
46
+ },
47
+ enum: ['file'],
48
+ },
49
+ file_id: {
50
+ type: String,
51
+ required: function () {
52
+ return 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: String,
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: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.480",
3
+ "version": "1.0.483",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [