mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-06 02:50:36 +00:00
Support loading files if 'ggml' is found anywhere in the name not just at (#1001)
the beginning and add deprecated flag to models.json so older versions will show a model, but later versions don't. This will allow us to transition away from models < ggmlv2 and still allow older installs of gpt4all to work.
This commit is contained in:
@@ -399,8 +399,16 @@ QList<QString> Chat::modelList() const
|
||||
|
||||
{
|
||||
QDir dir(exePath);
|
||||
dir.setNameFilters(QStringList() << "ggml-*.bin");
|
||||
QStringList fileNames = dir.entryList();
|
||||
QStringList allFiles = dir.entryList(QDir::Files);
|
||||
|
||||
// All files that end with .bin and have 'ggml' somewhere in the name
|
||||
QStringList fileNames;
|
||||
for(const QString& filename : allFiles) {
|
||||
if (filename.endsWith(".bin") && filename.contains("ggml")) {
|
||||
fileNames.append(filename);
|
||||
}
|
||||
}
|
||||
|
||||
for (const QString& f : fileNames) {
|
||||
QString filePath = exePath + f;
|
||||
QFileInfo info(filePath);
|
||||
@@ -416,8 +424,15 @@ QList<QString> Chat::modelList() const
|
||||
|
||||
if (localPath != exePath) {
|
||||
QDir dir(localPath);
|
||||
dir.setNameFilters(QStringList() << "ggml-*.bin" << "chatgpt-*.txt");
|
||||
QStringList fileNames = dir.entryList();
|
||||
QStringList allFiles = dir.entryList(QDir::Files);
|
||||
QStringList fileNames;
|
||||
for(const QString& filename : allFiles) {
|
||||
if ((filename.endsWith(".bin") && filename.contains("ggml"))
|
||||
|| (filename.endsWith(".txt") && filename.startsWith("chatgpt-"))) {
|
||||
fileNames.append(filename);
|
||||
}
|
||||
}
|
||||
|
||||
for (const QString &f : fileNames) {
|
||||
QString filePath = localPath + f;
|
||||
QFileInfo info(filePath);
|
||||
|
Reference in New Issue
Block a user