Use a global constant and remove a debug line.

This commit is contained in:
Adam Treat 2023-11-15 12:23:45 -05:00 committed by AT
parent eecf351c64
commit 59ed2a0bea
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -24,7 +24,6 @@ MyDialog {
if (showEmbeddingModels) {
ModelList.downloadableModels.expanded = true
var targetModelIndex = ModelList.defaultEmbeddingModelIndex
console.log("targetModelIndex " + targetModelIndex)
modelListView.positionViewAtIndex(targetModelIndex, ListView.Contain)
}
}