|
|
@ -45,32 +45,58 @@ bool operator==(const ReleaseInfo& lhs, const ReleaseInfo& rhs) {
|
|
|
|
return lhs.version == rhs.version;
|
|
|
|
return lhs.version == rhs.version;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool compareVersions(const QString &a, const QString &b) {
|
|
|
|
|
|
|
|
QStringList aParts = a.split('.');
|
|
|
|
|
|
|
|
QStringList bParts = b.split('.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < std::min(aParts.size(), bParts.size()); ++i) {
|
|
|
|
|
|
|
|
int aInt = aParts[i].toInt();
|
|
|
|
|
|
|
|
int bInt = bParts[i].toInt();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (aInt > bInt) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (aInt < bInt) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return aParts.size() > bParts.size();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QList<ModelInfo> Download::modelList() const
|
|
|
|
QList<ModelInfo> Download::modelList() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// We make sure the default model is listed first
|
|
|
|
// We make sure the default model is listed first
|
|
|
|
QList<ModelInfo> values = m_modelMap.values();
|
|
|
|
QList<ModelInfo> values = m_modelMap.values();
|
|
|
|
|
|
|
|
const QString currentVersion = QCoreApplication::applicationVersion();
|
|
|
|
|
|
|
|
|
|
|
|
ModelInfo defaultInfo;
|
|
|
|
ModelInfo defaultInfo;
|
|
|
|
ModelInfo bestGPTJInfo;
|
|
|
|
ModelInfo bestGPTJInfo;
|
|
|
|
ModelInfo bestLlamaInfo;
|
|
|
|
ModelInfo bestLlamaInfo;
|
|
|
|
|
|
|
|
QList<ModelInfo> filtered;
|
|
|
|
for (ModelInfo v : values) {
|
|
|
|
for (ModelInfo v : values) {
|
|
|
|
|
|
|
|
if (!v.requires.isEmpty()
|
|
|
|
|
|
|
|
&& v.requires != currentVersion
|
|
|
|
|
|
|
|
&& compareVersions(v.requires, currentVersion)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (v.isDefault)
|
|
|
|
if (v.isDefault)
|
|
|
|
defaultInfo = v;
|
|
|
|
defaultInfo = v;
|
|
|
|
if (v.bestGPTJ)
|
|
|
|
if (v.bestGPTJ)
|
|
|
|
bestGPTJInfo = v;
|
|
|
|
bestGPTJInfo = v;
|
|
|
|
if (v.bestLlama)
|
|
|
|
if (v.bestLlama)
|
|
|
|
bestLlamaInfo = v;
|
|
|
|
bestLlamaInfo = v;
|
|
|
|
|
|
|
|
filtered.append(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_ASSERT(defaultInfo == bestGPTJInfo || defaultInfo == bestLlamaInfo);
|
|
|
|
Q_ASSERT(defaultInfo == bestGPTJInfo || defaultInfo == bestLlamaInfo);
|
|
|
|
|
|
|
|
|
|
|
|
values.removeAll(bestLlamaInfo);
|
|
|
|
filtered.removeAll(bestLlamaInfo);
|
|
|
|
values.prepend(bestLlamaInfo);
|
|
|
|
filtered.prepend(bestLlamaInfo);
|
|
|
|
|
|
|
|
|
|
|
|
values.removeAll(bestGPTJInfo);
|
|
|
|
filtered.removeAll(bestGPTJInfo);
|
|
|
|
values.prepend(bestGPTJInfo);
|
|
|
|
filtered.prepend(bestGPTJInfo);
|
|
|
|
|
|
|
|
|
|
|
|
return values;
|
|
|
|
return filtered;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ReleaseInfo Download::releaseInfo() const
|
|
|
|
ReleaseInfo Download::releaseInfo() const
|
|
|
@ -81,24 +107,6 @@ ReleaseInfo Download::releaseInfo() const
|
|
|
|
return ReleaseInfo();
|
|
|
|
return ReleaseInfo();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool compareVersions(const QString &a, const QString &b) {
|
|
|
|
|
|
|
|
QStringList aParts = a.split('.');
|
|
|
|
|
|
|
|
QStringList bParts = b.split('.');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < std::min(aParts.size(), bParts.size()); ++i) {
|
|
|
|
|
|
|
|
int aInt = aParts[i].toInt();
|
|
|
|
|
|
|
|
int bInt = bParts[i].toInt();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (aInt > bInt) {
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (aInt < bInt) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return aParts.size() > bParts.size();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool Download::hasNewerRelease() const
|
|
|
|
bool Download::hasNewerRelease() const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
const QString currentVersion = QCoreApplication::applicationVersion();
|
|
|
|
const QString currentVersion = QCoreApplication::applicationVersion();
|
|
|
@ -290,6 +298,7 @@ void Download::parseModelsJsonFile(const QByteArray &jsonData)
|
|
|
|
|
|
|
|
|
|
|
|
QString modelFilename = obj["filename"].toString();
|
|
|
|
QString modelFilename = obj["filename"].toString();
|
|
|
|
QString modelFilesize = obj["filesize"].toString();
|
|
|
|
QString modelFilesize = obj["filesize"].toString();
|
|
|
|
|
|
|
|
QString requires = obj["requires"].toString();
|
|
|
|
QByteArray modelMd5sum = obj["md5sum"].toString().toLatin1().constData();
|
|
|
|
QByteArray modelMd5sum = obj["md5sum"].toString().toLatin1().constData();
|
|
|
|
bool isDefault = obj.contains("isDefault") && obj["isDefault"] == QString("true");
|
|
|
|
bool isDefault = obj.contains("isDefault") && obj["isDefault"] == QString("true");
|
|
|
|
bool bestGPTJ = obj.contains("bestGPTJ") && obj["bestGPTJ"] == QString("true");
|
|
|
|
bool bestGPTJ = obj.contains("bestGPTJ") && obj["bestGPTJ"] == QString("true");
|
|
|
@ -320,6 +329,7 @@ void Download::parseModelsJsonFile(const QByteArray &jsonData)
|
|
|
|
modelInfo.bestGPTJ = bestGPTJ;
|
|
|
|
modelInfo.bestGPTJ = bestGPTJ;
|
|
|
|
modelInfo.bestLlama = bestLlama;
|
|
|
|
modelInfo.bestLlama = bestLlama;
|
|
|
|
modelInfo.description = description;
|
|
|
|
modelInfo.description = description;
|
|
|
|
|
|
|
|
modelInfo.requires = requires;
|
|
|
|
m_modelMap.insert(modelInfo.filename, modelInfo);
|
|
|
|
m_modelMap.insert(modelInfo.filename, modelInfo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|