@dataclouder/conversation-card-nestjs 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
73
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
74
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
75
+ };
76
+ Object.defineProperty(exports, "__esModule", { value: true });
77
+ exports.ConversationAiController = void 0;
78
+ var common_1 = require("@nestjs/common");
79
+ var swagger_1 = require("@nestjs/swagger");
80
+ var ConversationAiController = function () {
81
+ var _classDecorators = [(0, swagger_1.ApiTags)('conversation-cards-library'), (0, common_1.Controller)('api/conversation-cards-library')];
82
+ var _classDescriptor;
83
+ var _classExtraInitializers = [];
84
+ var _classThis;
85
+ var _instanceExtraInitializers = [];
86
+ var _getCards_decorators;
87
+ var ConversationAiController = _classThis = /** @class */ (function () {
88
+ function ConversationAiController_1() {
89
+ __runInitializers(this, _instanceExtraInitializers);
90
+ }
91
+ ConversationAiController_1.prototype.getCards = function () {
92
+ return __awaiter(this, void 0, void 0, function () {
93
+ return __generator(this, function (_a) {
94
+ return [2 /*return*/, 'Hello World'];
95
+ });
96
+ });
97
+ };
98
+ return ConversationAiController_1;
99
+ }());
100
+ __setFunctionName(_classThis, "ConversationAiController");
101
+ (function () {
102
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
103
+ _getCards_decorators = [(0, common_1.Get)('/cards'), (0, swagger_1.ApiOperation)({ summary: 'Get the cards' }), (0, swagger_1.ApiResponse)({ status: 200, description: 'Return the cards.' })];
104
+ __esDecorate(_classThis, null, _getCards_decorators, { kind: "method", name: "getCards", static: false, private: false, access: { has: function (obj) { return "getCards" in obj; }, get: function (obj) { return obj.getCards; } }, metadata: _metadata }, null, _instanceExtraInitializers);
105
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
106
+ ConversationAiController = _classThis = _classDescriptor.value;
107
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
108
+ __runInitializers(_classThis, _classExtraInitializers);
109
+ })();
110
+ return ConversationAiController = _classThis;
111
+ }();
112
+ exports.ConversationAiController = ConversationAiController;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.ConversationDTO = exports.CreateConversationDto = void 0;
38
+ // import { IsString, IsNotEmpty, IsOptional } from 'class-validator';
39
+ var swagger_1 = require("@nestjs/swagger");
40
+ var CreateConversationDto = function () {
41
+ var _a;
42
+ var _instanceExtraInitializers = [];
43
+ var _message_decorators;
44
+ var _message_initializers = [];
45
+ var _userId_decorators;
46
+ var _userId_initializers = [];
47
+ var _context_decorators;
48
+ var _context_initializers = [];
49
+ return _a = /** @class */ (function () {
50
+ function CreateConversationDto() {
51
+ this.message = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _message_initializers, void 0));
52
+ this.userId = __runInitializers(this, _userId_initializers, void 0);
53
+ this.context = __runInitializers(this, _context_initializers, void 0);
54
+ }
55
+ return CreateConversationDto;
56
+ }()),
57
+ (function () {
58
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
59
+ _message_decorators = [(0, swagger_1.ApiProperty)({
60
+ description: 'The message content of the conversation',
61
+ example: 'Hello, how can I help you today?',
62
+ })];
63
+ _userId_decorators = [(0, swagger_1.ApiProperty)({
64
+ description: 'The user ID associated with the conversation',
65
+ example: 'user123',
66
+ })];
67
+ _context_decorators = [(0, swagger_1.ApiProperty)({
68
+ description: 'Additional context for the conversation',
69
+ required: false,
70
+ example: { previousContext: 'User asked about weather' },
71
+ })];
72
+ __esDecorate(null, null, _message_decorators, { kind: "field", name: "message", static: false, private: false, access: { has: function (obj) { return "message" in obj; }, get: function (obj) { return obj.message; }, set: function (obj, value) { obj.message = value; } }, metadata: _metadata }, _message_initializers, _instanceExtraInitializers);
73
+ __esDecorate(null, null, _userId_decorators, { kind: "field", name: "userId", static: false, private: false, access: { has: function (obj) { return "userId" in obj; }, get: function (obj) { return obj.userId; }, set: function (obj, value) { obj.userId = value; } }, metadata: _metadata }, _userId_initializers, _instanceExtraInitializers);
74
+ __esDecorate(null, null, _context_decorators, { kind: "field", name: "context", static: false, private: false, access: { has: function (obj) { return "context" in obj; }, get: function (obj) { return obj.context; }, set: function (obj, value) { obj.context = value; } }, metadata: _metadata }, _context_initializers, _instanceExtraInitializers);
75
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
76
+ })(),
77
+ _a;
78
+ }();
79
+ exports.CreateConversationDto = CreateConversationDto;
80
+ var ConversationDTO = /** @class */ (function () {
81
+ function ConversationDTO() {
82
+ }
83
+ return ConversationDTO;
84
+ }());
85
+ exports.ConversationDTO = ConversationDTO;
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.ConversationSchema = exports.Conversation = void 0;
42
+ var mongoose_1 = require("@nestjs/mongoose");
43
+ var mongoose_2 = require("mongoose");
44
+ var conversation_interface_1 = require("../clases/conversation.interface");
45
+ var Conversation = function () {
46
+ var _classDecorators = [(0, mongoose_1.Schema)({ timestamps: true })];
47
+ var _classDescriptor;
48
+ var _classExtraInitializers = [];
49
+ var _classThis;
50
+ var _instanceExtraInitializers = [];
51
+ var __id_decorators;
52
+ var __id_initializers = [];
53
+ var _id_decorators;
54
+ var _id_initializers = [];
55
+ var _version_decorators;
56
+ var _version_initializers = [];
57
+ var _title_decorators;
58
+ var _title_initializers = [];
59
+ var _characterCard_decorators;
60
+ var _characterCard_initializers = [];
61
+ var _textEngine_decorators;
62
+ var _textEngine_initializers = [];
63
+ var _conversationType_decorators;
64
+ var _conversationType_initializers = [];
65
+ var _lang_decorators;
66
+ var _lang_initializers = [];
67
+ var _assets_decorators;
68
+ var _assets_initializers = [];
69
+ var _tts_decorators;
70
+ var _tts_initializers = [];
71
+ var _voice_decorators;
72
+ var _voice_initializers = [];
73
+ var _secondaryVoice_decorators;
74
+ var _secondaryVoice_initializers = [];
75
+ var _speed_decorators;
76
+ var _speed_initializers = [];
77
+ var _speedRate_decorators;
78
+ var _speedRate_initializers = [];
79
+ var _metaApp_decorators;
80
+ var _metaApp_initializers = [];
81
+ var _createdAt_decorators;
82
+ var _createdAt_initializers = [];
83
+ var _updatedAt_decorators;
84
+ var _updatedAt_initializers = [];
85
+ var Conversation = _classThis = /** @class */ (function () {
86
+ function Conversation_1() {
87
+ this._id = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, __id_initializers, void 0));
88
+ this.id = __runInitializers(this, _id_initializers, void 0);
89
+ this.version = __runInitializers(this, _version_initializers, void 0);
90
+ this.title = __runInitializers(this, _title_initializers, void 0);
91
+ this.characterCard = __runInitializers(this, _characterCard_initializers, void 0);
92
+ this.textEngine = __runInitializers(this, _textEngine_initializers, void 0);
93
+ this.conversationType = __runInitializers(this, _conversationType_initializers, void 0);
94
+ this.lang = __runInitializers(this, _lang_initializers, void 0);
95
+ this.assets = __runInitializers(this, _assets_initializers, void 0);
96
+ this.tts = __runInitializers(this, _tts_initializers, void 0);
97
+ this.voice = __runInitializers(this, _voice_initializers, void 0);
98
+ this.secondaryVoice = __runInitializers(this, _secondaryVoice_initializers, void 0);
99
+ this.speed = __runInitializers(this, _speed_initializers, void 0);
100
+ this.speedRate = __runInitializers(this, _speedRate_initializers, void 0);
101
+ this.metaApp = __runInitializers(this, _metaApp_initializers, void 0);
102
+ this.createdAt = __runInitializers(this, _createdAt_initializers, void 0);
103
+ this.updatedAt = __runInitializers(this, _updatedAt_initializers, void 0);
104
+ }
105
+ return Conversation_1;
106
+ }());
107
+ __setFunctionName(_classThis, "Conversation");
108
+ (function () {
109
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
110
+ __id_decorators = [(0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true })];
111
+ _id_decorators = [(0, mongoose_1.Prop)()];
112
+ _version_decorators = [(0, mongoose_1.Prop)({ required: false })];
113
+ _title_decorators = [(0, mongoose_1.Prop)({ required: false })];
114
+ _characterCard_decorators = [(0, mongoose_1.Prop)({ type: Object, required: false })];
115
+ _textEngine_decorators = [(0, mongoose_1.Prop)({ required: true, enum: conversation_interface_1.TextEngines })];
116
+ _conversationType_decorators = [(0, mongoose_1.Prop)({ required: true, enum: conversation_interface_1.ConversationType })];
117
+ _lang_decorators = [(0, mongoose_1.Prop)({ required: false })];
118
+ _assets_decorators = [(0, mongoose_1.Prop)({ type: Object, required: false })];
119
+ _tts_decorators = [(0, mongoose_1.Prop)({ type: Object, required: false })];
120
+ _voice_decorators = [(0, mongoose_1.Prop)({ required: false })];
121
+ _secondaryVoice_decorators = [(0, mongoose_1.Prop)({ required: false })];
122
+ _speed_decorators = [(0, mongoose_1.Prop)({ required: false })];
123
+ _speedRate_decorators = [(0, mongoose_1.Prop)({ required: false })];
124
+ _metaApp_decorators = [(0, mongoose_1.Prop)({ type: Object, required: false })];
125
+ _createdAt_decorators = [(0, mongoose_1.Prop)()];
126
+ _updatedAt_decorators = [(0, mongoose_1.Prop)()];
127
+ __esDecorate(null, null, __id_decorators, { kind: "field", name: "_id", static: false, private: false, access: { has: function (obj) { return "_id" in obj; }, get: function (obj) { return obj._id; }, set: function (obj, value) { obj._id = value; } }, metadata: _metadata }, __id_initializers, _instanceExtraInitializers);
128
+ __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: function (obj) { return "id" in obj; }, get: function (obj) { return obj.id; }, set: function (obj, value) { obj.id = value; } }, metadata: _metadata }, _id_initializers, _instanceExtraInitializers);
129
+ __esDecorate(null, null, _version_decorators, { kind: "field", name: "version", static: false, private: false, access: { has: function (obj) { return "version" in obj; }, get: function (obj) { return obj.version; }, set: function (obj, value) { obj.version = value; } }, metadata: _metadata }, _version_initializers, _instanceExtraInitializers);
130
+ __esDecorate(null, null, _title_decorators, { kind: "field", name: "title", static: false, private: false, access: { has: function (obj) { return "title" in obj; }, get: function (obj) { return obj.title; }, set: function (obj, value) { obj.title = value; } }, metadata: _metadata }, _title_initializers, _instanceExtraInitializers);
131
+ __esDecorate(null, null, _characterCard_decorators, { kind: "field", name: "characterCard", static: false, private: false, access: { has: function (obj) { return "characterCard" in obj; }, get: function (obj) { return obj.characterCard; }, set: function (obj, value) { obj.characterCard = value; } }, metadata: _metadata }, _characterCard_initializers, _instanceExtraInitializers);
132
+ __esDecorate(null, null, _textEngine_decorators, { kind: "field", name: "textEngine", static: false, private: false, access: { has: function (obj) { return "textEngine" in obj; }, get: function (obj) { return obj.textEngine; }, set: function (obj, value) { obj.textEngine = value; } }, metadata: _metadata }, _textEngine_initializers, _instanceExtraInitializers);
133
+ __esDecorate(null, null, _conversationType_decorators, { kind: "field", name: "conversationType", static: false, private: false, access: { has: function (obj) { return "conversationType" in obj; }, get: function (obj) { return obj.conversationType; }, set: function (obj, value) { obj.conversationType = value; } }, metadata: _metadata }, _conversationType_initializers, _instanceExtraInitializers);
134
+ __esDecorate(null, null, _lang_decorators, { kind: "field", name: "lang", static: false, private: false, access: { has: function (obj) { return "lang" in obj; }, get: function (obj) { return obj.lang; }, set: function (obj, value) { obj.lang = value; } }, metadata: _metadata }, _lang_initializers, _instanceExtraInitializers);
135
+ __esDecorate(null, null, _assets_decorators, { kind: "field", name: "assets", static: false, private: false, access: { has: function (obj) { return "assets" in obj; }, get: function (obj) { return obj.assets; }, set: function (obj, value) { obj.assets = value; } }, metadata: _metadata }, _assets_initializers, _instanceExtraInitializers);
136
+ __esDecorate(null, null, _tts_decorators, { kind: "field", name: "tts", static: false, private: false, access: { has: function (obj) { return "tts" in obj; }, get: function (obj) { return obj.tts; }, set: function (obj, value) { obj.tts = value; } }, metadata: _metadata }, _tts_initializers, _instanceExtraInitializers);
137
+ __esDecorate(null, null, _voice_decorators, { kind: "field", name: "voice", static: false, private: false, access: { has: function (obj) { return "voice" in obj; }, get: function (obj) { return obj.voice; }, set: function (obj, value) { obj.voice = value; } }, metadata: _metadata }, _voice_initializers, _instanceExtraInitializers);
138
+ __esDecorate(null, null, _secondaryVoice_decorators, { kind: "field", name: "secondaryVoice", static: false, private: false, access: { has: function (obj) { return "secondaryVoice" in obj; }, get: function (obj) { return obj.secondaryVoice; }, set: function (obj, value) { obj.secondaryVoice = value; } }, metadata: _metadata }, _secondaryVoice_initializers, _instanceExtraInitializers);
139
+ __esDecorate(null, null, _speed_decorators, { kind: "field", name: "speed", static: false, private: false, access: { has: function (obj) { return "speed" in obj; }, get: function (obj) { return obj.speed; }, set: function (obj, value) { obj.speed = value; } }, metadata: _metadata }, _speed_initializers, _instanceExtraInitializers);
140
+ __esDecorate(null, null, _speedRate_decorators, { kind: "field", name: "speedRate", static: false, private: false, access: { has: function (obj) { return "speedRate" in obj; }, get: function (obj) { return obj.speedRate; }, set: function (obj, value) { obj.speedRate = value; } }, metadata: _metadata }, _speedRate_initializers, _instanceExtraInitializers);
141
+ __esDecorate(null, null, _metaApp_decorators, { kind: "field", name: "metaApp", static: false, private: false, access: { has: function (obj) { return "metaApp" in obj; }, get: function (obj) { return obj.metaApp; }, set: function (obj, value) { obj.metaApp = value; } }, metadata: _metadata }, _metaApp_initializers, _instanceExtraInitializers);
142
+ __esDecorate(null, null, _createdAt_decorators, { kind: "field", name: "createdAt", static: false, private: false, access: { has: function (obj) { return "createdAt" in obj; }, get: function (obj) { return obj.createdAt; }, set: function (obj, value) { obj.createdAt = value; } }, metadata: _metadata }, _createdAt_initializers, _instanceExtraInitializers);
143
+ __esDecorate(null, null, _updatedAt_decorators, { kind: "field", name: "updatedAt", static: false, private: false, access: { has: function (obj) { return "updatedAt" in obj; }, get: function (obj) { return obj.updatedAt; }, set: function (obj, value) { obj.updatedAt = value; } }, metadata: _metadata }, _updatedAt_initializers, _instanceExtraInitializers);
144
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
145
+ Conversation = _classThis = _classDescriptor.value;
146
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
147
+ __runInitializers(_classThis, _classExtraInitializers);
148
+ })();
149
+ return Conversation = _classThis;
150
+ }();
151
+ exports.Conversation = Conversation;
152
+ exports.ConversationSchema = mongoose_1.SchemaFactory.createForClass(Conversation);
153
+ exports.ConversationSchema.pre('save', function (next) {
154
+ if (this.isNew) {
155
+ this.id = this._id.toString();
156
+ }
157
+ next();
158
+ });
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./conversation-cards.module"), exports);
18
+ __exportStar(require("./services/conversation-cards.service"), exports);
19
+ __exportStar(require("./conversation-ai.controller"), exports);
20
+ __exportStar(require("./services/conversation-ai.service"), exports);
21
+ __exportStar(require("./tts/tts-service"), exports);
22
+ __exportStar(require("./ai-models.service"), exports);
23
+ __exportStar(require("./clases/conversation.interface"), exports);
@@ -0,0 +1,27 @@
1
+ // import { Injectable } from '@nestjs/common';
2
+ // import OpenAI from 'openai';
3
+ // import { ConfigService } from '@nestjs/config';
4
+ // @Injectable()
5
+ // export class AudioTranscriptionService {
6
+ // private openai: OpenAI;
7
+ // constructor(private configService: ConfigService) {
8
+ // this.openai = new OpenAI({
9
+ // apiKey: this.configService.get<string>('OPENAI_API_KEY'),
10
+ // });
11
+ // }
12
+ // async transcribeAudio(audioBuffer: Buffer): Promise<any> {
13
+ // try {
14
+ // const file = new File([audioBuffer], 'audio.mp3', { type: 'audio/mpeg' });
15
+ // const transcription = await this.openai.audio.transcriptions.create({
16
+ // model: 'whisper-1',
17
+ // file: file,
18
+ // response_format: 'verbose_json',
19
+ // timestamp_granularities: ['word'],
20
+ // });
21
+ // return transcription;
22
+ // } catch (error) {
23
+ // console.error('Error transcribing audio:', error);
24
+ // throw error;
25
+ // }
26
+ // }
27
+ // }
@@ -0,0 +1,151 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
72
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
73
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
74
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
75
+ };
76
+ Object.defineProperty(exports, "__esModule", { value: true });
77
+ exports.ConversationAiService = void 0;
78
+ var common_1 = require("@nestjs/common");
79
+ var groq_sdk_1 = require("groq-sdk");
80
+ var mongodb_1 = require("mongodb");
81
+ var ConversationAiService = function () {
82
+ var _classDecorators = [(0, common_1.Injectable)()];
83
+ var _classDescriptor;
84
+ var _classExtraInitializers = [];
85
+ var _classThis;
86
+ var ConversationAiService = _classThis = /** @class */ (function () {
87
+ function ConversationAiService_1(conversationModel) {
88
+ this.conversationModel = conversationModel;
89
+ this.groqClient = new groq_sdk_1.default({
90
+ apiKey: process.env['GROQ_API_KEY'],
91
+ });
92
+ }
93
+ ConversationAiService_1.prototype.saveConversation = function (conversation) {
94
+ return __awaiter(this, void 0, void 0, function () {
95
+ var newConversation;
96
+ return __generator(this, function (_a) {
97
+ if (!conversation['_id']) {
98
+ delete conversation['_id'];
99
+ }
100
+ newConversation = new this.conversationModel(conversation);
101
+ return [2 /*return*/, newConversation.save()];
102
+ });
103
+ });
104
+ };
105
+ ConversationAiService_1.prototype.updateConversation = function (id, updateData) {
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var _id;
108
+ return __generator(this, function (_a) {
109
+ _id = new mongodb_1.ObjectId(id);
110
+ return [2 /*return*/, this.conversationModel.findByIdAndUpdate(_id, updateData, { new: true }).exec()];
111
+ });
112
+ });
113
+ };
114
+ ConversationAiService_1.prototype.getConversations = function () {
115
+ return __awaiter(this, void 0, void 0, function () {
116
+ return __generator(this, function (_a) {
117
+ return [2 /*return*/, this.conversationModel.find().exec()];
118
+ });
119
+ });
120
+ };
121
+ ConversationAiService_1.prototype.getConversationById = function (id) {
122
+ return __awaiter(this, void 0, void 0, function () {
123
+ var _id;
124
+ return __generator(this, function (_a) {
125
+ _id = new mongodb_1.ObjectId(id);
126
+ return [2 /*return*/, this.conversationModel.findById(_id).exec()];
127
+ });
128
+ });
129
+ };
130
+ ConversationAiService_1.prototype.deleteConversationById = function (id) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var _id;
133
+ return __generator(this, function (_a) {
134
+ _id = new mongodb_1.ObjectId(id);
135
+ return [2 /*return*/, this.conversationModel.findByIdAndDelete(_id).exec()];
136
+ });
137
+ });
138
+ };
139
+ return ConversationAiService_1;
140
+ }());
141
+ __setFunctionName(_classThis, "ConversationAiService");
142
+ (function () {
143
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
144
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
145
+ ConversationAiService = _classThis = _classDescriptor.value;
146
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
147
+ __runInitializers(_classThis, _classExtraInitializers);
148
+ })();
149
+ return ConversationAiService = _classThis;
150
+ }();
151
+ exports.ConversationAiService = ConversationAiService;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
37
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
38
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
39
+ };
40
+ Object.defineProperty(exports, "__esModule", { value: true });
41
+ exports.ConversationCardsService = void 0;
42
+ var common_1 = require("@nestjs/common");
43
+ var ConversationCardsService = function () {
44
+ var _classDecorators = [(0, common_1.Injectable)()];
45
+ var _classDescriptor;
46
+ var _classExtraInitializers = [];
47
+ var _classThis;
48
+ var ConversationCardsService = _classThis = /** @class */ (function () {
49
+ function ConversationCardsService_1() {
50
+ }
51
+ return ConversationCardsService_1;
52
+ }());
53
+ __setFunctionName(_classThis, "ConversationCardsService");
54
+ (function () {
55
+ var _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
56
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
57
+ ConversationCardsService = _classThis = _classDescriptor.value;
58
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
59
+ __runInitializers(_classThis, _classExtraInitializers);
60
+ })();
61
+ return ConversationCardsService = _classThis;
62
+ }();
63
+ exports.ConversationCardsService = ConversationCardsService;