Add multi-line prompt support.

This commit is contained in:
Adam Treat 2023-04-20 08:31:33 -04:00
parent 4c970fdc9c
commit cd5f525950

View File

@ -755,7 +755,7 @@ Window {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: textInput.top
anchors.bottom: textInputView.top
anchors.bottomMargin: 30
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
@ -886,8 +886,8 @@ Window {
}
}
}
anchors.bottom: textInput.top
anchors.horizontalCenter: textInput.horizontalCenter
anchors.bottom: textInputView.top
anchors.horizontalCenter: textInputView.horizontalCenter
anchors.bottomMargin: 40
padding: 15
contentItem: Text {
@ -906,12 +906,16 @@ Window {
}
}
TextField {
id: textInput
ScrollView {
id: textInputView
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.margins: 30
height: Math.min(contentHeight, 200)
TextArea {
id: textInput
color: "#dadadc"
padding: 20
enabled: LLM.isModelLoaded
@ -925,7 +929,13 @@ Window {
Accessible.role: Accessible.EditableText
Accessible.name: placeholderText
Accessible.description: qsTr("Textfield for sending messages/prompts to the model")
onAccepted: {
Keys.onReturnPressed: {
if (event.modifiers & Qt.ControlModifier || event.modifiers & Qt.ShiftModifier)
event.accepted = false;
else
editingFinished();
}
onEditingFinished: {
if (textInput.text === "")
return
@ -945,10 +955,12 @@ Window {
settingsDialog.topP, settingsDialog.temperature, settingsDialog.promptBatchSize)
textInput.text = ""
}
}
}
Button {
anchors.right: textInput.right
anchors.verticalCenter: textInput.verticalCenter
anchors.right: textInputView.right
anchors.verticalCenter: textInputView.verticalCenter
anchors.rightMargin: 15
width: 30
height: 30
@ -967,5 +979,4 @@ Window {
}
}
}
}
}