@dataclouder/conversation-card-nestjs 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/dist/clases/conversation.interface.d.ts +144 -0
  2. package/dist/clases/conversation.interface.d.ts.map +1 -0
  3. package/dist/clases/conversation.interface.js +40 -0
  4. package/dist/clases/conversation.interface.js.map +1 -0
  5. package/dist/controllers/conversation-ai.controller.d.ts +19 -0
  6. package/dist/controllers/conversation-ai.controller.d.ts.map +1 -0
  7. package/dist/controllers/conversation-ai.controller.js +136 -0
  8. package/dist/controllers/conversation-ai.controller.js.map +1 -0
  9. package/dist/controllers/conversation.controller.d.ts +4 -0
  10. package/dist/controllers/conversation.controller.d.ts.map +1 -0
  11. package/dist/controllers/conversation.controller.js +33 -0
  12. package/dist/controllers/conversation.controller.js.map +1 -0
  13. package/dist/conversation-cards.module.d.ts +3 -0
  14. package/dist/conversation-cards.module.d.ts.map +1 -0
  15. package/dist/conversation-cards.module.js +27 -0
  16. package/dist/conversation-cards.module.js.map +1 -0
  17. package/dist/dto/create-conversation.dto.d.ts +18 -0
  18. package/dist/dto/create-conversation.dto.d.ts.map +1 -0
  19. package/dist/dto/create-conversation.dto.js +42 -0
  20. package/dist/dto/create-conversation.dto.js.map +1 -0
  21. package/dist/entities/conversation.entity.d.ts +68 -0
  22. package/dist/entities/conversation.entity.d.ts.map +1 -0
  23. package/dist/entities/conversation.entity.js +97 -0
  24. package/dist/entities/conversation.entity.js.map +1 -0
  25. package/dist/index.d.ts +7 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +23 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/services/audio-transcription.service.d.ts +1 -0
  30. package/dist/services/audio-transcription.service.d.ts.map +1 -0
  31. package/dist/services/audio-transcription.service.js +1 -0
  32. package/dist/services/audio-transcription.service.js.map +1 -0
  33. package/dist/services/conversation-ai.service.d.ts +28 -0
  34. package/dist/services/conversation-ai.service.d.ts.map +1 -0
  35. package/dist/services/conversation-ai.service.js +82 -0
  36. package/dist/services/conversation-ai.service.js.map +1 -0
  37. package/dist/services/conversation-card-models.service.d.ts +13 -0
  38. package/dist/services/conversation-card-models.service.d.ts.map +1 -0
  39. package/dist/services/conversation-card-models.service.js +82 -0
  40. package/dist/services/conversation-card-models.service.js.map +1 -0
  41. package/dist/services/conversation-cards.service.d.ts +3 -0
  42. package/dist/services/conversation-cards.service.d.ts.map +1 -0
  43. package/dist/services/conversation-cards.service.js +17 -0
  44. package/dist/services/conversation-cards.service.js.map +1 -0
  45. package/dist/tts/tts-service.d.ts +1 -0
  46. package/dist/tts/tts-service.d.ts.map +1 -0
  47. package/dist/tts/tts-service.js +1 -0
  48. package/dist/tts/tts-service.js.map +1 -0
  49. package/dist/tts/tts.classes.d.ts +33 -0
  50. package/dist/tts/tts.classes.d.ts.map +1 -0
  51. package/dist/tts/tts.classes.js +200 -0
  52. package/dist/tts/tts.classes.js.map +1 -0
  53. package/dist/tts/voices.d.ts +4 -0
  54. package/dist/tts/voices.d.ts.map +1 -0
  55. package/dist/tts/voices.js +208 -0
  56. package/dist/tts/voices.js.map +1 -0
  57. package/package.json +1 -1
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ConversationSchema = exports.Conversation = void 0;
13
+ const mongoose_1 = require("@nestjs/mongoose");
14
+ const mongoose_2 = require("mongoose");
15
+ const conversation_interface_1 = require("../clases/conversation.interface");
16
+ let Conversation = class Conversation {
17
+ };
18
+ exports.Conversation = Conversation;
19
+ __decorate([
20
+ (0, mongoose_1.Prop)({ type: mongoose_2.Schema.Types.ObjectId, auto: true }),
21
+ __metadata("design:type", mongoose_2.Schema.Types.ObjectId)
22
+ ], Conversation.prototype, "_id", void 0);
23
+ __decorate([
24
+ (0, mongoose_1.Prop)(),
25
+ __metadata("design:type", String)
26
+ ], Conversation.prototype, "id", void 0);
27
+ __decorate([
28
+ (0, mongoose_1.Prop)({ required: false }),
29
+ __metadata("design:type", String)
30
+ ], Conversation.prototype, "version", void 0);
31
+ __decorate([
32
+ (0, mongoose_1.Prop)({ required: false }),
33
+ __metadata("design:type", String)
34
+ ], Conversation.prototype, "title", void 0);
35
+ __decorate([
36
+ (0, mongoose_1.Prop)({ type: Object, required: false }),
37
+ __metadata("design:type", Object)
38
+ ], Conversation.prototype, "characterCard", void 0);
39
+ __decorate([
40
+ (0, mongoose_1.Prop)({ required: true, enum: conversation_interface_1.TextEngines }),
41
+ __metadata("design:type", String)
42
+ ], Conversation.prototype, "textEngine", void 0);
43
+ __decorate([
44
+ (0, mongoose_1.Prop)({ required: true, enum: conversation_interface_1.ConversationType }),
45
+ __metadata("design:type", String)
46
+ ], Conversation.prototype, "conversationType", void 0);
47
+ __decorate([
48
+ (0, mongoose_1.Prop)({ required: false }),
49
+ __metadata("design:type", String)
50
+ ], Conversation.prototype, "lang", void 0);
51
+ __decorate([
52
+ (0, mongoose_1.Prop)({ type: Object, required: false }),
53
+ __metadata("design:type", Object)
54
+ ], Conversation.prototype, "assets", void 0);
55
+ __decorate([
56
+ (0, mongoose_1.Prop)({ type: Object, required: false }),
57
+ __metadata("design:type", Object)
58
+ ], Conversation.prototype, "tts", void 0);
59
+ __decorate([
60
+ (0, mongoose_1.Prop)({ required: false }),
61
+ __metadata("design:type", String)
62
+ ], Conversation.prototype, "voice", void 0);
63
+ __decorate([
64
+ (0, mongoose_1.Prop)({ required: false }),
65
+ __metadata("design:type", String)
66
+ ], Conversation.prototype, "secondaryVoice", void 0);
67
+ __decorate([
68
+ (0, mongoose_1.Prop)({ required: false }),
69
+ __metadata("design:type", String)
70
+ ], Conversation.prototype, "speed", void 0);
71
+ __decorate([
72
+ (0, mongoose_1.Prop)({ required: false }),
73
+ __metadata("design:type", Number)
74
+ ], Conversation.prototype, "speedRate", void 0);
75
+ __decorate([
76
+ (0, mongoose_1.Prop)({ type: Object, required: false }),
77
+ __metadata("design:type", Object)
78
+ ], Conversation.prototype, "metaApp", void 0);
79
+ __decorate([
80
+ (0, mongoose_1.Prop)(),
81
+ __metadata("design:type", Date)
82
+ ], Conversation.prototype, "createdAt", void 0);
83
+ __decorate([
84
+ (0, mongoose_1.Prop)(),
85
+ __metadata("design:type", Date)
86
+ ], Conversation.prototype, "updatedAt", void 0);
87
+ exports.Conversation = Conversation = __decorate([
88
+ (0, mongoose_1.Schema)({ timestamps: true, collection: 'conversation_cards' })
89
+ ], Conversation);
90
+ exports.ConversationSchema = mongoose_1.SchemaFactory.createForClass(Conversation);
91
+ exports.ConversationSchema.pre('save', function (next) {
92
+ if (this.isNew) {
93
+ this.id = this._id.toString();
94
+ }
95
+ next();
96
+ });
97
+ //# sourceMappingURL=conversation.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.entity.js","sourceRoot":"","sources":["../../src/entities/conversation.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAA+D;AAC/D,uCAA8D;AAC9D,6EAAsH;AAK/G,IAAM,YAAY,GAAlB,MAAM,YAAY;CAkExB,CAAA;AAlEY,oCAAY;AAEvB;IADC,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,iBAAc,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACrD,iBAAc,CAAC,KAAK,CAAC,QAAQ;yCAAC;AAG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8BACI,IAAI;+CAAC;uBAjEL,YAAY;IADxB,IAAA,iBAAM,EAAC,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;GAClD,YAAY,CAkExB;AAEY,QAAA,kBAAkB,GAAG,wBAAa,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC;AAE7E,0BAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI;IAC3C,IAAI,IAAI,CAAC,KAAK,EAAE;QACd,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;KAC/B;IACD,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './conversation-cards.module';
2
+ export * from './services/conversation-cards.service';
3
+ export * from './controllers/conversation-ai.controller';
4
+ export * from './services/conversation-ai.service';
5
+ export * from './services/conversation-card-models.service';
6
+ export * from './clases/conversation.interface';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uCAAuC,CAAC;AACtD,cAAc,0CAA0C,CAAC;AACzD,cAAc,oCAAoC,CAAC;AACnD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iCAAiC,CAAC"}
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("./controllers/conversation-ai.controller"), exports);
20
+ __exportStar(require("./services/conversation-ai.service"), exports);
21
+ __exportStar(require("./services/conversation-card-models.service"), exports);
22
+ __exportStar(require("./clases/conversation.interface"), exports);
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,wEAAsD;AACtD,2EAAyD;AACzD,qEAAmD;AACnD,8EAA4D;AAC5D,kEAAgD"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=audio-transcription.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-transcription.service.d.ts","sourceRoot":"","sources":["../../src/services/audio-transcription.service.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=audio-transcription.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audio-transcription.service.js","sourceRoot":"","sources":["../../src/services/audio-transcription.service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,28 @@
1
+ import { Model } from 'mongoose';
2
+ import { IConversationCard } from '../clases/conversation.interface';
3
+ import { Conversation, ConversationDocument } from '../entities/conversation.entity';
4
+ export declare class FiltersConfig {
5
+ page: number;
6
+ rowsPerPage: number;
7
+ sort: Record<string, any>;
8
+ filters: Record<string, any>;
9
+ text: string;
10
+ }
11
+ export declare class ConversationAiService {
12
+ private conversationModel;
13
+ private readonly groqClient;
14
+ constructor(conversationModel: Model<ConversationDocument>);
15
+ saveConversation(conversation: IConversationCard): Promise<ConversationDocument>;
16
+ updateConversation(id: string, updateData: Partial<Conversation>): Promise<ConversationDocument>;
17
+ getConversations(): Promise<ConversationDocument[]>;
18
+ queryConversations(pQuery: FiltersConfig): Promise<{
19
+ count: number;
20
+ page: number;
21
+ rows: any;
22
+ rowsPerPage: number;
23
+ skip: number;
24
+ }>;
25
+ getConversationById(id: string): Promise<ConversationDocument>;
26
+ deleteConversationById(id: string): Promise<ConversationDocument>;
27
+ }
28
+ //# sourceMappingURL=conversation-ai.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-ai.service.d.ts","sourceRoot":"","sources":["../../src/services/conversation-ai.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAErF,qBAAa,aAAa;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qBACa,qBAAqB;IAGY,OAAO,CAAC,iBAAiB;IAFrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAO;gBAEkB,iBAAiB,EAAE,KAAK,CAAC,oBAAoB,CAAC;IAM5F,gBAAgB,CAAC,YAAY,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAShF,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAKhG,gBAAgB,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAKnD,kBAAkB,CAAC,MAAM,EAAE,aAAa;;;;;;;IAwBxC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAK9D,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAIxE"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ConversationAiService = exports.FiltersConfig = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const mongoose_1 = require("@nestjs/mongoose");
18
+ const mongoose_2 = require("mongoose");
19
+ const groq_sdk_1 = require("groq-sdk");
20
+ const mongodb_1 = require("mongodb");
21
+ const conversation_entity_1 = require("../entities/conversation.entity");
22
+ class FiltersConfig {
23
+ }
24
+ exports.FiltersConfig = FiltersConfig;
25
+ let ConversationAiService = class ConversationAiService {
26
+ constructor(conversationModel) {
27
+ this.conversationModel = conversationModel;
28
+ this.groqClient = new groq_sdk_1.default({
29
+ apiKey: process.env['GROQ_API_KEY'],
30
+ });
31
+ }
32
+ async saveConversation(conversation) {
33
+ if (!conversation['_id']) {
34
+ delete conversation['_id'];
35
+ }
36
+ const newConversation = new this.conversationModel(conversation);
37
+ return newConversation.save();
38
+ }
39
+ async updateConversation(id, updateData) {
40
+ const _id = new mongodb_1.ObjectId(id);
41
+ return this.conversationModel.findByIdAndUpdate(_id, updateData, { new: true }).exec();
42
+ }
43
+ async getConversations() {
44
+ return this.conversationModel.find().limit(5).exec();
45
+ }
46
+ async queryConversations(pQuery) {
47
+ const scenarioModel = this.conversationModel;
48
+ const skip = pQuery.rowsPerPage * pQuery.page;
49
+ let query;
50
+ let count = 0;
51
+ if (pQuery.text) {
52
+ pQuery.filters = { ...(pQuery.filters || {}), $text: { $search: pQuery.text } };
53
+ query = scenarioModel.find(pQuery.filters).skip(skip).limit(pQuery.rowsPerPage);
54
+ }
55
+ else {
56
+ pQuery.filters = pQuery.filters || {};
57
+ count = await scenarioModel.countDocuments(pQuery.filters);
58
+ query = scenarioModel.find(pQuery.filters).skip(skip).limit(pQuery.rowsPerPage);
59
+ if (pQuery.sort) {
60
+ query = query.sort(pQuery.sort);
61
+ }
62
+ }
63
+ const scenarios = await query.lean().exec();
64
+ const results = { count, page: pQuery.page, rows: scenarios, rowsPerPage: pQuery.rowsPerPage, skip };
65
+ return results;
66
+ }
67
+ async getConversationById(id) {
68
+ const _id = new mongodb_1.ObjectId(id);
69
+ return this.conversationModel.findById(_id).exec();
70
+ }
71
+ async deleteConversationById(id) {
72
+ const _id = new mongodb_1.ObjectId(id);
73
+ return this.conversationModel.findByIdAndDelete(_id).exec();
74
+ }
75
+ };
76
+ exports.ConversationAiService = ConversationAiService;
77
+ exports.ConversationAiService = ConversationAiService = __decorate([
78
+ (0, common_1.Injectable)(),
79
+ __param(0, (0, mongoose_1.InjectModel)(conversation_entity_1.Conversation.name)),
80
+ __metadata("design:paramtypes", [mongoose_2.Model])
81
+ ], ConversationAiService);
82
+ //# sourceMappingURL=conversation-ai.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-ai.service.js","sourceRoot":"","sources":["../../src/services/conversation-ai.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;A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,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,EAAU;QACrC,MAAM,GAAG,GAAG,IAAI,kBAAQ,CAAC,EAAE,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9D,CAAC;CACF,CAAA;AA7DY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,sBAAW,EAAC,kCAAY,CAAC,IAAI,CAAC,CAAA;qCAA4B,gBAAK;GAHjE,qBAAqB,CA6DjC"}
@@ -0,0 +1,13 @@
1
+ import { Model } from 'mongoose';
2
+ import { ChatCompletionMessageParam } from 'groq-sdk/resources/chat/completions';
3
+ import { ChatMessageDict } from '../clases/conversation.interface';
4
+ import { ConversationDocument } from '../entities/conversation.entity';
5
+ export declare class ConversationCardModelService {
6
+ private conversationModel;
7
+ private readonly groqClient;
8
+ constructor(conversationModel: Model<ConversationDocument>);
9
+ chat(messages: ChatCompletionMessageParam[]): Promise<ChatMessageDict>;
10
+ generateCompletion(prompt: string): Promise<string>;
11
+ getCompletion(prompt: string): Promise<string>;
12
+ }
13
+ //# sourceMappingURL=conversation-card-models.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-card-models.service.d.ts","sourceRoot":"","sources":["../../src/services/conversation-card-models.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,OAAO,EAAE,eAAe,EAAY,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EAAgB,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAErF,qBACa,4BAA4B;IAGK,OAAO,CAAC,iBAAiB;IAFrE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAO;gBAEkB,iBAAiB,EAAE,KAAK,CAAC,oBAAoB,CAAC;IAM5F,IAAI,CAAC,QAAQ,EAAE,0BAA0B,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IAkBtE,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAenD,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAcrD"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ConversationCardModelService = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const mongoose_1 = require("@nestjs/mongoose");
18
+ const mongoose_2 = require("mongoose");
19
+ const groq_sdk_1 = require("groq-sdk");
20
+ const conversation_interface_1 = require("../clases/conversation.interface");
21
+ const conversation_entity_1 = require("../entities/conversation.entity");
22
+ let ConversationCardModelService = class ConversationCardModelService {
23
+ constructor(conversationModel) {
24
+ this.conversationModel = conversationModel;
25
+ this.groqClient = new groq_sdk_1.default({
26
+ apiKey: process.env['GROQ_API_KEY'],
27
+ });
28
+ }
29
+ async chat(messages) {
30
+ try {
31
+ const completion = await this.groqClient.chat.completions.create({
32
+ messages,
33
+ model: 'mixtral-8x7b-32768',
34
+ temperature: 0.7,
35
+ max_tokens: 1024,
36
+ });
37
+ return {
38
+ content: completion.choices[0]?.message?.content || '',
39
+ role: conversation_interface_1.ChatRole.Assistant,
40
+ metadata: null,
41
+ };
42
+ }
43
+ catch (error) {
44
+ throw new Error(`Failed to generate completion: ${error.message}`);
45
+ }
46
+ }
47
+ async generateCompletion(prompt) {
48
+ try {
49
+ const completion = await this.groqClient.chat.completions.create({
50
+ messages: [{ role: 'user', content: prompt }],
51
+ model: 'mixtral-8x7b-32768',
52
+ temperature: 0.7,
53
+ max_tokens: 1024,
54
+ });
55
+ return completion.choices[0]?.message?.content || '';
56
+ }
57
+ catch (error) {
58
+ throw new Error(`Failed to generate completion: ${error.message}`);
59
+ }
60
+ }
61
+ async getCompletion(prompt) {
62
+ try {
63
+ const completion = await this.groqClient.chat.completions.create({
64
+ messages: [{ role: 'user', content: prompt }],
65
+ model: 'mixtral-8x7b-32768',
66
+ temperature: 0.7,
67
+ max_tokens: 1024,
68
+ });
69
+ return completion.choices[0]?.message?.content || '';
70
+ }
71
+ catch (error) {
72
+ throw new Error(`Failed to generate completion: ${error.message}`);
73
+ }
74
+ }
75
+ };
76
+ exports.ConversationCardModelService = ConversationCardModelService;
77
+ exports.ConversationCardModelService = ConversationCardModelService = __decorate([
78
+ (0, common_1.Injectable)(),
79
+ __param(0, (0, mongoose_1.InjectModel)(conversation_entity_1.Conversation.name)),
80
+ __metadata("design:paramtypes", [mongoose_2.Model])
81
+ ], ConversationCardModelService);
82
+ //# sourceMappingURL=conversation-card-models.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-card-models.service.js","sourceRoot":"","sources":["../../src/services/conversation-card-models.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA+C;AAC/C,uCAAiC;AACjC,uCAA4B;AAG5B,6EAA6E;AAC7E,yEAAqF;AAG9E,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B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AAC,OAAO,EAAE,CAAC,CAAC;SACpE;IACH,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAc;QAChC,IAAI;YACF,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;gBAC/D,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;gBAC7C,KAAK,EAAE,oBAAoB;gBAC3B,WAAW,EAAE,GAAG;gBAChB,UAAU,EAAE,IAAI;aACjB,CAAC,CAAC;YAEH,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC;SACtD;QAAC,OAAO,KAAK,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;SACpE;IACH,CAAC;CACF,CAAA;AAxDY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,mBAAU,GAAE;IAIE,WAAA,IAAA,sBAAW,EAAC,kCAAY,CAAC,IAAI,CAAC,CAAA;qCAA4B,gBAAK;GAHjE,4BAA4B,CAwDxC"}
@@ -0,0 +1,3 @@
1
+ export declare class ConversationCardsService {
2
+ }
3
+ //# sourceMappingURL=conversation-cards.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-cards.service.d.ts","sourceRoot":"","sources":["../../src/services/conversation-cards.service.ts"],"names":[],"mappings":"AAEA,qBACa,wBAAwB;CAAG"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.ConversationCardsService = void 0;
10
+ const common_1 = require("@nestjs/common");
11
+ let ConversationCardsService = class ConversationCardsService {
12
+ };
13
+ exports.ConversationCardsService = ConversationCardsService;
14
+ exports.ConversationCardsService = ConversationCardsService = __decorate([
15
+ (0, common_1.Injectable)()
16
+ ], ConversationCardsService);
17
+ //# sourceMappingURL=conversation-cards.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-cards.service.js","sourceRoot":"","sources":["../../src/services/conversation-cards.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAAG,CAAA;AAA3B,4DAAwB;mCAAxB,wBAAwB;IADpC,IAAA,mBAAU,GAAE;GACA,wBAAwB,CAAG"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=tts-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tts-service.d.ts","sourceRoot":"","sources":["../../src/tts/tts-service.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=tts-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tts-service.js","sourceRoot":"","sources":["../../src/tts/tts-service.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ export declare enum AudioSpeed {
2
+ VerySlow = "VerySlow",
3
+ Slow = "Slow",
4
+ Regular = "Regular",
5
+ Fast = "Fast",
6
+ VeryFast = "VeryFast"
7
+ }
8
+ export declare enum VoiceCode {
9
+ MX = "MX"
10
+ }
11
+ export declare const GoogleVoiceHQOptions: VoiceOption[];
12
+ export declare const GoogleVoiceOptions: VoiceOption[];
13
+ export interface SynthAudioOptions {
14
+ speed?: AudioSpeed;
15
+ speed_rate?: number;
16
+ }
17
+ export interface VoiceOption {
18
+ id: string;
19
+ lang: string;
20
+ name?: string;
21
+ provider?: string;
22
+ gender?: string;
23
+ exampleUrl?: string;
24
+ }
25
+ export declare class TTSDto {
26
+ text: string;
27
+ ssml: boolean;
28
+ voice: string;
29
+ speed: AudioSpeed;
30
+ speedRate: number;
31
+ generateTranscription: boolean;
32
+ }
33
+ //# sourceMappingURL=tts.classes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tts.classes.d.ts","sourceRoot":"","sources":["../../src/tts/tts.classes.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,oBAAY,SAAS;IACnB,EAAE,OAAO;CACV;AAMD,eAAO,MAAM,oBAAoB,EAAE,WAAW,EAI7C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,WAAW,EAyL3C,CAAC;AAIF,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,MAAM;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,OAAO,CAAC;CAChC"}