mirror of
https://github.com/Palm1r/QodeAssist.git
synced 2025-07-18 04:54:30 -04:00
feat: Add saving and loading chat history
* feat: Add chat history path * feat: Add save and load chat * fix: Change badge width calculation * refactor: Move chat action to top * feat: Add autosave of messageReceived * feat: Add settings for autosave
This commit is contained in:
@ -25,10 +25,10 @@ Rectangle {
|
||||
property alias text: badgeText.text
|
||||
property alias fontColor: badgeText.color
|
||||
|
||||
width: badgeText.implicitWidth + radius
|
||||
height: badgeText.implicitHeight + 6
|
||||
implicitWidth: badgeText.implicitWidth + root.radius
|
||||
implicitHeight: badgeText.implicitHeight + 6
|
||||
color: "lightgreen"
|
||||
radius: height / 2
|
||||
radius: root.height / 2
|
||||
border.width: 1
|
||||
border.color: "gray"
|
||||
|
||||
|
@ -35,10 +35,40 @@ ChatRootView {
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
anchors.fill: parent
|
||||
|
||||
RowLayout {
|
||||
id: topBar
|
||||
|
||||
Layout.leftMargin: 5
|
||||
Layout.rightMargin: 5
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
text: qsTr("Save")
|
||||
onClicked: root.showSaveDialog()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Load")
|
||||
onClicked: root.showLoadDialog()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("Clear")
|
||||
onClicked: root.clearChat()
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Badge {
|
||||
text: qsTr("tokens:%1/%2").arg(root.chatModel.totalTokens).arg(root.chatModel.tokensThreshold)
|
||||
color: root.codeColor
|
||||
fontColor: root.primaryColor.hslLightness > 0.5 ? "black" : "white"
|
||||
}
|
||||
}
|
||||
spacing: 10
|
||||
|
||||
ListView {
|
||||
id: chatListView
|
||||
@ -133,14 +163,6 @@ ChatRootView {
|
||||
onClicked: root.cancelRequest()
|
||||
}
|
||||
|
||||
Button {
|
||||
id: clearButton
|
||||
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
text: qsTr("Clear Chat")
|
||||
onClicked: root.clearChat()
|
||||
}
|
||||
|
||||
CheckBox {
|
||||
id: sharingCurrentFile
|
||||
|
||||
@ -150,26 +172,6 @@ ChatRootView {
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: bar
|
||||
|
||||
layoutDirection: Qt.RightToLeft
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 5
|
||||
right: parent.right
|
||||
rightMargin: scroll.width
|
||||
}
|
||||
spacing: 10
|
||||
|
||||
Badge {
|
||||
text: qsTr("tokens:%1/%2").arg(root.chatModel.totalTokens).arg(root.chatModel.tokensThreshold)
|
||||
color: root.codeColor
|
||||
fontColor: root.primaryColor.hslLightness > 0.5 ? "black" : "white"
|
||||
}
|
||||
}
|
||||
|
||||
function clearChat() {
|
||||
root.chatModel.clear()
|
||||
}
|
||||
|
Reference in New Issue
Block a user