From e2f64f89c9f32b924b4b3ba317319eb4ea1d15ae Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Mon, 11 Mar 2024 14:00:33 -0400 Subject: [PATCH] When the current chat has no model use the first index. Signed-off-by: Adam Treat --- gpt4all-chat/qml/ModelSettings.qml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gpt4all-chat/qml/ModelSettings.qml b/gpt4all-chat/qml/ModelSettings.qml index 11f1cdbf..0bb935c3 100644 --- a/gpt4all-chat/qml/ModelSettings.qml +++ b/gpt4all-chat/qml/ModelSettings.qml @@ -43,7 +43,12 @@ MySettingsTab { model: ModelList.installedModels valueRole: "id" textRole: "name" - currentIndex: comboBox.indexOfValue(ChatListModel.currentChat.modelInfo.id) + currentIndex: { + var i = comboBox.indexOfValue(ChatListModel.currentChat.modelInfo.id); + if (i >= 0) + return i; + return 0; + } contentItem: Text { leftPadding: 10 rightPadding: 20