@dataclouder/conversation-card-nestjs 0.0.19 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. package/dist/ai-models.service.js +184 -0
  2. package/dist/clases/conversation.interface.js +51 -0
  3. package/dist/conversation-ai.controller.js +216 -0
  4. package/dist/conversation-ai.module.js +74 -0
  5. package/dist/conversation-cards.module.js +74 -0
  6. package/dist/conversation.controller.js +112 -0
  7. package/dist/dto/create-conversation.dto.js +85 -0
  8. package/dist/entities/conversation.entity.js +158 -0
  9. package/dist/index.js +23 -0
  10. package/dist/libs/conversation-cards/src/conversation-ai.controller.d.ts +1 -1
  11. package/dist/libs/conversation-cards/src/conversation-ai.controller.js +1 -1
  12. package/dist/libs/conversation-cards/src/conversation-ai.controller.js.map +1 -1
  13. package/dist/libs/conversation-cards/src/conversation-ai.module.js +1 -1
  14. package/dist/libs/conversation-cards/src/conversation-ai.module.js.map +1 -1
  15. package/dist/libs/conversation-cards/src/conversation-cards.module.js +1 -1
  16. package/dist/libs/conversation-cards/src/conversation-cards.module.js.map +1 -1
  17. package/dist/libs/conversation-cards/src/index.d.ts +3 -2
  18. package/dist/libs/conversation-cards/src/index.js +3 -2
  19. package/dist/libs/conversation-cards/src/index.js.map +1 -1
  20. package/dist/libs/conversation-cards/src/services/audio-transcription.service.d.ts +0 -7
  21. package/dist/libs/conversation-cards/src/services/audio-transcription.service.js +0 -32
  22. package/dist/libs/conversation-cards/src/services/audio-transcription.service.js.map +1 -1
  23. package/dist/libs/conversation-cards/src/services/conversation-ai.service.d.ts +1 -1
  24. package/dist/libs/conversation-cards/src/services/conversation-ai.service.js.map +1 -1
  25. package/dist/services/audio-transcription.service.js +27 -0
  26. package/dist/services/conversation-ai.service.js +151 -0
  27. package/dist/services/conversation-cards.service.js +63 -0
  28. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  29. package/dist/tts/tts-service.js +250 -0
  30. package/dist/tts/tts.classes.js +210 -0
  31. package/dist/tts/voices.js +217 -0
  32. package/package.json +1 -1
@@ -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;