@@ -529,8 +529,8 @@ GridLayout {
529
529
530
530
ConfirmationDialog {
531
531
id: editPromptDialog
532
- dialogTitle: qsTr (" Edit this prompt ?" )
533
- description: qsTr (" The existing response and all later messages will be permanently erased." )
532
+ dialogTitle: qsTr (" Edit this message ?" )
533
+ description: qsTr (" All following messages will be permanently erased." )
534
534
onAccepted: {
535
535
const msg = currentChat .popPrompt (index);
536
536
if (msg !== null )
@@ -541,7 +541,7 @@ GridLayout {
541
541
ConfirmationDialog {
542
542
id: redoResponseDialog
543
543
dialogTitle: qsTr (" Redo this response?" )
544
- description: qsTr (" The existing response and all later messages will be permanently erased." )
544
+ description: qsTr (" All following messages will be permanently erased." )
545
545
onAccepted: currentChat .regenerateResponse (index)
546
546
}
547
547
@@ -556,33 +556,48 @@ GridLayout {
556
556
visible: ! isCurrentResponse || ! currentChat .responseInProgress
557
557
enabled: opacity > 0
558
558
opacity: hoverArea .hovered
559
- readonly property var canModify: ! currentChat .isServer && currentChat .isModelLoaded && ! currentChat .responseInProgress
560
559
561
560
Behavior on opacity {
562
561
OpacityAnimator { duration: 30 }
563
562
}
564
563
565
564
ChatMessageButton {
566
- visible: parent .canModify && model .name === " Prompt: "
565
+ readonly property var editingDisabledReason: {
566
+ if (! currentChat .isModelLoaded )
567
+ return qsTr (" Cannot edit chat without a loaded model." );
568
+ if (currentChat .responseInProgress )
569
+ return qsTr (" Cannot edit chat while the model is generating." );
570
+ return null ;
571
+ }
572
+ visible: ! currentChat .isServer && model .name === " Prompt: "
573
+ enabled: editingDisabledReason === null
567
574
Layout .maximumWidth : 24
568
575
Layout .maximumHeight : 24
569
576
Layout .alignment : Qt .AlignVCenter
570
577
Layout .fillWidth : false
578
+ name: editingDisabledReason ?? qsTr (" Edit" )
571
579
source: " qrc:/gpt4all/icons/edit.svg"
572
580
onClicked: {
573
581
if (inputBoxText === " " )
574
582
editPromptDialog .open ();
575
583
}
576
- name: qsTr (" Edit" )
577
584
}
578
585
579
586
ChatMessageButton {
580
- visible: parent .canModify && model .name === " Response: "
587
+ readonly property var editingDisabledReason: {
588
+ if (! currentChat .isModelLoaded )
589
+ return qsTr (" Cannot redo response without a loaded model." );
590
+ if (currentChat .responseInProgress )
591
+ return qsTr (" Cannot redo response while the model is generating." );
592
+ return null ;
593
+ }
594
+ visible: ! currentChat .isServer && model .name === " Response: "
595
+ enabled: editingDisabledReason === null
581
596
Layout .maximumWidth : 24
582
597
Layout .maximumHeight : 24
583
598
Layout .alignment : Qt .AlignVCenter
584
599
Layout .fillWidth : false
585
- name: qsTr (" Redo" )
600
+ name: editingDisabledReason ?? qsTr (" Redo" )
586
601
source: " qrc:/gpt4all/icons/regenerate.svg"
587
602
onClicked: redoResponseDialog .open ()
588
603
}
0 commit comments