@@ -529,8 +529,8 @@ GridLayout {
529529
530530 ConfirmationDialog {
531531 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." )
534534 onAccepted: {
535535 const msg = currentChat .popPrompt (index);
536536 if (msg !== null )
@@ -541,7 +541,7 @@ GridLayout {
541541 ConfirmationDialog {
542542 id: redoResponseDialog
543543 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." )
545545 onAccepted: currentChat .regenerateResponse (index)
546546 }
547547
@@ -556,33 +556,48 @@ GridLayout {
556556 visible: ! isCurrentResponse || ! currentChat .responseInProgress
557557 enabled: opacity > 0
558558 opacity: hoverArea .hovered
559- readonly property var canModify: ! currentChat .isServer && currentChat .isModelLoaded && ! currentChat .responseInProgress
560559
561560 Behavior on opacity {
562561 OpacityAnimator { duration: 30 }
563562 }
564563
565564 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
567574 Layout .maximumWidth : 24
568575 Layout .maximumHeight : 24
569576 Layout .alignment : Qt .AlignVCenter
570577 Layout .fillWidth : false
578+ name: editingDisabledReason ?? qsTr (" Edit" )
571579 source: " qrc:/gpt4all/icons/edit.svg"
572580 onClicked: {
573581 if (inputBoxText === " " )
574582 editPromptDialog .open ();
575583 }
576- name: qsTr (" Edit" )
577584 }
578585
579586 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
581596 Layout .maximumWidth : 24
582597 Layout .maximumHeight : 24
583598 Layout .alignment : Qt .AlignVCenter
584599 Layout .fillWidth : false
585- name: qsTr (" Redo" )
600+ name: editingDisabledReason ?? qsTr (" Redo" )
586601 source: " qrc:/gpt4all/icons/regenerate.svg"
587602 onClicked: redoResponseDialog .open ()
588603 }
0 commit comments