diff --git a/gpt4all-chat/src/modellist.cpp b/gpt4all-chat/src/modellist.cpp index 4867ef63..9a39b4ba 100644 --- a/gpt4all-chat/src/modellist.cpp +++ b/gpt4all-chat/src/modellist.cpp @@ -258,7 +258,7 @@ int ModelInfo::maxContextLength() const { if (!installed || isOnline) return -1; if (m_maxContextLength != -1) return m_maxContextLength; - auto path = (dirpath + filename()).toStdString(); + auto path = this->path().toStdString(); int n_ctx = LLModel::Implementation::maxContextLength(path); if (n_ctx < 0) { n_ctx = 4096; // fallback value @@ -282,7 +282,7 @@ int ModelInfo::maxGpuLayers() const { if (!installed || isOnline) return -1; if (m_maxGpuLayers != -1) return m_maxGpuLayers; - auto path = (dirpath + filename()).toStdString(); + auto path = this->path().toStdString(); int layers = LLModel::Implementation::layerCount(path); if (layers < 0) { layers = 100; // fallback value @@ -993,7 +993,7 @@ void ModelList::updateDataInternal(const QString &id, const QVectordirpath + info->filename(); + QString modelPath = info->path(); const QFileInfo fileInfo(modelPath); info->installed = fileInfo.exists(); const QFileInfo incompleteInfo(incompleteDownloadPath(info->filename())); diff --git a/gpt4all-chat/src/modellist.h b/gpt4all-chat/src/modellist.h index 9292d31b..9f14f413 100644 --- a/gpt4all-chat/src/modellist.h +++ b/gpt4all-chat/src/modellist.h @@ -31,6 +31,7 @@ struct ModelInfo { Q_PROPERTY(QString id READ id WRITE setId) Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(QString filename READ filename WRITE setFilename) + Q_PROPERTY(QString path READ path) Q_PROPERTY(QString dirpath MEMBER dirpath) Q_PROPERTY(QString filesize MEMBER filesize) Q_PROPERTY(QByteArray hash MEMBER hash) @@ -94,6 +95,9 @@ public: QString filename() const; void setFilename(const QString &name); + // FIXME(jared): This is the one true path of the model. Never use anything else. + QString path() const { return dirpath + filename(); } + QString description() const; void setDescription(const QString &d); @@ -121,6 +125,7 @@ public: QDateTime recency() const; void setRecency(const QDateTime &r); + // FIXME(jared): a class with getters should not also have public mutable fields QString dirpath; QString filesize; QByteArray hash;