diff --git a/gpt4all-chat/qml/ApplicationSettings.qml b/gpt4all-chat/qml/ApplicationSettings.qml index 19aee29e..c0c3fbfa 100644 --- a/gpt4all-chat/qml/ApplicationSettings.qml +++ b/gpt4all-chat/qml/ApplicationSettings.qml @@ -420,7 +420,7 @@ MySettingsTab { Accessible.description: ToolTip.text } - MySettingsLabel { + /*MySettingsLabel { id: gpuOverrideLabel text: qsTr("Force Metal (macOS+arm)") Layout.row: 13 @@ -437,7 +437,7 @@ MySettingsTab { } ToolTip.text: qsTr("WARNING: On macOS with arm (M1+) this setting forces usage of the GPU. Can cause crashes if the model requires more RAM than the system supports. Because of crash possibility the setting will not persist across restarts of the application. This has no effect on non-macs or intel.") ToolTip.visible: hovered - } + }*/ MySettingsLabel { id: updatesLabel diff --git a/gpt4all-chat/qml/LocalDocsSettings.qml b/gpt4all-chat/qml/LocalDocsSettings.qml index 17aab8cb..5873090a 100644 --- a/gpt4all-chat/qml/LocalDocsSettings.qml +++ b/gpt4all-chat/qml/LocalDocsSettings.qml @@ -117,24 +117,29 @@ MySettingsTab { MySettingsLabel { id: apiKeyLabel text: qsTr("Nomic API Key") - helpText: qsTr("API key to use for Nomic Embed. Get one at https://atlas.nomic.ai/") + helpText: qsTr('API key to use for Nomic Embed. Get one from the Atlas API keys page.') + onLinkActivated: function(link) { Qt.openUrlExternally(link) } } MyTextField { id: apiKeyField + + property bool isValid: validate() + onTextChanged: { isValid = validate(); } + function validate() { return /^(nk-[a-zA-Z0-9_-]{43})?$/.test(apiKeyField.text); } + + placeholderText: "nk-" + "X".repeat(43) text: MySettings.localDocsNomicAPIKey - color: apiKeyField.acceptableInput ? theme.textColor : theme.textErrorColor + color: apiKeyField.isValid ? theme.textColor : theme.textErrorColor font.pixelSize: theme.fontSizeLarge Layout.alignment: Qt.AlignRight Layout.minimumWidth: 200 enabled: useNomicAPIBox.checked - validator: RegularExpressionValidator { - // may be empty - regularExpression: /|nk-[a-zA-Z0-9_-]{43}/ - } onEditingFinished: { - MySettings.localDocsNomicAPIKey = apiKeyField.text; - MySettings.localDocsUseRemoteEmbed = useNomicAPIBox.checked && MySettings.localDocsNomicAPIKey !== ""; + if (apiKeyField.isValid) { + MySettings.localDocsNomicAPIKey = apiKeyField.text; + MySettings.localDocsUseRemoteEmbed = useNomicAPIBox.checked && MySettings.localDocsNomicAPIKey !== ""; + } focus = false; } Accessible.role: Accessible.EditableText diff --git a/gpt4all-chat/qml/MySettingsLabel.qml b/gpt4all-chat/qml/MySettingsLabel.qml index 2517759b..dd06b891 100644 --- a/gpt4all-chat/qml/MySettingsLabel.qml +++ b/gpt4all-chat/qml/MySettingsLabel.qml @@ -37,5 +37,11 @@ ColumnLayout { onLinkActivated: function(link) { root.linkActivated(link); } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.NoButton // pass clicks to parent + cursorShape: parent.hoveredLink ? Qt.PointingHandCursor : Qt.ArrowCursor + } } }