@common_ch/common 1.0.255 → 1.0.257

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.
@@ -2,6 +2,14 @@ import mongoose from 'mongoose';
2
2
  import { AiAttrs, AiDoc } from './ai';
3
3
  import { MessageRoleEnum } from '../../enums/message';
4
4
  import { AiOptionAttrs, AiOptionDoc } from './ai-option';
5
+ export type Content = {
6
+ type: 'input_image';
7
+ file_id: string;
8
+ detail: 'auto';
9
+ } | {
10
+ type: 'input_text';
11
+ text: string;
12
+ };
5
13
  export type Attachment = {
6
14
  contentType: string;
7
15
  path: string;
@@ -12,7 +20,7 @@ export type Messages = {
12
20
  aiOption: string | AiOptionAttrs | AiOptionDoc;
13
21
  role: MessageRoleEnum;
14
22
  runId?: string;
15
- content: string;
23
+ content: Content[];
16
24
  file?: boolean;
17
25
  contentType?: string;
18
26
  attachments?: Attachment[];
@@ -63,5 +71,27 @@ export interface MessageDoc extends mongoose.Document {
63
71
  createdAt?: string;
64
72
  updatedAt?: string;
65
73
  }
74
+ export declare const ContentSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
75
+ _id: false;
76
+ }, {
77
+ type: "input_image" | "input_text";
78
+ text?: string | null | undefined;
79
+ file_id?: string | null | undefined;
80
+ detail?: "auto" | null | undefined;
81
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
82
+ type: "input_image" | "input_text";
83
+ text?: string | null | undefined;
84
+ file_id?: string | null | undefined;
85
+ detail?: "auto" | null | undefined;
86
+ }>> & mongoose.FlatRecord<{
87
+ type: "input_image" | "input_text";
88
+ text?: string | null | undefined;
89
+ file_id?: string | null | undefined;
90
+ detail?: "auto" | null | undefined;
91
+ }> & {
92
+ _id: mongoose.Types.ObjectId;
93
+ } & {
94
+ __v: number;
95
+ }>;
66
96
  declare const Message: MessageModel;
67
97
  export { Message };
@@ -3,9 +3,35 @@ 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 = void 0;
6
+ exports.Message = exports.ContentSchema = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const message_1 = require("../../enums/message");
9
+ exports.ContentSchema = new mongoose_1.default.Schema({
10
+ type: {
11
+ type: String,
12
+ required: true,
13
+ enum: ["input_image", "input_text"],
14
+ },
15
+ file_id: {
16
+ type: String,
17
+ required: function () {
18
+ return this.type === "input_image";
19
+ },
20
+ },
21
+ detail: {
22
+ type: String,
23
+ enum: ["auto"],
24
+ required: function () {
25
+ return this.type === "input_image";
26
+ },
27
+ },
28
+ text: {
29
+ type: String,
30
+ required: function () {
31
+ return this.type === "input_text";
32
+ },
33
+ },
34
+ }, { _id: false });
9
35
  const messageSchema = new mongoose_1.default.Schema({
10
36
  userId: {
11
37
  type: String,
@@ -80,7 +106,7 @@ const messageSchema = new mongoose_1.default.Schema({
80
106
  enum: Object.values(message_1.MessageRoleEnum),
81
107
  },
82
108
  content: {
83
- type: String,
109
+ type: [exports.ContentSchema],
84
110
  required: true,
85
111
  },
86
112
  contentType: {
@@ -2,12 +2,13 @@ import mongoose from 'mongoose';
2
2
  import { AiAttrs, AiDoc } from './ai';
3
3
  import { MessageRoleEnum } from '../../enums/message';
4
4
  import { AiOptionAttrs, AiOptionDoc } from './ai-option';
5
+ import { Content } from './message';
5
6
  export type Messages = {
6
7
  ai: string | AiAttrs | AiDoc;
7
8
  role: MessageRoleEnum;
8
9
  aiOption: string | AiOptionAttrs | AiOptionDoc;
9
10
  runId?: string;
10
- content: string;
11
+ content: Content[];
11
12
  createdAt: string;
12
13
  };
13
14
  export interface SharedMessageAttrs {
@@ -7,6 +7,7 @@ exports.SharedMessage = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
9
  const message_1 = require("../../enums/message");
10
+ const message_2 = require("./message");
10
11
  const sharedMessageSchema = new mongoose_1.default.Schema({
11
12
  messageId: {
12
13
  type: mongoose_1.default.Schema.Types.ObjectId,
@@ -47,7 +48,7 @@ const sharedMessageSchema = new mongoose_1.default.Schema({
47
48
  enum: Object.values(message_1.MessageRoleEnum),
48
49
  },
49
50
  content: {
50
- type: String,
51
+ type: [message_2.ContentSchema],
51
52
  required: true,
52
53
  },
53
54
  runId: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.255",
3
+ "version": "1.0.257",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [