@ubs-platform/superlama-webservice 6.9.0
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/_monaembed/@ubs-platform/superlama-entity-mongo/chat-message-model.d.ts +28 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/chat-message-model.js +77 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/chat-message-model.js.map +1 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/chat-session.model.d.ts +20 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/chat-session.model.js +48 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/chat-session.model.js.map +1 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/index.d.ts +3 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/index.js +20 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/index.js.map +1 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/package.json +1 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/superlama-entity-mongo.module.d.ts +2 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/superlama-entity-mongo.module.js +28 -0
- package/_monaembed/@ubs-platform/superlama-entity-mongo/superlama-entity-mongo.module.js.map +1 -0
- package/controller/llm-models.controller.d.ts +6 -0
- package/controller/llm-models.controller.js +34 -0
- package/controller/llm-models.controller.js.map +1 -0
- package/controller/realtime-chat.controller.d.ts +16 -0
- package/controller/realtime-chat.controller.js +82 -0
- package/controller/realtime-chat.controller.js.map +1 -0
- package/controller/user-sessions.controlller.d.ts +7 -0
- package/controller/user-sessions.controlller.js +42 -0
- package/controller/user-sessions.controlller.js.map +1 -0
- package/index.d.ts +9 -0
- package/index.js +26 -0
- package/index.js.map +1 -0
- package/mapper/chat-message.mapper.d.ts +5 -0
- package/mapper/chat-message.mapper.js +33 -0
- package/mapper/chat-message.mapper.js.map +1 -0
- package/package.json +1 -0
- package/service/llm-operation.service.d.ts +12 -0
- package/service/llm-operation.service.js +126 -0
- package/service/llm-operation.service.js.map +1 -0
- package/service/realtime-chat-feeder.service.d.ts +23 -0
- package/service/realtime-chat-feeder.service.js +217 -0
- package/service/realtime-chat-feeder.service.js.map +1 -0
- package/service/realtime-chat.service.d.ts +19 -0
- package/service/realtime-chat.service.js +95 -0
- package/service/realtime-chat.service.js.map +1 -0
- package/service/session.service.d.ts +11 -0
- package/service/session.service.js +52 -0
- package/service/session.service.js.map +1 -0
- package/superlama-webservice.module.d.ts +2 -0
- package/superlama-webservice.module.js +45 -0
- package/superlama-webservice.module.js.map +1 -0
|
@@ -0,0 +1,126 @@
|
|
|
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.LlmOperationService = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const ollama_1 = require("ollama");
|
|
15
|
+
const rxjs_1 = require("rxjs");
|
|
16
|
+
let LlmOperationService = class LlmOperationService {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.ENV_KEY_U_SUPRLAMA_OLLAMA_URL = 'U_SUPERLAMA_OLLAMA_URL';
|
|
19
|
+
this.OLLAMA_URL = process.env[this.ENV_KEY_U_SUPRLAMA_OLLAMA_URL];
|
|
20
|
+
}
|
|
21
|
+
async fetchAvailableModels() {
|
|
22
|
+
return (await ollama_1.default.list()).models.map((a) => {
|
|
23
|
+
return {
|
|
24
|
+
name: a.name,
|
|
25
|
+
type: a.name.includes('deepseek') ? 'REASONABLE' : 'HERBOKOLOG',
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
generateTestoResponse(msgs) {
|
|
30
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
31
|
+
const testo = `<think>
|
|
32
|
+
Kyle Broflovski has always been considered one of the most intelligent children in South Park, and whenever crazy things are happening in South Park, Kyle and his super best friend, Stan, are there to provide the voice of reason and help resolve problems, often with a comforting 'gay little speech', something that has become Kyle's trademark amongst his friends... for better or for worse. He has a loving if stern father named Gerald, a local lawyer, and a mother, Sheila, known for her interest in social justice and politics, and of course, there's nobody Kyle cares more about than his little brother, Ike Broflovski -- despite the latter's adoption and the occasional game of 'kick the baby', they care about each other and Kyle will do anything to protect him, even go up against evil Visitors. All members of the Broflovski family are known for their strong moral centers and standing up for what they believe in... though not necessarily always to success. Nonetheless, even when times seem their darkest, Kyle will never back down from what he believes in.
|
|
33
|
+
|
|
34
|
+
</think>
|
|
35
|
+
Kyle Broflovski, South Park'ın Yahudi karakteri. Matt Stone tarafından seslendirilmektedir. Saçları Matt Stone'un saçlarına benzetilmek istenmiştir, zaten Kyle karakteri Stone'un çocukluğu baz alınarak oluşturulmuş bir karakterdir. Çizgi filmdeki dört ana karakterden biridir. Eric Cartman ile birbirlerinden ölesiye nefret etmelerine rağmen, birbirlerinin hayatlarını defalarca kurtarmışlardır. Kan grubu AB olup Cartman'ın kan grubuyla aynıdır. Ailesi çok tutucudur. Babası Gerald Broflovski bir avukat, annesi Sheila Broflovski ise bir ev hanımıdır. Kyle'ın İke isimli 5 yaşında, dahi, Kanadalı evlatlık bir kardeşi vardır. Fiziksel görünümü oldukça büyük, kızıl renkli kabarcık saçlara sahip olmasıyla dikkat çeker.Ancak saçlar şapkası nedeniyle görünmemektedir. Orta kiloda, 65 cm boyundadır.Ayrıca 5.sezonda dedelerinin Polonya'dan göçtüğünü öğreniyoruz.
|
|
36
|
+
|
|
37
|
+
En sevdiği arkadaşı ise Stan Marsh'tır. Eric Cartman başına buyruk bir karakter olduğundan ayrı tutulursa, çoğu durumda grubun lideri konumundadır.
|
|
38
|
+
|
|
39
|
+
Kenny'nin öldüğü her bölüm Stan "Oh my God, they killed Kenny!" (Aman Tanrım! Kenny'i öldürdüler!) der ve Kyle da ona eş olarak "You bastards!" (Sizi piçler!) der. Ama Kenny artık ölmediği için bu sözler duyulmaz. Ayrıca Kyle, turuncu bir mont, yeşil değişik bir şapka ve de koyu yeşil bir pantolon giyer.
|
|
40
|
+
|
|
41
|
+
Kyle kasabadaki sayılı Yahudilerden biridir ve bu yüzden kendini grup arkadaşlarından ve diğerlerinden dışlanmış hissetmektedir. Ülkedeki Yahudi kesimi temsil etmekte ve onun üzerinden bu gruba göndermeler yapılmaktadır.
|
|
42
|
+
|
|
43
|
+
Kyle'ın müzik, video oyunları ve basketbola karşı özel bir ilgisi ve yeteneği bulunmaktadır.
|
|
44
|
+
`
|
|
45
|
+
.split(' ')
|
|
46
|
+
.filter((a) => a);
|
|
47
|
+
for (let index = 0; index < testo.length; index++) {
|
|
48
|
+
setTimeout(() => {
|
|
49
|
+
const last = testo.length - 1 == index;
|
|
50
|
+
const element = testo[index] + ' ';
|
|
51
|
+
console.info(last);
|
|
52
|
+
subscriber.next({
|
|
53
|
+
done: last,
|
|
54
|
+
message: { content: element, role: 'assistant' },
|
|
55
|
+
created_at: new Date(),
|
|
56
|
+
model: 'Testo',
|
|
57
|
+
total_duration: 31.69,
|
|
58
|
+
});
|
|
59
|
+
if (last) {
|
|
60
|
+
subscriber.complete();
|
|
61
|
+
}
|
|
62
|
+
}, index * 50);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
generateResponse(msgs) {
|
|
67
|
+
return new rxjs_1.Observable((subscriber) => {
|
|
68
|
+
const tail = msgs[msgs.length - 1];
|
|
69
|
+
if (tail.senderType == 'USER') {
|
|
70
|
+
const modelName = tail;
|
|
71
|
+
const outputx = ollama_1.default.chat({
|
|
72
|
+
model: modelName.requestedLlmModel,
|
|
73
|
+
stream: true,
|
|
74
|
+
messages: msgs.map((a) => {
|
|
75
|
+
return {
|
|
76
|
+
content: a.textContent,
|
|
77
|
+
role: a.senderType == 'USER'
|
|
78
|
+
? 'user'
|
|
79
|
+
: a.senderType == 'ASSISTANT'
|
|
80
|
+
? 'assistant'
|
|
81
|
+
: 'system',
|
|
82
|
+
};
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
85
|
+
const asyncOp = async () => {
|
|
86
|
+
for await (const part of await outputx) {
|
|
87
|
+
subscriber.next(part);
|
|
88
|
+
if (part.done) {
|
|
89
|
+
subscriber.complete();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
asyncOp();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async generateTitleLast(assistantResponse) {
|
|
98
|
+
if (assistantResponse.textContent.includes('Kyle Broflovski')) {
|
|
99
|
+
return 'Kyle Broflovski';
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const modelName = 'aya:8b';
|
|
103
|
+
const outputx = await ollama_1.default.chat({
|
|
104
|
+
model: modelName,
|
|
105
|
+
stream: false,
|
|
106
|
+
messages: [
|
|
107
|
+
{
|
|
108
|
+
content: assistantResponse.textContent,
|
|
109
|
+
role: 'assistant',
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
content: 'Potential title of text',
|
|
113
|
+
role: 'system',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
});
|
|
117
|
+
return outputx.message.content;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.LlmOperationService = LlmOperationService;
|
|
122
|
+
exports.LlmOperationService = LlmOperationService = __decorate([
|
|
123
|
+
(0, common_1.Injectable)(),
|
|
124
|
+
__metadata("design:paramtypes", [])
|
|
125
|
+
], LlmOperationService);
|
|
126
|
+
//# sourceMappingURL=llm-operation.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llm-operation.service.js","sourceRoot":"","sources":["../../../../../../libs/superlama-webservice/src/service/llm-operation.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAK5C,mCAA8C;AAE9C,+BAAkC;AAG3B,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAK5B;QAJiB,kCAA6B,GAAG,wBAAwB,CAAC;QACzD,eAAU,GACvB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IAErC,CAAC;IAEhB,KAAK,CAAC,oBAAoB;QAEtB,OAAO,CAAC,MAAM,gBAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1C,OAAO;gBACH,IAAI,EAAE,CAAC,CAAC,IAAI;gBACZ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY;aACnD,CAAC;QACrB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,qBAAqB,CAAC,IAAsB;QACxC,OAAO,IAAI,iBAAU,CAAe,CAAC,UAAU,EAAE,EAAE;YAC/C,MAAM,KAAK,GAAG;;;;;;;;;;;;;CAazB;iBACgB,KAAK,CAAC,GAAG,CAAC;iBACV,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;YACtB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;gBAChD,UAAU,CAAC,GAAG,EA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} from '@ubs-platform/superlama-entity-mongo';
|
|
4
|
+
import { ChatMessageDTO, ChatMessageStreamDTO, TextAssitantStage } from '@ubs-platform/superlama-common';
|
|
5
|
+
import { ChatMessageMapper } from '../mapper/chat-message.mapper';
|
|
6
|
+
import { LlmOperationService } from './llm-operation.service';
|
|
7
|
+
import { ClientKafka } from '@nestjs/microservices';
|
|
8
|
+
import { ChatResponse } from 'ollama';
|
|
9
|
+
export declare class RealtimeChatFeederService {
|
|
10
|
+
private chatMessageModel;
|
|
11
|
+
private chatSessionModel;
|
|
12
|
+
private chatMapper;
|
|
13
|
+
private llmOpService;
|
|
14
|
+
private kafkaClient;
|
|
15
|
+
constructor(chatMessageModel: Model<ChatMessage>, chatSessionModel: Model<ChatSession>, chatMapper: ChatMessageMapper, llmOpService: LlmOperationService, kafkaClient: ClientKafka);
|
|
16
|
+
handleCron(): Promise<void>;
|
|
17
|
+
generateAnswer(sessionId: string): Promise<void>;
|
|
18
|
+
auditMessage(assistantMessage: ChatMessage, sessionId: string, ollamaChatResponse: ChatResponse, assistantStage: TextAssitantStage): Promise<TextAssitantStage>;
|
|
19
|
+
saveGeneratedAnswer(stream: ChatMessageStreamDTO): Promise<void>;
|
|
20
|
+
setSessionStatus(sessionId: string, arg1: 'WAITING' | 'CONTINUING' | 'FINISHED'): Promise<void>;
|
|
21
|
+
finishSession(assistantMessage: ChatMessageDTO): Promise<void>;
|
|
22
|
+
private findMessagesBySessionIdPaged;
|
|
23
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
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.RealtimeChatFeederService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
18
|
+
const superlama_entity_mongo_1 = require("../_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
19
|
+
const mongoose_2 = require("mongoose");
|
|
20
|
+
const superlama_entity_mongo_2 = require("../_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
21
|
+
const chat_message_mapper_1 = require("../mapper/chat-message.mapper");
|
|
22
|
+
const llm_operation_service_1 = require("./llm-operation.service");
|
|
23
|
+
const microservices_1 = require("@nestjs/microservices");
|
|
24
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
25
|
+
const microservice_setup_util_1 = require("@ubs-platform/microservice-setup-util");
|
|
26
|
+
let RealtimeChatFeederService = class RealtimeChatFeederService {
|
|
27
|
+
constructor(chatMessageModel, chatSessionModel, chatMapper, llmOpService, kafkaClient) {
|
|
28
|
+
this.chatMessageModel = chatMessageModel;
|
|
29
|
+
this.chatSessionModel = chatSessionModel;
|
|
30
|
+
this.chatMapper = chatMapper;
|
|
31
|
+
this.llmOpService = llmOpService;
|
|
32
|
+
this.kafkaClient = kafkaClient;
|
|
33
|
+
}
|
|
34
|
+
async handleCron() {
|
|
35
|
+
const parallels = await this.chatSessionModel.countDocuments({
|
|
36
|
+
llmAnswerStatus: 'CONTINUING',
|
|
37
|
+
});
|
|
38
|
+
if (parallels > 0) {
|
|
39
|
+
console.debug('Waiting for complete one');
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const waitings = await this.chatSessionModel.find({
|
|
43
|
+
llmAnswerStatus: 'WAITING',
|
|
44
|
+
});
|
|
45
|
+
if (waitings.length > 0) {
|
|
46
|
+
this.generateAnswer(waitings[0]._id);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
generateAnswer(sessionId) {
|
|
51
|
+
return new Promise(async (ok, fail) => {
|
|
52
|
+
try {
|
|
53
|
+
const allMsgs_ = await this.findMessagesBySessionIdPaged(sessionId);
|
|
54
|
+
const lastUserMessage = allMsgs_.find((a) => a.senderType == 'USER');
|
|
55
|
+
if (lastUserMessage) {
|
|
56
|
+
await this.setSessionStatus(sessionId, 'CONTINUING');
|
|
57
|
+
const allMsgs = allMsgs_
|
|
58
|
+
.reverse()
|
|
59
|
+
.map((a) => this.chatMapper.messageToDto(a));
|
|
60
|
+
let assistantMessage = new this.chatMessageModel({
|
|
61
|
+
sessionId: sessionId,
|
|
62
|
+
requestedLlmModel: lastUserMessage.requestedLlmModel,
|
|
63
|
+
moderationNoteWarning: '',
|
|
64
|
+
createdAt: new Date(),
|
|
65
|
+
updatedAt: new Date(),
|
|
66
|
+
assistantStartedAt: new Date(),
|
|
67
|
+
senderType: 'ASSISTANT',
|
|
68
|
+
textAssistantStage: 'ANSWER',
|
|
69
|
+
thoughtTextContent: '',
|
|
70
|
+
systemTextContent: '',
|
|
71
|
+
textContent: '',
|
|
72
|
+
assistantTargetMessageId: lastUserMessage._id,
|
|
73
|
+
});
|
|
74
|
+
assistantMessage = await assistantMessage.save();
|
|
75
|
+
let assistantStage = 'ANSWER';
|
|
76
|
+
(lastUserMessage.textContent.trim().startsWith('test')
|
|
77
|
+
? this.llmOpService.generateTestoResponse(allMsgs)
|
|
78
|
+
: this.llmOpService.generateResponse(allMsgs)).subscribe(async (a) => {
|
|
79
|
+
assistantStage = await this.auditMessage(assistantMessage, sessionId, a, assistantStage);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
ok();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
fail(error);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async auditMessage(assistantMessage, sessionId, ollamaChatResponse, assistantStage) {
|
|
92
|
+
let data = {
|
|
93
|
+
_id: assistantMessage._id,
|
|
94
|
+
sessionId,
|
|
95
|
+
streamMode: 'APPEND',
|
|
96
|
+
requestedLlmModel: assistantMessage.requestedLlmModel,
|
|
97
|
+
textContent: '',
|
|
98
|
+
thoughtTextContent: '',
|
|
99
|
+
senderType: 'ASSISTANT',
|
|
100
|
+
};
|
|
101
|
+
let msg = ollamaChatResponse.message.content || '';
|
|
102
|
+
if (msg.includes('<think>')) {
|
|
103
|
+
assistantStage = 'THINKING';
|
|
104
|
+
msg = '';
|
|
105
|
+
}
|
|
106
|
+
else if (msg.includes('</think>')) {
|
|
107
|
+
assistantStage = 'ANSWER';
|
|
108
|
+
msg = '';
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
if (assistantStage == 'ANSWER') {
|
|
112
|
+
data.textContent = msg || '';
|
|
113
|
+
}
|
|
114
|
+
else if (assistantStage == 'THINKING') {
|
|
115
|
+
data.thoughtTextContent = msg || '';
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
data.textAssistantStage = assistantStage;
|
|
119
|
+
this.kafkaClient.emit('llm-result', data);
|
|
120
|
+
if (ollamaChatResponse.done) {
|
|
121
|
+
this.kafkaClient.emit('llm-result', {
|
|
122
|
+
_id: assistantMessage._id,
|
|
123
|
+
tokensPerSecond: 0,
|
|
124
|
+
sessionId,
|
|
125
|
+
requestedLlmModel: assistantMessage.requestedLlmModel,
|
|
126
|
+
textAssistantStage: 'DONE',
|
|
127
|
+
streamMode: 'APPEND',
|
|
128
|
+
senderType: 'ASSISTANT',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return assistantStage;
|
|
132
|
+
}
|
|
133
|
+
async saveGeneratedAnswer(stream) {
|
|
134
|
+
let msg = await this.chatMessageModel.findById(stream._id);
|
|
135
|
+
if (msg) {
|
|
136
|
+
if (msg.textAssistantStage != 'DONE') {
|
|
137
|
+
msg.assistantFinishedAt = new Date();
|
|
138
|
+
msg.textAssistantStage = stream.textAssistantStage;
|
|
139
|
+
msg.textContent += stream.textContent || '';
|
|
140
|
+
msg.thoughtTextContent += stream.thoughtTextContent || '';
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
console.warn("Session already completed but why come after done i don't know");
|
|
144
|
+
}
|
|
145
|
+
await msg.save();
|
|
146
|
+
if (msg.textAssistantStage == 'DONE') {
|
|
147
|
+
await this.finishSession(this.chatMapper.messageToDto(msg));
|
|
148
|
+
}
|
|
149
|
+
console.info(msg.textAssistantStage);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
throw new common_1.NotFoundException('ChatMessage', stream._id);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
async setSessionStatus(sessionId, arg1) {
|
|
156
|
+
const session = (await this.chatSessionModel
|
|
157
|
+
.findById(sessionId)
|
|
158
|
+
.exec());
|
|
159
|
+
session.llmAnswerStatus = arg1;
|
|
160
|
+
await session.save();
|
|
161
|
+
}
|
|
162
|
+
async finishSession(assistantMessage) {
|
|
163
|
+
let subject = '';
|
|
164
|
+
try {
|
|
165
|
+
subject =
|
|
166
|
+
await this.llmOpService.generateTitleLast(assistantMessage);
|
|
167
|
+
}
|
|
168
|
+
catch (ex) {
|
|
169
|
+
console.error(ex);
|
|
170
|
+
subject = assistantMessage.textContent.substring(0, 10);
|
|
171
|
+
}
|
|
172
|
+
const session = (await this.chatSessionModel
|
|
173
|
+
.findById(assistantMessage.sessionId)
|
|
174
|
+
.exec());
|
|
175
|
+
session.llmAnswerStatus = 'FINISHED';
|
|
176
|
+
session.subjectTitle = subject;
|
|
177
|
+
await session.save();
|
|
178
|
+
}
|
|
179
|
+
async findMessagesBySessionIdPaged(sessionId, beforeDate = new Date(), lastChatMessageId) {
|
|
180
|
+
if (beforeDate instanceof Date) {
|
|
181
|
+
beforeDate = beforeDate.toISOString();
|
|
182
|
+
}
|
|
183
|
+
const msgs = await this.chatMessageModel
|
|
184
|
+
.find({
|
|
185
|
+
sessionId,
|
|
186
|
+
createdAt: {
|
|
187
|
+
$lte: beforeDate,
|
|
188
|
+
},
|
|
189
|
+
...(lastChatMessageId
|
|
190
|
+
? { _id: { $not: lastChatMessageId } }
|
|
191
|
+
: {}),
|
|
192
|
+
})
|
|
193
|
+
.sort({ createdAt: 'desc' })
|
|
194
|
+
.limit(10)
|
|
195
|
+
.exec();
|
|
196
|
+
return msgs;
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
exports.RealtimeChatFeederService = RealtimeChatFeederService;
|
|
200
|
+
__decorate([
|
|
201
|
+
(0, schedule_1.Cron)('*/5 * * * * *'),
|
|
202
|
+
__metadata("design:type", Function),
|
|
203
|
+
__metadata("design:paramtypes", []),
|
|
204
|
+
__metadata("design:returntype", Promise)
|
|
205
|
+
], RealtimeChatFeederService.prototype, "handleCron", null);
|
|
206
|
+
exports.RealtimeChatFeederService = RealtimeChatFeederService = __decorate([
|
|
207
|
+
(0, common_1.Injectable)(),
|
|
208
|
+
__param(0, (0, mongoose_1.InjectModel)(superlama_entity_mongo_1.ChatMessage.name)),
|
|
209
|
+
__param(1, (0, mongoose_1.InjectModel)(superlama_entity_mongo_2.ChatSession.name)),
|
|
210
|
+
__param(4, (0, common_1.Inject)(microservice_setup_util_1.MICROSERVICE_CLIENT)),
|
|
211
|
+
__metadata("design:paramtypes", [mongoose_2.Model,
|
|
212
|
+
mongoose_2.Model,
|
|
213
|
+
chat_message_mapper_1.ChatMessageMapper,
|
|
214
|
+
llm_operation_service_1.LlmOperationService,
|
|
215
|
+
microservices_1.ClientKafka])
|
|
216
|
+
], RealtimeChatFeederService);
|
|
217
|
+
//# sourceMappingURL=realtime-chat-feeder.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-chat-feeder.service.js","sourceRoot":"","sources":["../../../../../../libs/superlama-webservice/src/service/realtime-chat-feeder.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,+CAA+C;AAC/C,iFAAmF;AACnF,uCAA2C;AAC3C,iFAAmF;AAQnF,uEAAkE;AAElE,mEAA8D;AAC9D,yDAAoD;AACpD,+CAAwC;AAGxC,mFAA4E;AAGrE,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IAGlC,YAEY,gBAAoC,EAEpC,gBAAoC,EACpC,UAA6B,EAC7B,YAAiC,EACJ,WAAwB;QALrD,qBAAgB,GAAhB,gBAAgB,CAAoB;QAEpC,qBAAgB,GAAhB,gBAAgB,CAAoB;QACpC,eAAU,GAAV,UAAU,CAAmB;QAC7B,iBAAY,GAAZ,YAAY,CAAqB;QACJ,gBAAW,GAAX,WAAW,CAAa;IAC9D,CAAC;IAGE,AAAN,KAAK,CAAC,UAAU;QACZ,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,cAAc,CAAC;YACzD,eAAe,EAAE,YAAY;SAChC,CAAC,CAAC;QACH,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACJ,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBAC9C,eAAe,EAAE,SAAS;aAC7B,CAAC,CAAC;YACH,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACtB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;IACL,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/B,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IACzB,CAAC;IAQO,KAAK,CAAC,4BAA4B,CACtC,SAAiB,EACjB,aAA4B,IAAI,IAAI,EAAE,EACtC,iBAA0B;QAE1B,IAAI,UAAU,YAAY,IAAI,EAAE,CAAC;YAC7B,UAAU,GAAG,UAAU,CAAC,WAAW,EAAE,CAAC;QAC1C,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,gBAAgB;aACnC,IAAI,CAAC;YACF,SAAS;YACT,SAAS,EAAE;gBACP,IAAI,EAAE,UAAU;aACnB;YACD,GAAG,CAAC,iBAAiB;gBACjB,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE;gBACtC,CAAC,CAAC,EAAE,CAAC;SACZ,CAAC;aACD,IAAI,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;aAC3B,KAAK,CAAC,EAAE,CAAC;aACT,IAAI,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AArNY,8DAAyB;AAc5B;IADL,IAAA,eAAI,EAAC,eAAe,CAAC;;;;2DAerB;oCA5BQ,yBAAyB;IADrC,IAAA,mBAAU,GAAE;IAKJ,WAAA,IAAA,sBAAW,EAAC,oCAAW,CAAC,IAAI,CAAC,CAAA;IAE7B,WAAA,IAAA,sBAAW,EAAC,oCAAW,CAAC,IAAI,CAAC,CAAA;IAI7B,WAAA,IAAA,eAAM,EAAC,6CAAmB,CAAC,CAAA;qCALF,gBAAK;QAEL,gBAAK;QACX,uCAAiB;QACf,2CAAmB;QACS,2BAAW;GAVxD,yBAAyB,CAqNrC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChatMessage } from '@ubs-platform/superlama-entity-mongo';
|
|
2
|
+
import { Model } from 'mongoose';
|
|
3
|
+
import { ChatSession } from '@ubs-platform/superlama-entity-mongo';
|
|
4
|
+
import { UserSendingMessageDto } from '@ubs-platform/superlama-common';
|
|
5
|
+
import { UserDTO } from '@ubs-platform/users-common';
|
|
6
|
+
import { ChatMessageMapper } from '../mapper/chat-message.mapper';
|
|
7
|
+
export declare class RealtimeChatService {
|
|
8
|
+
private chatMessageModel;
|
|
9
|
+
private chatSessionModel;
|
|
10
|
+
private chatMapper;
|
|
11
|
+
constructor(chatMessageModel: Model<ChatMessage>, chatSessionModel: Model<ChatSession>, chatMapper: ChatMessageMapper);
|
|
12
|
+
insertUserMessage(dto: UserSendingMessageDto, user: UserDTO): Promise<import("@ubs-platform/superlama-common").ChatMessageDTO>;
|
|
13
|
+
findMessagesBySessionId(sessionId: string): Promise<(import("mongoose").Document<unknown, {}, ChatMessage, {}> & ChatMessage & Required<{
|
|
14
|
+
_id: String;
|
|
15
|
+
}> & {
|
|
16
|
+
__v: number;
|
|
17
|
+
})[]>;
|
|
18
|
+
findMessagesBySessionIdPaged(sessionId: string, beforeDate?: String | Date, lastChatMessageId?: String): Promise<import("@ubs-platform/superlama-common").ChatMessageDTO[]>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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.RealtimeChatService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
18
|
+
const superlama_entity_mongo_1 = require("../_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
19
|
+
const mongoose_2 = require("mongoose");
|
|
20
|
+
const superlama_entity_mongo_2 = require("../_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
21
|
+
const chat_message_mapper_1 = require("../mapper/chat-message.mapper");
|
|
22
|
+
let RealtimeChatService = class RealtimeChatService {
|
|
23
|
+
constructor(chatMessageModel, chatSessionModel, chatMapper) {
|
|
24
|
+
this.chatMessageModel = chatMessageModel;
|
|
25
|
+
this.chatSessionModel = chatSessionModel;
|
|
26
|
+
this.chatMapper = chatMapper;
|
|
27
|
+
}
|
|
28
|
+
async insertUserMessage(dto, user) {
|
|
29
|
+
let session;
|
|
30
|
+
if (dto.newSession) {
|
|
31
|
+
session = new this.chatSessionModel({
|
|
32
|
+
userParticipantsIds: [user.id],
|
|
33
|
+
moderationNoteWarning: '',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
session = (await this.chatSessionModel
|
|
38
|
+
.findById(dto.sessionId)
|
|
39
|
+
.exec());
|
|
40
|
+
}
|
|
41
|
+
session.llmAnswerStatus = 'WAITING';
|
|
42
|
+
await session.save();
|
|
43
|
+
const message = new this.chatMessageModel({
|
|
44
|
+
sessionId: session._id,
|
|
45
|
+
moderationNoteWarning: '',
|
|
46
|
+
createdAt: new Date(),
|
|
47
|
+
updatedAt: new Date(),
|
|
48
|
+
senderType: 'USER',
|
|
49
|
+
requestedLlmModel: dto.selectedLlm,
|
|
50
|
+
textAssistantStage: '',
|
|
51
|
+
thoughtTextContent: '',
|
|
52
|
+
senderId: user.id,
|
|
53
|
+
systemTextContent: '',
|
|
54
|
+
textContent: dto.message,
|
|
55
|
+
});
|
|
56
|
+
const msgSaved = await message.save();
|
|
57
|
+
const msgDto = await this.chatMapper.messageToDto(msgSaved);
|
|
58
|
+
return msgDto;
|
|
59
|
+
}
|
|
60
|
+
async findMessagesBySessionId(sessionId) {
|
|
61
|
+
const msgs = await this.chatMessageModel.find({
|
|
62
|
+
sessionId,
|
|
63
|
+
});
|
|
64
|
+
return msgs;
|
|
65
|
+
}
|
|
66
|
+
async findMessagesBySessionIdPaged(sessionId, beforeDate = new Date(), lastChatMessageId) {
|
|
67
|
+
if (beforeDate instanceof Date) {
|
|
68
|
+
beforeDate = beforeDate.toISOString();
|
|
69
|
+
}
|
|
70
|
+
const msgs = await this.chatMessageModel
|
|
71
|
+
.find({
|
|
72
|
+
sessionId,
|
|
73
|
+
createdAt: {
|
|
74
|
+
$lte: beforeDate,
|
|
75
|
+
},
|
|
76
|
+
...(lastChatMessageId
|
|
77
|
+
? { _id: { $not: lastChatMessageId } }
|
|
78
|
+
: {}),
|
|
79
|
+
})
|
|
80
|
+
.sort({ createdAt: 'desc' })
|
|
81
|
+
.limit(10)
|
|
82
|
+
.exec();
|
|
83
|
+
return msgs.map((a) => this.chatMapper.messageToDto(a));
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.RealtimeChatService = RealtimeChatService;
|
|
87
|
+
exports.RealtimeChatService = RealtimeChatService = __decorate([
|
|
88
|
+
(0, common_1.Injectable)(),
|
|
89
|
+
__param(0, (0, mongoose_1.InjectModel)(superlama_entity_mongo_1.ChatMessage.name)),
|
|
90
|
+
__param(1, (0, mongoose_1.InjectModel)(superlama_entity_mongo_2.ChatSession.name)),
|
|
91
|
+
__metadata("design:paramtypes", [mongoose_2.Model,
|
|
92
|
+
mongoose_2.Model,
|
|
93
|
+
chat_message_mapper_1.ChatMessageMapper])
|
|
94
|
+
], RealtimeChatService);
|
|
95
|
+
//# sourceMappingURL=realtime-chat.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"realtime-chat.service.js","sourceRoot":"","sources":["../../../../../../libs/superlama-webservice/src/service/realtime-chat.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA+C;AAC/C,iFAAmE;AACnE,uCAAiC;AACjC,iFAAmE;AAKnE,uEAAkE;AAG3D,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAG5B,YAEY,gBAAoC,EAEpC,gBAAoC,EACpC,UAA6B;QAH7B,qBAAgB,GAAhB,gBAAgB,CAAoB;QAEpC,qBAAgB,GAAhB,gBAAgB,CAAoB;QACpC,eAAU,GAAV,UAAU,CAAmB;IACtC,CAAC;IAEJ,KAAK,CAAC,iBAAiB,CAAC,GAA0B,EAAE,IAAa;QAC7D,IAAI,OAAoB,CAAC;QACzB,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;YACjB,OAAO,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC;gBAChC,mBAAmB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9B,qBAAqB,EAAE,EAAE;aAC5B,CAAC,CAAC;QACP,CAAC;aAAM,CAAC;YACJ,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,gBAAgB;iBACjC,QAAQ,CAAC,GAAG,CAAC,SAAU,CAAC;iBACxB,IAAI,EAAE,CAAE,CAAC;QAClB,CAAC;QACD,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC;QACpC,MAAO,OAAe,CAAC,IAAI,EAAE,CAAC;QAE9B,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,gBAAgB,CAAC;YACtC,SAAS,EAAE,OAAO,CAAC,GAAG;YACtB,qBAAqB,EAAE,EAAE;YACzB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,UAAU,EAAE,MAAM;YAClB,iBAAiB,EAAE,GAAG,CAAC,WAAW;YACl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;CACJ,CAAA;AA5EY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;IAKJ,WAAA,IAAA,sBAAW,EAAC,oCAAW,CAAC,IAAI,CAAC,CAAA;IAE7B,WAAA,IAAA,sBAAW,EAAC,oCAAW,CAAC,IAAI,CAAC,CAAA;qCADJ,gBAAK;QAEL,gBAAK;QACX,uCAAiB;GARhC,mBAAmB,CA4E/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Model } from 'mongoose';
|
|
2
|
+
import { ChatSession } from '@ubs-platform/superlama-entity-mongo';
|
|
3
|
+
import { ChatSessionDTO } from '@ubs-platform/superlama-common';
|
|
4
|
+
import { UserAuthBackendDTO } from '@ubs-platform/users-common';
|
|
5
|
+
import { SearchResult } from '@ubs-platform/crud-base-common';
|
|
6
|
+
export declare class SessionService {
|
|
7
|
+
private chatSessionModel;
|
|
8
|
+
constructor(chatSessionModel: Model<ChatSession>);
|
|
9
|
+
listSessions(user: UserAuthBackendDTO, size: number, page: number): Promise<SearchResult<ChatSessionDTO>>;
|
|
10
|
+
private sessionToDto;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.SessionService = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
18
|
+
const mongoose_2 = require("mongoose");
|
|
19
|
+
const superlama_entity_mongo_1 = require("../_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
20
|
+
const crud_base_1 = require("@ubs-platform/crud-base");
|
|
21
|
+
let SessionService = class SessionService {
|
|
22
|
+
constructor(chatSessionModel) {
|
|
23
|
+
this.chatSessionModel = chatSessionModel;
|
|
24
|
+
}
|
|
25
|
+
async listSessions(user, size, page) {
|
|
26
|
+
return (await crud_base_1.MongooseSearchUtil.modelSearch(this.chatSessionModel, size, page, { creationDate: -1 }, {
|
|
27
|
+
$match: {
|
|
28
|
+
userParticipantsIds: {
|
|
29
|
+
$in: [user.id],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
})).map((a) => this.sessionToDto(a));
|
|
33
|
+
}
|
|
34
|
+
sessionToDto(a) {
|
|
35
|
+
return {
|
|
36
|
+
_id: a._id,
|
|
37
|
+
creationDate: a.creationDate,
|
|
38
|
+
expirationDate: a.expirationDate,
|
|
39
|
+
llmAnswerStatus: a.llmAnswerStatus,
|
|
40
|
+
moderationNoteWarning: a.moderationNoteWarning,
|
|
41
|
+
userParticipantsIds: a.userParticipantsIds,
|
|
42
|
+
subjectTitle: a.subjectTitle,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
exports.SessionService = SessionService;
|
|
47
|
+
exports.SessionService = SessionService = __decorate([
|
|
48
|
+
(0, common_1.Injectable)(),
|
|
49
|
+
__param(0, (0, mongoose_1.InjectModel)(superlama_entity_mongo_1.ChatSession.name)),
|
|
50
|
+
__metadata("design:paramtypes", [mongoose_2.Model])
|
|
51
|
+
], SessionService);
|
|
52
|
+
//# sourceMappingURL=session.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.service.js","sourceRoot":"","sources":["../../../../../../libs/superlama-webservice/src/service/session.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuE;AACvE,+CAA+C;AAE/C,uCAAiC;AACjC,iFAAmF;AAcnF,uDAA6D;AAGtD,IAAM,cAAc,GAApB,MAAM,cAAc;IAGvB,YAEY,gBAAoC;QAApC,qBAAgB,GAAhB,gBAAgB,CAAoB;IAC7C,CAAC;IAEJ,KAAK,CAAC,YAAY,CACd,IAAwB,EACxB,IAAY,EACZ,IAAY;QAEZ,OAAO,CACH,MAAM,8BAAkB,CAAC,WAAW,CAChC,IAAI,CAAC,gBAAgB,EACrB,IAAI,EACJ,IAAI,EACJ,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,EACpB;YACI,MAAM,EAAE;gBACJ,mBAAmB,EAAE;oBACjB,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;iBACjB;aACJ;SACJ,CACJ,CACJ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAEO,YAAY,CAAC,CAAc;QAC/B,OAAO;YACH,GAAG,EAAE,CAAC,CAAC,GAAG;YACV,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,qBAAqB,EAAE,CAAC,CAAC,qBAAqB;YAC9C,mBAAmB,EAAE,CAAC,CAAC,mBAAmB;YAC1C,YAAY,EAAE,CAAC,CAAC,YAAY;SAC/B,CAAC;IACN,CAAC;CACJ,CAAA;AAzCY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAKJ,WAAA,IAAA,sBAAW,EAAC,oCAAW,CAAC,IAAI,CAAC,CAAA;qCACJ,gBAAK;GAL1B,cAAc,CAyC1B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
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.SuperlamaWebserviceModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const schedule_1 = require("@nestjs/schedule");
|
|
12
|
+
const users_microservice_helper_1 = require("@ubs-platform/users-microservice-helper");
|
|
13
|
+
const microservice_setup_util_1 = require("@ubs-platform/microservice-setup-util");
|
|
14
|
+
const superlama_entity_mongo_1 = require("./_monaembed/@ubs-platform/superlama-entity-mongo");
|
|
15
|
+
const realtime_chat_controller_1 = require("./controller/realtime-chat.controller");
|
|
16
|
+
const user_sessions_controlller_1 = require("./controller/user-sessions.controlller");
|
|
17
|
+
const llm_models_controller_1 = require("./controller/llm-models.controller");
|
|
18
|
+
const realtime_chat_service_1 = require("./service/realtime-chat.service");
|
|
19
|
+
const realtime_chat_feeder_service_1 = require("./service/realtime-chat-feeder.service");
|
|
20
|
+
const session_service_1 = require("./service/session.service");
|
|
21
|
+
const llm_operation_service_1 = require("./service/llm-operation.service");
|
|
22
|
+
const chat_message_mapper_1 = require("./mapper/chat-message.mapper");
|
|
23
|
+
let SuperlamaWebserviceModule = class SuperlamaWebserviceModule {
|
|
24
|
+
};
|
|
25
|
+
exports.SuperlamaWebserviceModule = SuperlamaWebserviceModule;
|
|
26
|
+
exports.SuperlamaWebserviceModule = SuperlamaWebserviceModule = __decorate([
|
|
27
|
+
(0, common_1.Module)({
|
|
28
|
+
imports: [
|
|
29
|
+
superlama_entity_mongo_1.SuperlamaEntityMongoModule,
|
|
30
|
+
schedule_1.ScheduleModule,
|
|
31
|
+
users_microservice_helper_1.UserMicroserviceHelperModule,
|
|
32
|
+
microservice_setup_util_1.MicroservicesCommonModule
|
|
33
|
+
],
|
|
34
|
+
controllers: [realtime_chat_controller_1.RealtimeChatController, user_sessions_controlller_1.SessionController, llm_models_controller_1.LlmModelsController],
|
|
35
|
+
providers: [
|
|
36
|
+
realtime_chat_service_1.RealtimeChatService,
|
|
37
|
+
chat_message_mapper_1.ChatMessageMapper,
|
|
38
|
+
llm_operation_service_1.LlmOperationService,
|
|
39
|
+
realtime_chat_feeder_service_1.RealtimeChatFeederService,
|
|
40
|
+
session_service_1.SessionService,
|
|
41
|
+
],
|
|
42
|
+
exports: [realtime_chat_service_1.RealtimeChatService, session_service_1.SessionService, llm_operation_service_1.LlmOperationService],
|
|
43
|
+
})
|
|
44
|
+
], SuperlamaWebserviceModule);
|
|
45
|
+
//# sourceMappingURL=superlama-webservice.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"superlama-webservice.module.js","sourceRoot":"","sources":["../../../../../libs/superlama-webservice/src/superlama-webservice.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AAExC,+CAAkD;AAClD,uFAAuF;AACvF,mFAAyG;AACzG,iFAAkF;AAClF,oFAA+E;AAC/E,sFAA2E;AAC3E,8EAAyE;AACzE,2EAAsE;AACtE,yFAAmF;AACnF,+DAA2D;AAC3D,2EAAsE;AACtE,sEAAiE;AAmB1D,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;CAAI,CAAA;AAA7B,8DAAyB;oCAAzB,yBAAyB;IAjBrC,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,mDAA0B;YAC1B,yBAAc;YACd,wDAA4B;YAC5B,mDAAyB;SAC1B;QACD,WAAW,EAAE,CAAC,iDAAsB,EAAE,6CAAiB,EAAE,2CAAmB,CAAC;QAC7E,SAAS,EAAE;YACT,2CAAmB;YACnB,uCAAiB;YACjB,2CAAmB;YACnB,wDAAyB;YACzB,gCAAc;SACf;QACD,OAAO,EAAE,CAAC,2CAAmB,EAAE,gCAAc,EAAE,2CAAmB,CAAC;KACpE,CAAC;GACW,yBAAyB,CAAI"}
|