@@ -66,7 +66,7 @@ export class ChatService {
66
66
67
67
// Set first conversation as active if none is selected and there are conversations
68
68
if ( ! this . activeConversationId && this . conversations . length > 0 ) {
69
- this . activeConversationId = this . conversations [ 0 ] . id ;
69
+ this . activeConversationId = this . conversations [ 0 ] . conversationId ;
70
70
}
71
71
72
72
return [ ...this . conversations ] ;
@@ -90,7 +90,7 @@ export class ChatService {
90
90
if ( conversation ) {
91
91
// Update the conversation in the local list
92
92
this . conversations = this . conversations . map ( c =>
93
- c . id === conversationId ? conversation : c
93
+ c . conversationId === conversationId ? conversation : c
94
94
) ;
95
95
return conversation ;
96
96
}
@@ -117,7 +117,7 @@ export class ChatService {
117
117
this . conversations = [ newConversation , ...this . conversations ] ;
118
118
119
119
// Set as active conversation
120
- this . activeConversationId = newConversation . id ;
120
+ this . activeConversationId = newConversation . conversationId ;
121
121
122
122
return newConversation ;
123
123
} catch ( error ) {
@@ -139,7 +139,7 @@ export class ChatService {
139
139
throw new Error ( 'Database service not initialized' ) ;
140
140
}
141
141
142
- const currentConversation = this . conversations . find ( c => c . id === conversationId ) ;
142
+ const currentConversation = this . conversations . find ( c => c . conversationId === conversationId ) ;
143
143
if ( currentConversation === undefined ) {
144
144
throw new Error ( 'Active conversation not found' ) ;
145
145
}
@@ -155,7 +155,7 @@ export class ChatService {
155
155
156
156
// Update in memory
157
157
this . conversations = this . conversations . map ( c =>
158
- c . id === conversationId ? updatedConversation : c
158
+ c . conversationId === conversationId ? updatedConversation : c
159
159
) ;
160
160
161
161
conversationUpdate ( this . conversations ) ;
@@ -185,7 +185,7 @@ export class ChatService {
185
185
} ;
186
186
187
187
this . conversations = this . conversations . map ( c =>
188
- c . id === conversationId ? updatedConversation : c
188
+ c . conversationId === conversationId ? updatedConversation : c
189
189
) ;
190
190
191
191
conversationUpdate ( this . conversations ) ;
@@ -200,7 +200,7 @@ export class ChatService {
200
200
// ---- On chunk callback ----
201
201
( updated : Conversation ) => {
202
202
this . conversations = this . conversations . map ( c =>
203
- c . id === conversationId ? updated : c
203
+ c . conversationId === conversationId ? updated : c
204
204
) ;
205
205
conversationUpdate ( this . conversations ) ;
206
206
} ,
@@ -215,7 +215,7 @@ export class ChatService {
215
215
216
216
// Update in memory
217
217
this . conversations = this . conversations . map ( c =>
218
- c . id === conversationId ? finalConversation : c
218
+ c . conversationId === conversationId ? finalConversation : c
219
219
) ;
220
220
221
221
conversationUpdate ( this . conversations ) ;
@@ -270,7 +270,7 @@ export class ChatService {
270
270
271
271
try {
272
272
//#region Get message and father message in conversation
273
- const currentConversation = this . conversations . find ( c => c . id === conversationId ) ;
273
+ const currentConversation = this . conversations . find ( c => c . conversationId === conversationId ) ;
274
274
275
275
if ( ! currentConversation ) {
276
276
throw new Error ( 'Active conversation not found' ) ;
@@ -310,7 +310,7 @@ export class ChatService {
310
310
311
311
// Update in memory
312
312
this . conversations = this . conversations . map ( c =>
313
- c . id === conversationId ? updatedConversation : c
313
+ c . conversationId === conversationId ? updatedConversation : c
314
314
) ;
315
315
316
316
conversationUpdate ( this . conversations ) ;
@@ -339,7 +339,7 @@ export class ChatService {
339
339
} ;
340
340
341
341
this . conversations = this . conversations . map ( c =>
342
- c . id === conversationId ? updatedConversation : c
342
+ c . conversationId === conversationId ? updatedConversation : c
343
343
) ;
344
344
345
345
conversationUpdate ( this . conversations ) ;
@@ -354,7 +354,7 @@ export class ChatService {
354
354
// ---- On chunk callback ----
355
355
( updated : Conversation ) => {
356
356
this . conversations = this . conversations . map ( c =>
357
- c . id === conversationId ? updated : c
357
+ c . conversationId === conversationId ? updated : c
358
358
) ;
359
359
conversationUpdate ( this . conversations ) ;
360
360
} ,
@@ -369,7 +369,7 @@ export class ChatService {
369
369
370
370
// Update in memory
371
371
this . conversations = this . conversations . map ( c =>
372
- c . id === conversationId ? finalConversation : c
372
+ c . conversationId === conversationId ? finalConversation : c
373
373
) ;
374
374
375
375
conversationUpdate ( this . conversations ) ;
@@ -423,7 +423,7 @@ export class ChatService {
423
423
424
424
try {
425
425
//#region Get message and father message in conversation
426
- const currentConversation = this . conversations . find ( c => c . id === conversationId ) ;
426
+ const currentConversation = this . conversations . find ( c => c . conversationId === conversationId ) ;
427
427
428
428
if ( ! currentConversation ) {
429
429
throw new Error ( 'Active conversation not found' ) ;
@@ -480,7 +480,7 @@ export class ChatService {
480
480
} ;
481
481
482
482
this . conversations = this . conversations . map ( c =>
483
- c . id === conversationId ? updatedConversation : c
483
+ c . conversationId === conversationId ? updatedConversation : c
484
484
) ;
485
485
486
486
conversationUpdate ( this . conversations ) ;
@@ -494,7 +494,7 @@ export class ChatService {
494
494
// ---- On chunk callback ----
495
495
( updated : Conversation ) => {
496
496
this . conversations = this . conversations . map ( c =>
497
- c . id === conversationId ? updated : c
497
+ c . conversationId === conversationId ? updated : c
498
498
) ;
499
499
conversationUpdate ( this . conversations ) ;
500
500
} ,
@@ -509,7 +509,7 @@ export class ChatService {
509
509
510
510
// Update in memory
511
511
this . conversations = this . conversations . map ( c =>
512
- c . id === conversationId ? finalConversation : c
512
+ c . conversationId === conversationId ? finalConversation : c
513
513
) ;
514
514
515
515
conversationUpdate ( this . conversations ) ;
@@ -574,7 +574,7 @@ export class ChatService {
574
574
*/
575
575
public getActiveConversation ( ) : Conversation | null {
576
576
if ( ! this . activeConversationId ) return null ;
577
- return this . conversations . find ( c => c . id === this . activeConversationId ) || null ;
577
+ return this . conversations . find ( c => c . conversationId === this . activeConversationId ) || null ;
578
578
}
579
579
580
580
/**
@@ -594,18 +594,18 @@ export class ChatService {
594
594
/**
595
595
* Rename a conversation
596
596
*/
597
- public async renameConversation ( id : string , newTitle : string ) : Promise < void > {
597
+ public async renameConversation ( conversationId : string , newTitle : string ) : Promise < void > {
598
598
if ( ! this . dbService ) {
599
599
throw new Error ( 'Database service not initialized' ) ;
600
600
}
601
601
602
602
try {
603
603
// Update in database
604
- await this . dbService . renameConversation ( id , newTitle ) ;
604
+ await this . dbService . renameConversation ( conversationId , newTitle ) ;
605
605
606
606
// Update in memory
607
607
this . conversations = this . conversations . map ( conv =>
608
- conv . id === id ? { ...conv , title : newTitle } : conv
608
+ conv . conversationId === conversationId ? { ...conv , title : newTitle } : conv
609
609
) ;
610
610
} catch ( error ) {
611
611
console . error ( 'Error renaming conversation:' , error ) ;
@@ -616,21 +616,21 @@ export class ChatService {
616
616
/**
617
617
* Delete a conversation
618
618
*/
619
- public async deleteConversation ( id : string ) : Promise < void > {
619
+ public async deleteConversation ( conversationId : string ) : Promise < void > {
620
620
if ( ! this . dbService ) {
621
621
throw new Error ( 'Database service not initialized' ) ;
622
622
}
623
623
624
624
try {
625
625
// Delete from database
626
- await this . dbService . deleteConversation ( id ) ;
626
+ await this . dbService . deleteConversation ( conversationId ) ;
627
627
628
628
// Remove from memory
629
- this . conversations = this . conversations . filter ( conv => conv . id !== id ) ;
629
+ this . conversations = this . conversations . filter ( conv => conv . conversationId !== conversationId ) ;
630
630
631
631
// If the active conversation was deleted, set active to null or the first available
632
- if ( this . activeConversationId === id ) {
633
- this . activeConversationId = this . conversations . length > 0 ? this . conversations [ 0 ] . id : null ;
632
+ if ( this . activeConversationId === conversationId ) {
633
+ this . activeConversationId = this . conversations . length > 0 ? this . conversations [ 0 ] . conversationId : null ;
634
634
}
635
635
} catch ( error ) {
636
636
console . error ( 'Error deleting conversation:' , error ) ;
0 commit comments