Spaces:
Building
Building
Update flare-ui/src/app/services/conversation-manager.service.ts
Browse files
flare-ui/src/app/services/conversation-manager.service.ts
CHANGED
@@ -237,16 +237,21 @@ export class ConversationManagerService implements OnDestroy {
|
|
237 |
try {
|
238 |
switch (message.type) {
|
239 |
case 'transcription':
|
240 |
-
// SADECE final transcription'ları
|
241 |
if (message['is_final']) {
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
243 |
this.transcriptionSubject.next('');
|
244 |
} else {
|
245 |
// Interim transcription'ları accumulate et
|
246 |
this.transcriptionSubject.next(message['text']);
|
247 |
}
|
248 |
break;
|
249 |
-
|
250 |
case 'assistant_response':
|
251 |
// Welcome mesajı veya normal yanıt
|
252 |
const isWelcome = message['is_welcome'] || false;
|
|
|
237 |
try {
|
238 |
switch (message.type) {
|
239 |
case 'transcription':
|
240 |
+
// SADECE final transcription'ları mesaj olarak ekle
|
241 |
if (message['is_final']) {
|
242 |
+
// Eğer son mesaj aynı user mesajıysa ekleme (duplicate check)
|
243 |
+
const messages = this.messagesSubject.value;
|
244 |
+
const lastMessage = messages[messages.length - 1];
|
245 |
+
if (!lastMessage || lastMessage.role !== 'user' || lastMessage.text !== message['text']) {
|
246 |
+
this.addMessage('user', message['text']);
|
247 |
+
}
|
248 |
this.transcriptionSubject.next('');
|
249 |
} else {
|
250 |
// Interim transcription'ları accumulate et
|
251 |
this.transcriptionSubject.next(message['text']);
|
252 |
}
|
253 |
break;
|
254 |
+
|
255 |
case 'assistant_response':
|
256 |
// Welcome mesajı veya normal yanıt
|
257 |
const isWelcome = message['is_welcome'] || false;
|