@common_ch/common 1.0.254 → 1.0.256

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[];
@@ -25,9 +33,9 @@ export interface MessageAttrs {
25
33
  threadChatgptId?: string;
26
34
  chatGptTokenNumber?: number;
27
35
  chatGptFiles?: {
28
- vectorStoreId: string;
29
- fileIds: string[];
30
- conversationId: string;
36
+ vectorStoreId?: string;
37
+ fileIds?: string[];
38
+ conversationId?: string;
31
39
  };
32
40
  geminiTokenNumber?: number;
33
41
  summary?: string;
@@ -49,9 +57,9 @@ export interface MessageDoc extends mongoose.Document {
49
57
  threadChatgptId?: string;
50
58
  chatGptTokenNumber?: number;
51
59
  chatGptFiles?: {
52
- vectorStoreId: string;
53
- fileIds: string[];
54
- conversationId: string;
60
+ vectorStoreId?: string;
61
+ fileIds?: string[];
62
+ conversationId?: string;
55
63
  };
56
64
  geminiTokenNumber?: number;
57
65
  summary?: string;
@@ -6,6 +6,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Message = void 0;
7
7
  const mongoose_1 = __importDefault(require("mongoose"));
8
8
  const message_1 = require("../../enums/message");
9
+ const 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: [ContentSchema],
84
110
  required: true,
85
111
  },
86
112
  contentType: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.254",
3
+ "version": "1.0.256",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [