diff --git a/gpt4all-chat/qml/ChatView.qml b/gpt4all-chat/qml/ChatView.qml index b3490d5d5fd6..cf9afd2dc144 100644 --- a/gpt4all-chat/qml/ChatView.qml +++ b/gpt4all-chat/qml/ChatView.qml @@ -935,10 +935,7 @@ Rectangle { visible: false } onClicked: { - var conversation = chatModel.copyToClipboard() - copyEdit.text = conversation - copyEdit.selectAll() - copyEdit.copy() + chatModel.copyToClipboard() copyMessage.open() } ToolTip.visible: copyChatButton.hovered diff --git a/gpt4all-chat/src/chatmodel.h b/gpt4all-chat/src/chatmodel.h index d0a8cbfd9759..da898e965c75 100644 --- a/gpt4all-chat/src/chatmodel.h +++ b/gpt4all-chat/src/chatmodel.h @@ -985,12 +985,15 @@ class ChatModel : public QAbstractListModel Q_INVOKABLE void copyToClipboard() { QMutexLocker locker(&m_mutex); - QStringList content; + QString conversation; for (ChatItem *item : m_chatItems) { - content << item->clipboardContent(); + QString string = item->name; + string += item->clipboardContent(); + string += "\n"; + conversation += string; } QClipboard *clipboard = QGuiApplication::clipboard(); - clipboard->setText(content.join("\n\n"), QClipboard::Clipboard); + clipboard->setText(conversation, QClipboard::Clipboard); } Q_INVOKABLE void copyToClipboard(int index)