@cool-digital-solutions/interferir-models 1.0.58 → 1.0.60
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.
- package/dist/schemas/ai-conversation-message.schema.d.ts +28 -0
- package/dist/schemas/ai-conversation-message.schema.js +45 -0
- package/dist/schemas/ai-conversation.schema.js +0 -13
- package/dist/schemas/user.schema.js +1 -0
- package/dist/types/ai-conversation-message.type.d.ts +55 -0
- package/dist/types/ai-conversation-message.type.js +15 -0
- package/dist/types/ai-conversation.type.d.ts +0 -22
- package/dist/types/ai-conversation.type.js +0 -13
- package/dist/types/index.d.ts +2 -1
- package/dist/types/user.type.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import { Schema } from 'mongoose';
|
|
26
|
+
import type { IAiConversationMessage, IAiConversationMessageModel } from '../types';
|
|
27
|
+
declare const aiConversationSchema: Schema<IAiConversationMessage, IAiConversationMessageModel, {}, {}, {}, {}, import("mongoose").DefaultSchemaOptions, IAiConversationMessage>;
|
|
28
|
+
export default aiConversationSchema;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
const mongoose_1 = require("mongoose");
|
|
7
|
+
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
|
+
const _config_1 = require("../config");
|
|
9
|
+
const ai_conversation_message_type_1 = require("src/types/ai-conversation-message.type");
|
|
10
|
+
const aiConversationSchema = new mongoose_1.Schema({
|
|
11
|
+
conversationId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'AiConversation', required: true },
|
|
12
|
+
role: { type: String, enum: Object.values(ai_conversation_message_type_1.ROLE), required: true },
|
|
13
|
+
content: { type: String, required: true },
|
|
14
|
+
token: { type: Number, required: true },
|
|
15
|
+
messageDate: { type: Number, required: true },
|
|
16
|
+
isLiked: { type: Boolean, default: null },
|
|
17
|
+
comment: { type: String, default: null },
|
|
18
|
+
reason: { type: String, enum: ai_conversation_message_type_1.IMessageReason, default: ai_conversation_message_type_1.IMessageReason.DEFAULT },
|
|
19
|
+
title: { type: String, required: false },
|
|
20
|
+
cost: { type: Number },
|
|
21
|
+
companies: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Company', default: null }],
|
|
22
|
+
portiaArticles: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'PortiaArticle', default: null }],
|
|
23
|
+
useCases: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'UseCase', default: null }],
|
|
24
|
+
researches: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'Theme', default: null }],
|
|
25
|
+
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
26
|
+
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
27
|
+
updatedDate: Number,
|
|
28
|
+
createdDate: Number,
|
|
29
|
+
}, _config_1.schemaOptions);
|
|
30
|
+
aiConversationSchema.pre('save', function (next) {
|
|
31
|
+
const user = express_http_context_1.default.get('user');
|
|
32
|
+
if (user) {
|
|
33
|
+
if (!this.createdBy)
|
|
34
|
+
this.createdBy = user._id;
|
|
35
|
+
this.updatedBy = user._id;
|
|
36
|
+
}
|
|
37
|
+
next();
|
|
38
|
+
});
|
|
39
|
+
aiConversationSchema.pre('findOneAndUpdate', function (next) {
|
|
40
|
+
const user = express_http_context_1.default.get('user');
|
|
41
|
+
if (user)
|
|
42
|
+
this._update.updatedBy = user._id;
|
|
43
|
+
next();
|
|
44
|
+
});
|
|
45
|
+
exports.default = aiConversationSchema;
|
|
@@ -5,24 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mongoose_1 = require("mongoose");
|
|
7
7
|
const express_http_context_1 = __importDefault(require("express-http-context"));
|
|
8
|
-
const ai_conversation_type_1 = require("../types/ai-conversation.type");
|
|
9
8
|
const _config_1 = require("../config");
|
|
10
9
|
const aiConversationSchema = new mongoose_1.Schema({
|
|
11
10
|
userId: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', required: true },
|
|
12
11
|
title: { type: String, required: true },
|
|
13
12
|
summary: { type: String, required: true },
|
|
14
|
-
messages: [
|
|
15
|
-
{
|
|
16
|
-
role: { type: String, enum: Object.values(ai_conversation_type_1.ROLE), required: true },
|
|
17
|
-
content: { type: String, required: true },
|
|
18
|
-
token: { type: Number, required: true },
|
|
19
|
-
messageDate: { type: Number, required: true },
|
|
20
|
-
isLiked: { type: Boolean, default: null },
|
|
21
|
-
comment: { type: String, default: null },
|
|
22
|
-
reason: { type: String, enum: ai_conversation_type_1.IMessageReason, default: ai_conversation_type_1.IMessageReason.DEFAULT },
|
|
23
|
-
title: { type: String, required: false },
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
13
|
cost: { type: Number, required: false },
|
|
27
14
|
autoGenerated: { type: Boolean, default: false },
|
|
28
15
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -44,6 +44,7 @@ const userSchema = new mongoose_1.Schema({
|
|
|
44
44
|
isPasswordSetted: { type: Boolean, default: false },
|
|
45
45
|
isSeeWelcomeMessage: { type: Boolean, default: false },
|
|
46
46
|
lastCheckedCompetitorDate: { type: Number, default: 0 },
|
|
47
|
+
lastCheckCompetitorGridDate: { type: Number, default: 0 },
|
|
47
48
|
company: { type: mongoose_1.Schema.Types.ObjectId, ref: 'Company', default: null },
|
|
48
49
|
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
49
50
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: 'User', default: null },
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
+
/// <reference types="mongoose/types/callback" />
|
|
3
|
+
/// <reference types="mongoose/types/collection" />
|
|
4
|
+
/// <reference types="mongoose/types/connection" />
|
|
5
|
+
/// <reference types="mongoose/types/cursor" />
|
|
6
|
+
/// <reference types="mongoose/types/document" />
|
|
7
|
+
/// <reference types="mongoose/types/error" />
|
|
8
|
+
/// <reference types="mongoose/types/expressions" />
|
|
9
|
+
/// <reference types="mongoose/types/helpers" />
|
|
10
|
+
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
+
/// <reference types="mongoose/types/indexes" />
|
|
12
|
+
/// <reference types="mongoose/types/models" />
|
|
13
|
+
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
+
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
+
/// <reference types="mongoose/types/populate" />
|
|
16
|
+
/// <reference types="mongoose/types/query" />
|
|
17
|
+
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
+
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
+
/// <reference types="mongoose/types/session" />
|
|
20
|
+
/// <reference types="mongoose/types/types" />
|
|
21
|
+
/// <reference types="mongoose/types/utility" />
|
|
22
|
+
/// <reference types="mongoose/types/validation" />
|
|
23
|
+
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
+
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
+
import { Types } from 'mongoose';
|
|
26
|
+
import { IAiConversation, ICompany, IPortiaArticle, ITheme, IUseCase } from './';
|
|
27
|
+
import { BaseModel, BaseSchema } from '../config';
|
|
28
|
+
export declare enum ROLE {
|
|
29
|
+
USER = "user",
|
|
30
|
+
ASSISTANT = "assistant"
|
|
31
|
+
}
|
|
32
|
+
export declare enum IMessageReason {
|
|
33
|
+
IRRELEVANT_ANSWER = "Irrelevant answer",
|
|
34
|
+
INACCURATE_INFORMATION = "Inaccurate information",
|
|
35
|
+
INADEQUATE_RESPONSE = "Inadequate response",
|
|
36
|
+
DEFAULT = ""
|
|
37
|
+
}
|
|
38
|
+
export interface IAiConversationMessage extends BaseSchema {
|
|
39
|
+
conversationId: Types.ObjectId | IAiConversation;
|
|
40
|
+
role: ROLE;
|
|
41
|
+
content: string;
|
|
42
|
+
token: number;
|
|
43
|
+
messageDate: number;
|
|
44
|
+
isLiked?: boolean;
|
|
45
|
+
comment?: string;
|
|
46
|
+
reason?: IMessageReason;
|
|
47
|
+
title?: string;
|
|
48
|
+
cost?: number;
|
|
49
|
+
companies?: Types.ObjectId[] | ICompany[];
|
|
50
|
+
portiaArticles?: Types.ObjectId[] | IPortiaArticle[];
|
|
51
|
+
useCases?: Types.ObjectId[] | IUseCase[];
|
|
52
|
+
researches?: Types.ObjectId[] | ITheme[];
|
|
53
|
+
}
|
|
54
|
+
export interface IAiConversationMessageModel extends BaseModel<IAiConversationMessage> {
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMessageReason = exports.ROLE = void 0;
|
|
4
|
+
var ROLE;
|
|
5
|
+
(function (ROLE) {
|
|
6
|
+
ROLE["USER"] = "user";
|
|
7
|
+
ROLE["ASSISTANT"] = "assistant";
|
|
8
|
+
})(ROLE || (exports.ROLE = ROLE = {}));
|
|
9
|
+
var IMessageReason;
|
|
10
|
+
(function (IMessageReason) {
|
|
11
|
+
IMessageReason["IRRELEVANT_ANSWER"] = "Irrelevant answer";
|
|
12
|
+
IMessageReason["INACCURATE_INFORMATION"] = "Inaccurate information";
|
|
13
|
+
IMessageReason["INADEQUATE_RESPONSE"] = "Inadequate response";
|
|
14
|
+
IMessageReason["DEFAULT"] = "";
|
|
15
|
+
})(IMessageReason || (exports.IMessageReason = IMessageReason = {}));
|
|
@@ -25,34 +25,12 @@
|
|
|
25
25
|
import { Types } from 'mongoose';
|
|
26
26
|
import { IUser } from './';
|
|
27
27
|
import { BaseModel, BaseSchema } from '../config';
|
|
28
|
-
export declare enum ROLE {
|
|
29
|
-
USER = "user",
|
|
30
|
-
ASSISTANT = "assistant"
|
|
31
|
-
}
|
|
32
|
-
export declare enum IMessageReason {
|
|
33
|
-
IRRELEVANT_ANSWER = "Irrelevant answer",
|
|
34
|
-
INACCURATE_INFORMATION = "Inaccurate information",
|
|
35
|
-
INADEQUATE_RESPONSE = "Inadequate response",
|
|
36
|
-
DEFAULT = ""
|
|
37
|
-
}
|
|
38
|
-
interface IMessage {
|
|
39
|
-
role: ROLE;
|
|
40
|
-
content: string;
|
|
41
|
-
token: number;
|
|
42
|
-
messageDate: number;
|
|
43
|
-
isLiked?: boolean;
|
|
44
|
-
comment?: string;
|
|
45
|
-
reason?: IMessageReason;
|
|
46
|
-
title?: string;
|
|
47
|
-
}
|
|
48
28
|
export interface IAiConversation extends BaseSchema {
|
|
49
29
|
userId: Types.ObjectId | IUser;
|
|
50
30
|
title: string;
|
|
51
31
|
summary: string;
|
|
52
|
-
messages: IMessage[];
|
|
53
32
|
cost?: number;
|
|
54
33
|
autoGenerated: boolean;
|
|
55
34
|
}
|
|
56
35
|
export interface IAiConversationModel extends BaseModel<IAiConversation> {
|
|
57
36
|
}
|
|
58
|
-
export {};
|
|
@@ -1,15 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IMessageReason = exports.ROLE = void 0;
|
|
4
|
-
var ROLE;
|
|
5
|
-
(function (ROLE) {
|
|
6
|
-
ROLE["USER"] = "user";
|
|
7
|
-
ROLE["ASSISTANT"] = "assistant";
|
|
8
|
-
})(ROLE || (exports.ROLE = ROLE = {}));
|
|
9
|
-
var IMessageReason;
|
|
10
|
-
(function (IMessageReason) {
|
|
11
|
-
IMessageReason["IRRELEVANT_ANSWER"] = "Irrelevant answer";
|
|
12
|
-
IMessageReason["INACCURATE_INFORMATION"] = "Inaccurate information";
|
|
13
|
-
IMessageReason["INADEQUATE_RESPONSE"] = "Inadequate response";
|
|
14
|
-
IMessageReason["DEFAULT"] = "";
|
|
15
|
-
})(IMessageReason || (exports.IMessageReason = IMessageReason = {}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAiConversation, IAiConversationModel } from './ai-conversation.type';
|
|
2
|
+
import { IAiConversationMessage, IAiConversationMessageModel } from './ai-conversation-message.type';
|
|
2
3
|
import { IBackendError, IBackendErrorModel } from './backend-error.type';
|
|
3
4
|
import { IBadge, IBadgeModel } from './badge.type';
|
|
4
5
|
import { IBatchHistory } from './batch-history.type';
|
|
@@ -52,4 +53,4 @@ import { IUserToken, IUserTokenModel } from './user-token.type';
|
|
|
52
53
|
import { IUserVisit, IUserVisitModel } from './user-visit.type';
|
|
53
54
|
import { IUser, IUserModel } from './user.type';
|
|
54
55
|
import { ICompetitorGrid, ICompetitorGridModel, AIStatus } from './competitor-grid.type';
|
|
55
|
-
export { IAiConversation, IAiConversationModel, IBackendError, IBackendErrorModel, IBadge, IBadgeModel, IBatchHistory, IBookmark, IBookmarkModel, ICompany, ICompanyModel, ICompanyCluster, ICompanyClusterModel, ICompanyFundingRound, ICompanyFundingRoundModel, ICompanyMarketing, ICompanyMarketingModel, ICompetitor, ICompetitorModel, ICompetitorAnalysis, ICompetitorAnalysisModel, IContactMessage, IContactMessageModel, IContactStartup, IContactStartupModel, IContent, IContentModel, IDraftVersion, IDraftVersionModel, IEvidenceLayout, IEvidenceLayoutModel, IEvidence, IEvidenceModel, IFaq, IFaqModel, IFeaturedTheme, IFeaturedThemeModel, IFoamTree, IFoamTreeModel, IFollowContent, IFollowContentModel, IGeneralConfigSub, IGeneralConfigSubModel, IGeneralConfig, IGeneralConfigModel, IImage, IImageModel, IIndustry, IIndustryModel, IInstantResearch, IInstantResearchModel, IInvestor, IInvestorModel, ILike, ILikeModel, INews, INewsModel, INotification, INotificationModel, IOtp, IOtpModel, IPortiaArticle, IPortiaArticleModel, IProblem, IProblemModel, IRelatedTheme, IRelatedThemeModel, ISearchHistory, ISearchHistoryModel, ISFCategory, ISFCategoryModel, ISFSubCategory, ISFSubCategoryModel, ISFTag, ISFTagModel, ISiteMapCache, ISiteMapCacheModel, ISparkUseCase, ISparkUseCaseModel, ISpark, ISparkModel, IStartupVectorAnyEntity, IStartupVectorAnyEntityModel, ISuggest, ISuggestModel, ITechnology, ITechnologyModel, ITheme, IThemeModel, IToken, ITokenModel, IUpdateJob, IUpdateJobModel, IUseCaseDiscovery, IUseCaseDiscoveryModel, IUseCaseDiscoveryProblem, IUseCaseDiscoveryProblemModel, IUseCase, IUseCaseModel, IUserToken, IUserTokenModel, IUserVisit, IUserVisitModel, IUser, IUserModel, ICompetitorGrid, ICompetitorGridModel, AIStatus, };
|
|
56
|
+
export { IAiConversation, IAiConversationModel, IAiConversationMessage, IAiConversationMessageModel, IBackendError, IBackendErrorModel, IBadge, IBadgeModel, IBatchHistory, IBookmark, IBookmarkModel, ICompany, ICompanyModel, ICompanyCluster, ICompanyClusterModel, ICompanyFundingRound, ICompanyFundingRoundModel, ICompanyMarketing, ICompanyMarketingModel, ICompetitor, ICompetitorModel, ICompetitorAnalysis, ICompetitorAnalysisModel, IContactMessage, IContactMessageModel, IContactStartup, IContactStartupModel, IContent, IContentModel, IDraftVersion, IDraftVersionModel, IEvidenceLayout, IEvidenceLayoutModel, IEvidence, IEvidenceModel, IFaq, IFaqModel, IFeaturedTheme, IFeaturedThemeModel, IFoamTree, IFoamTreeModel, IFollowContent, IFollowContentModel, IGeneralConfigSub, IGeneralConfigSubModel, IGeneralConfig, IGeneralConfigModel, IImage, IImageModel, IIndustry, IIndustryModel, IInstantResearch, IInstantResearchModel, IInvestor, IInvestorModel, ILike, ILikeModel, INews, INewsModel, INotification, INotificationModel, IOtp, IOtpModel, IPortiaArticle, IPortiaArticleModel, IProblem, IProblemModel, IRelatedTheme, IRelatedThemeModel, ISearchHistory, ISearchHistoryModel, ISFCategory, ISFCategoryModel, ISFSubCategory, ISFSubCategoryModel, ISFTag, ISFTagModel, ISiteMapCache, ISiteMapCacheModel, ISparkUseCase, ISparkUseCaseModel, ISpark, ISparkModel, IStartupVectorAnyEntity, IStartupVectorAnyEntityModel, ISuggest, ISuggestModel, ITechnology, ITechnologyModel, ITheme, IThemeModel, IToken, ITokenModel, IUpdateJob, IUpdateJobModel, IUseCaseDiscovery, IUseCaseDiscoveryModel, IUseCaseDiscoveryProblem, IUseCaseDiscoveryProblemModel, IUseCase, IUseCaseModel, IUserToken, IUserTokenModel, IUserVisit, IUserVisitModel, IUser, IUserModel, ICompetitorGrid, ICompetitorGridModel, AIStatus, };
|