From 59ed2a0bea66b0ffe7cf17b83d7a8228fb6b3e8c Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Wed, 15 Nov 2023 12:23:45 -0500 Subject: [PATCH] Use a global constant and remove a debug line. --- gpt4all-chat/modellist.cpp | 6 ++++-- gpt4all-chat/qml/ModelDownloaderDialog.qml | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gpt4all-chat/modellist.cpp b/gpt4all-chat/modellist.cpp index 34e3d823..8f058347 100644 --- a/gpt4all-chat/modellist.cpp +++ b/gpt4all-chat/modellist.cpp @@ -8,6 +8,8 @@ //#define USE_LOCAL_MODELSJSON +#define DEFAULT_EMBEDDING_MODEL "all-MiniLM-L6-v2-f16.gguf" + QString ModelInfo::id() const { return m_id; @@ -153,7 +155,7 @@ bool EmbeddingModels::filterAcceptsRow(int sourceRow, { QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); bool isInstalled = sourceModel()->data(index, ModelList::InstalledRole).toBool(); - bool isEmbedding = sourceModel()->data(index, ModelList::FilenameRole).toString() == "all-MiniLM-L6-v2-f16.gguf"; + bool isEmbedding = sourceModel()->data(index, ModelList::FilenameRole).toString() == DEFAULT_EMBEDDING_MODEL; return isInstalled && isEmbedding; } @@ -331,7 +333,7 @@ int ModelList::defaultEmbeddingModelIndex() const QMutexLocker locker(&m_mutex); for (int i = 0; i < m_models.size(); ++i) { const ModelInfo *info = m_models.at(i); - const bool isEmbedding = info->filename() == "all-MiniLM-L6-v2-f16.gguf"; + const bool isEmbedding = info->filename() == DEFAULT_EMBEDDING_MODEL; if (isEmbedding) return i; } return -1; diff --git a/gpt4all-chat/qml/ModelDownloaderDialog.qml b/gpt4all-chat/qml/ModelDownloaderDialog.qml index 3b06845b..3475114b 100644 --- a/gpt4all-chat/qml/ModelDownloaderDialog.qml +++ b/gpt4all-chat/qml/ModelDownloaderDialog.qml @@ -24,7 +24,6 @@ MyDialog { if (showEmbeddingModels) { ModelList.downloadableModels.expanded = true var targetModelIndex = ModelList.defaultEmbeddingModelIndex - console.log("targetModelIndex " + targetModelIndex) modelListView.positionViewAtIndex(targetModelIndex, ListView.Contain) } }