Fix this correctly?

pull/1079/head
Adam Treat 1 year ago
parent 07a5405618
commit 71449bbc4b

@ -93,6 +93,7 @@ Dialog {
settings.maxLength = defaultMaxLength settings.maxLength = defaultMaxLength
settings.promptBatchSize = defaultPromptBatchSize settings.promptBatchSize = defaultPromptBatchSize
settings.promptTemplate = defaultPromptTemplate settings.promptTemplate = defaultPromptTemplate
templateTextArea.text = defaultPromptTemplate
settings.repeatPenalty = defaultRepeatPenalty settings.repeatPenalty = defaultRepeatPenalty
settings.repeatPenaltyTokens = defaultRepeatPenaltyTokens settings.repeatPenaltyTokens = defaultRepeatPenaltyTokens
settings.sync() settings.sync()
@ -535,7 +536,7 @@ Dialog {
Label { Label {
id: promptTemplateLabelHelp id: promptTemplateLabelHelp
Layout.maximumWidth: promptTemplateLabel.width Layout.maximumWidth: promptTemplateLabel.width
visible: settings.promptTemplate.indexOf( visible: templateTextArea.text.indexOf(
"%1") === -1 "%1") === -1
color: theme.textErrorColor color: theme.textErrorColor
text: qsTr("Must contain the string \"%1\" to be replaced with the user's input.") text: qsTr("Must contain the string \"%1\" to be replaced with the user's input.")
@ -556,6 +557,7 @@ Dialog {
id: templateScrollView id: templateScrollView
anchors.fill: parent anchors.fill: parent
TextArea { TextArea {
id: templateTextArea
text: settings.promptTemplate text: settings.promptTemplate
color: theme.textColor color: theme.textColor
background: Rectangle { background: Rectangle {
@ -566,10 +568,10 @@ Dialog {
padding: 10 padding: 10
wrapMode: TextArea.Wrap wrapMode: TextArea.Wrap
onTextChanged: { onTextChanged: {
if (settings.promptTemplate.indexOf("%1") === -1) if (templateTextArea.text.indexOf("%1") !== -1) {
return; settings.promptTemplate = text
settings.promptTemplate = text settings.sync()
settings.sync() }
} }
bottomPadding: 10 bottomPadding: 10
Accessible.role: Accessible.EditableText Accessible.role: Accessible.EditableText

Loading…
Cancel
Save