File tree Expand file tree Collapse file tree 2 files changed +17
-14
lines changed
src/packages/frontend/chat Expand file tree Collapse file tree 2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -448,11 +448,19 @@ export class ChatActions extends Actions<ChatState> {
448
448
sender_id : string | undefined = undefined ,
449
449
) {
450
450
if ( ! this . syncdb ) return ;
451
+ sender_id = sender_id ?? this . redux . getStore ( "account" ) . get_account_id ( ) ;
452
+ // date should always be negative for drafts (stupid, but that's the code),
453
+ // so I'm just deleting both for now.
451
454
this . syncdb . delete ( {
452
455
event : "draft" ,
453
- sender_id : sender_id ?? this . redux . getStore ( "account" ) . get_account_id ( ) ,
456
+ sender_id,
454
457
date,
455
458
} ) ;
459
+ this . syncdb . delete ( {
460
+ event : "draft" ,
461
+ sender_id,
462
+ date : - date ,
463
+ } ) ;
456
464
if ( commit ) {
457
465
this . syncdb . commit ( ) ;
458
466
}
@@ -833,9 +841,12 @@ export class ChatActions extends Actions<ChatState> {
833
841
// submit question to the given language model
834
842
const id = uuid ( ) ;
835
843
this . chatStreams . add ( id ) ;
836
- setTimeout ( ( ) => {
837
- this . chatStreams . delete ( id ) ;
838
- } , 3 * 60 * 1000 ) ;
844
+ setTimeout (
845
+ ( ) => {
846
+ this . chatStreams . delete ( id ) ;
847
+ } ,
848
+ 3 * 60 * 1000 ,
849
+ ) ;
839
850
840
851
// construct the LLM history for the given thread
841
852
const history = reply_to ? this . getLLMHistory ( reply_to ) : undefined ;
Original file line number Diff line number Diff line change @@ -626,11 +626,7 @@ export default function Message(props: Readonly<Props>) {
626
626
if ( props . actions == null ) return ;
627
627
const reply = replyMentionsRef . current ?.( ) ?? replyMessageRef . current ;
628
628
props . actions . send_reply ( { message : message . toJS ( ) , reply } ) ;
629
- props . actions . syncdb ?. delete ( {
630
- event : "draft" ,
631
- sender_id : props . account_id ,
632
- date : - date ,
633
- } ) ;
629
+ props . actions . delete_draft ( date ) ;
634
630
props . actions . scrollToBottom ( props . index ) ;
635
631
setReplying ( false ) ;
636
632
}
@@ -673,11 +669,7 @@ export default function Message(props: Readonly<Props>) {
673
669
style = { { marginRight : "5px" } }
674
670
onClick = { ( ) => {
675
671
setReplying ( false ) ;
676
- props . actions ?. syncdb ?. delete ( {
677
- event : "draft" ,
678
- sender_id : props . account_id ,
679
- date : - date ,
680
- } ) ;
672
+ props . actions ?. delete_draft ( date ) ;
681
673
} }
682
674
>
683
675
Cancel
You can’t perform that action at this time.
0 commit comments