Provide a copy function.

This commit is contained in:
Adam Treat
2023-04-11 08:54:57 -04:00
parent ffe52fc5cf
commit 23e6c51091
3 changed files with 55 additions and 1 deletions

View File

@@ -106,7 +106,7 @@ Window {
}
Button {
id: resetContextButton
id: copyButton
anchors.right: parent.right
anchors.top: parent.top
anchors.topMargin: 30
@@ -116,6 +116,50 @@ Window {
z: 200
padding: 15
background: Item {
anchors.fill: parent
Image {
anchors.centerIn: parent
width: 40
height: 40
source: "qrc:/gpt4all-chat/icons/copy.svg"
}
}
TextEdit{
id: copyEdit
visible: false
}
onClicked: {
var conversation = "";
for (var i = 0; i < chatModel.count; i++) {
var item = chatModel.get(i)
var string = item.name;
if (item.currentResponse)
string += LLM.response
else
string += chatModel.get(i).value
string += "\n"
conversation += string
}
copyEdit.text = conversation
copyEdit.selectAll()
copyEdit.copy()
}
}
Button {
id: resetContextButton
anchors.right: copyButton.left
anchors.top: parent.top
anchors.topMargin: 30
anchors.rightMargin: 30
width: 60
height: 40
z: 200
padding: 15
background: Item {
anchors.fill: parent
Image {