From 782e1e77a4e850bd85390c205000ff9e83386374 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Fri, 16 Jun 2023 14:43:14 -0400 Subject: [PATCH] Fix up model names that don't begin with 'ggml-' --- gpt4all-chat/chat.cpp | 3 ++- gpt4all-chat/qml/ModelDownloaderDialog.qml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gpt4all-chat/chat.cpp b/gpt4all-chat/chat.cpp index f3d55811..397c351b 100644 --- a/gpt4all-chat/chat.cpp +++ b/gpt4all-chat/chat.cpp @@ -412,7 +412,8 @@ QList Chat::modelList() const for (const QString& f : fileNames) { QString filePath = exePath + f; QFileInfo info(filePath); - QString name = info.completeBaseName().remove(0, 5); + QString basename = info.completeBaseName(); + QString name = basename.startsWith("ggml-") ? basename.remove(0, 5) : basename; if (info.exists()) { if (name == currentModelName) list.prepend(name); diff --git a/gpt4all-chat/qml/ModelDownloaderDialog.qml b/gpt4all-chat/qml/ModelDownloaderDialog.qml index ebc69063..9daceeed 100644 --- a/gpt4all-chat/qml/ModelDownloaderDialog.qml +++ b/gpt4all-chat/qml/ModelDownloaderDialog.qml @@ -83,7 +83,7 @@ Dialog { id: modelName objectName: "modelName" property string filename: modelData.filename - text: !modelData.isChatGPT ? filename.slice(5, filename.length - 4) : filename + text: !modelData.isChatGPT ? (filename.startsWith("ggml-") ? filename.slice(5, filename.length - 4) : filename.slice(0, filename.length - 4)) : filename padding: 20 anchors.top: parent.top anchors.left: parent.left