|
|
@ -69,34 +69,39 @@ 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;
|
|
|
|
|
|
|
|
ModelInfo bestMPTInfo;
|
|
|
|
QList<ModelInfo> filtered;
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (v.bestMPT)
|
|
|
|
|
|
|
|
bestMPTInfo = v;
|
|
|
|
filtered.append(v);
|
|
|
|
filtered.append(v);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Q_ASSERT(defaultInfo == bestGPTJInfo || defaultInfo == bestLlamaInfo);
|
|
|
|
Q_ASSERT(defaultInfo == bestGPTJInfo || defaultInfo == bestLlamaInfo || defaultInfo == bestMPTInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bestLlamaInfo.bestLlama) {
|
|
|
|
filtered.removeAll(bestLlamaInfo);
|
|
|
|
filtered.removeAll(bestLlamaInfo);
|
|
|
|
filtered.prepend(bestLlamaInfo);
|
|
|
|
filtered.prepend(bestLlamaInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bestGPTJInfo.bestGPTJ) {
|
|
|
|
filtered.removeAll(bestGPTJInfo);
|
|
|
|
filtered.removeAll(bestGPTJInfo);
|
|
|
|
filtered.prepend(bestGPTJInfo);
|
|
|
|
filtered.prepend(bestGPTJInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bestMPTInfo.bestMPT) {
|
|
|
|
|
|
|
|
filtered.removeAll(bestMPTInfo);
|
|
|
|
|
|
|
|
filtered.prepend(bestMPTInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return filtered;
|
|
|
|
return filtered;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -316,6 +321,7 @@ void Download::parseModelsJsonFile(const QByteArray &jsonData)
|
|
|
|
|
|
|
|
|
|
|
|
QString defaultModel;
|
|
|
|
QString defaultModel;
|
|
|
|
QJsonArray jsonArray = document.array();
|
|
|
|
QJsonArray jsonArray = document.array();
|
|
|
|
|
|
|
|
const QString currentVersion = QCoreApplication::applicationVersion();
|
|
|
|
|
|
|
|
|
|
|
|
m_modelMap.clear();
|
|
|
|
m_modelMap.clear();
|
|
|
|
for (const QJsonValue &value : jsonArray) {
|
|
|
|
for (const QJsonValue &value : jsonArray) {
|
|
|
@ -328,8 +334,15 @@ void Download::parseModelsJsonFile(const QByteArray &jsonData)
|
|
|
|
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");
|
|
|
|
bool bestLlama = obj.contains("bestLlama") && obj["bestLlama"] == QString("true");
|
|
|
|
bool bestLlama = obj.contains("bestLlama") && obj["bestLlama"] == QString("true");
|
|
|
|
|
|
|
|
bool bestMPT = obj.contains("bestMPT") && obj["bestMPT"] == QString("true");
|
|
|
|
QString description = obj["description"].toString();
|
|
|
|
QString description = obj["description"].toString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!requires.isEmpty()
|
|
|
|
|
|
|
|
&& requires != currentVersion
|
|
|
|
|
|
|
|
&& compareVersions(requires, currentVersion)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isDefault)
|
|
|
|
if (isDefault)
|
|
|
|
defaultModel = modelFilename;
|
|
|
|
defaultModel = modelFilename;
|
|
|
|
quint64 sz = modelFilesize.toULongLong();
|
|
|
|
quint64 sz = modelFilesize.toULongLong();
|
|
|
|