@common_ch/common 1.0.310 → 1.0.312

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.
@@ -0,0 +1,6 @@
1
+ export declare enum PromptTypeEnum {
2
+ personal = "personal",
3
+ init = "init",
4
+ requestType = "request-type",
5
+ summary = "summary"
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptTypeEnum = void 0;
4
+ var PromptTypeEnum;
5
+ (function (PromptTypeEnum) {
6
+ PromptTypeEnum["personal"] = "personal";
7
+ PromptTypeEnum["init"] = "init";
8
+ PromptTypeEnum["requestType"] = "request-type";
9
+ PromptTypeEnum["summary"] = "summary";
10
+ })(PromptTypeEnum || (exports.PromptTypeEnum = PromptTypeEnum = {}));
@@ -20,7 +20,6 @@ export type Attachment = {
20
20
  name: string;
21
21
  };
22
22
  export type Messages = {
23
- ai: string | AiAttrs | AiDoc;
24
23
  aiOption: string | AiOptionAttrs | AiOptionDoc;
25
24
  role: 'user' | 'assistant' | 'system';
26
25
  runId?: string;
@@ -143,10 +143,6 @@ const messageSchema = new mongoose_1.default.Schema({
143
143
  },
144
144
  messages: [
145
145
  {
146
- ai: {
147
- type: mongoose_1.default.Schema.Types.ObjectId,
148
- ref: 'Ai',
149
- },
150
146
  aiOption: {
151
147
  type: mongoose_1.default.Schema.Types.ObjectId,
152
148
  ref: 'AiOption',
@@ -0,0 +1,31 @@
1
+ import mongoose from 'mongoose';
2
+ import { UserDoc } from './user';
3
+ import { PromptTypeEnum } from '../../enums/prompt';
4
+ import { AiDoc } from './ai';
5
+ export interface PromptAttrs {
6
+ _id?: string;
7
+ prompt: string;
8
+ userId?: string | UserDoc;
9
+ promptType: PromptTypeEnum;
10
+ aiId: string | AiDoc;
11
+ description?: string;
12
+ version?: number;
13
+ createdAt?: string;
14
+ updatedAt?: string;
15
+ }
16
+ interface PromptModel extends mongoose.Model<PromptDoc> {
17
+ build(attrs: PromptAttrs): PromptDoc;
18
+ }
19
+ export interface PromptDoc extends mongoose.Document {
20
+ _id: string;
21
+ prompt: string;
22
+ userId?: string | UserDoc;
23
+ promptType: PromptTypeEnum;
24
+ aiId: string | AiDoc;
25
+ description?: string;
26
+ version?: number;
27
+ createdAt?: string;
28
+ updatedAt?: string;
29
+ }
30
+ declare const Prompt: PromptModel;
31
+ export { Prompt };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Prompt = void 0;
7
+ const mongoose_1 = __importDefault(require("mongoose"));
8
+ const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
+ const prompt_1 = require("../../enums/prompt");
10
+ const promptSchema = new mongoose_1.default.Schema({
11
+ prompt: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ description: {
16
+ type: String,
17
+ required: false,
18
+ },
19
+ promptType: {
20
+ type: String,
21
+ enum: prompt_1.PromptTypeEnum,
22
+ required: true,
23
+ },
24
+ userId: {
25
+ type: mongoose_1.default.Schema.Types.ObjectId,
26
+ ref: 'User',
27
+ required: false,
28
+ },
29
+ aiId: {
30
+ type: mongoose_1.default.Schema.Types.ObjectId,
31
+ ref: 'Ai',
32
+ required: true,
33
+ },
34
+ createdAt: {
35
+ type: mongoose_1.default.Schema.Types.Date,
36
+ },
37
+ updatedAt: {
38
+ type: mongoose_1.default.Schema.Types.Date,
39
+ },
40
+ }, {
41
+ timestamps: true,
42
+ });
43
+ promptSchema.set('versionKey', 'version');
44
+ promptSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
45
+ promptSchema.index({ userId: 1 });
46
+ promptSchema.index({ aiId: 1 });
47
+ promptSchema.index({ promptType: 1 });
48
+ promptSchema.statics.build = (attrs) => {
49
+ return new Prompt(attrs);
50
+ };
51
+ const Prompt = mongoose_1.default.model('Prompt', promptSchema);
52
+ exports.Prompt = Prompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@common_ch/common",
3
- "version": "1.0.310",
3
+ "version": "1.0.312",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [
@@ -1,36 +0,0 @@
1
- import mongoose from 'mongoose';
2
- import { MessageTypeSupportChatEnum, SupportChatStatusEnum } from '../../enums/supportChat';
3
- export interface SupportChatAttrs {
4
- userId: string;
5
- messages: {
6
- message: string;
7
- typeMessage: MessageTypeSupportChatEnum;
8
- file?: string;
9
- adminName?: string;
10
- adminFamily?: string;
11
- createdAt: string;
12
- }[];
13
- status?: SupportChatStatusEnum;
14
- createdAt?: string;
15
- updatedAt?: string;
16
- }
17
- interface SupportChatModel extends mongoose.Model<SupportChatDoc> {
18
- build(attrs: SupportChatAttrs): SupportChatDoc;
19
- }
20
- export interface SupportChatDoc extends mongoose.Document {
21
- _id: string;
22
- userId: string;
23
- messages: {
24
- message: string;
25
- typeMessage: MessageTypeSupportChatEnum;
26
- file?: string;
27
- adminName?: string;
28
- adminFamily?: string;
29
- createdAt: string;
30
- }[];
31
- status?: SupportChatStatusEnum;
32
- createdAt?: string;
33
- updatedAt?: string;
34
- }
35
- declare const SupportChat: SupportChatModel;
36
- export { SupportChat };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SupportChat = void 0;
7
- const mongoose_1 = __importDefault(require("mongoose"));
8
- const mongoose_update_if_current_1 = require("mongoose-update-if-current");
9
- const supportChat_1 = require("../../enums/supportChat");
10
- const supportChatSchema = new mongoose_1.default.Schema({
11
- userId: {
12
- type: mongoose_1.default.Schema.Types.ObjectId,
13
- ref: 'User',
14
- required: true,
15
- },
16
- messages: [{
17
- file: {
18
- type: String,
19
- required: false,
20
- },
21
- message: {
22
- type: String,
23
- required: true,
24
- },
25
- adminName: {
26
- type: String,
27
- required: false,
28
- },
29
- adminFamily: {
30
- type: String,
31
- required: false,
32
- },
33
- typeMessage: {
34
- type: String,
35
- required: true,
36
- default: supportChat_1.MessageTypeSupportChatEnum.user
37
- },
38
- createdAt: {
39
- type: mongoose_1.default.Schema.Types.Date,
40
- }
41
- }],
42
- status: {
43
- type: String,
44
- enum: supportChat_1.SupportChatStatusEnum,
45
- default: supportChat_1.SupportChatStatusEnum.start,
46
- },
47
- createdAt: {
48
- type: mongoose_1.default.Schema.Types.Date,
49
- },
50
- updatedAt: {
51
- type: mongoose_1.default.Schema.Types.Date,
52
- },
53
- }, {
54
- timestamps: true,
55
- });
56
- supportChatSchema.set('versionKey', 'version');
57
- supportChatSchema.plugin(mongoose_update_if_current_1.updateIfCurrentPlugin);
58
- supportChatSchema.index({ 'userId': 1 });
59
- supportChatSchema.statics.build = (attrs) => {
60
- return new SupportChat(attrs);
61
- };
62
- const SupportChat = mongoose_1.default.model('SupportChat', supportChatSchema);
63
- exports.SupportChat = SupportChat;