mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
Rename to something more descriptive.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
parent
fbc9e24f23
commit
ec4559022f
@ -526,7 +526,7 @@ QString ModelList::incompleteDownloadPath(const QString &modelFile)
|
|||||||
return MySettings::globalInstance()->modelPath() + "incomplete-" + modelFile;
|
return MySettings::globalInstance()->modelPath() + "incomplete-" + modelFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QList<ModelInfo> ModelList::userDefaultModelList() const
|
const QList<ModelInfo> ModelList::selectableModelList() const
|
||||||
{
|
{
|
||||||
// FIXME: This needs to be kept in sync with m_selectableModels so should probably be merged
|
// FIXME: This needs to be kept in sync with m_selectableModels so should probably be merged
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
@ -653,7 +653,7 @@ void ModelList::addModel(const QString &id)
|
|||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
emit userDefaultModelListChanged();
|
emit selectableModelListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelList::changeId(const QString &oldId, const QString &newId)
|
void ModelList::changeId(const QString &oldId, const QString &newId)
|
||||||
@ -1001,7 +1001,7 @@ void ModelList::updateData(const QString &id, const QVector<QPair<int, QVariant>
|
|||||||
m_installedModels->invalidate();
|
m_installedModels->invalidate();
|
||||||
m_downloadableModels->invalidate();
|
m_downloadableModels->invalidate();
|
||||||
|
|
||||||
emit userDefaultModelListChanged();
|
emit selectableModelListChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelList::resortModel()
|
void ModelList::resortModel()
|
||||||
@ -1141,7 +1141,7 @@ void ModelList::removeInternal(const ModelInfo &model)
|
|||||||
delete info;
|
delete info;
|
||||||
}
|
}
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
emit userDefaultModelListChanged();
|
emit selectableModelListChanged();
|
||||||
MySettings::globalInstance()->eraseModel(model);
|
MySettings::globalInstance()->eraseModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class ModelList : public QAbstractListModel
|
|||||||
Q_PROPERTY(InstalledModels* installedModels READ installedModels NOTIFY installedModelsChanged)
|
Q_PROPERTY(InstalledModels* installedModels READ installedModels NOTIFY installedModelsChanged)
|
||||||
Q_PROPERTY(InstalledModels* selectableModels READ selectableModels NOTIFY selectableModelsChanged)
|
Q_PROPERTY(InstalledModels* selectableModels READ selectableModels NOTIFY selectableModelsChanged)
|
||||||
Q_PROPERTY(DownloadableModels* downloadableModels READ downloadableModels NOTIFY downloadableModelsChanged)
|
Q_PROPERTY(DownloadableModels* downloadableModels READ downloadableModels NOTIFY downloadableModelsChanged)
|
||||||
Q_PROPERTY(QList<ModelInfo> userDefaultModelList READ userDefaultModelList NOTIFY userDefaultModelListChanged)
|
Q_PROPERTY(QList<ModelInfo> selectableModelList READ selectableModelList NOTIFY selectableModelListChanged)
|
||||||
Q_PROPERTY(bool asyncModelRequestOngoing READ asyncModelRequestOngoing NOTIFY asyncModelRequestOngoingChanged)
|
Q_PROPERTY(bool asyncModelRequestOngoing READ asyncModelRequestOngoing NOTIFY asyncModelRequestOngoingChanged)
|
||||||
Q_PROPERTY(int discoverLimit READ discoverLimit WRITE setDiscoverLimit NOTIFY discoverLimitChanged)
|
Q_PROPERTY(int discoverLimit READ discoverLimit WRITE setDiscoverLimit NOTIFY discoverLimitChanged)
|
||||||
Q_PROPERTY(int discoverSortDirection READ discoverSortDirection WRITE setDiscoverSortDirection NOTIFY discoverSortDirectionChanged)
|
Q_PROPERTY(int discoverSortDirection READ discoverSortDirection WRITE setDiscoverSortDirection NOTIFY discoverSortDirectionChanged)
|
||||||
@ -408,7 +408,7 @@ public:
|
|||||||
void addModel(const QString &id);
|
void addModel(const QString &id);
|
||||||
void changeId(const QString &oldId, const QString &newId);
|
void changeId(const QString &oldId, const QString &newId);
|
||||||
|
|
||||||
const QList<ModelInfo> userDefaultModelList() const;
|
const QList<ModelInfo> selectableModelList() const;
|
||||||
|
|
||||||
InstalledModels *installedModels() const { return m_installedModels; }
|
InstalledModels *installedModels() const { return m_installedModels; }
|
||||||
InstalledModels *selectableModels() const { return m_selectableModels; }
|
InstalledModels *selectableModels() const { return m_selectableModels; }
|
||||||
@ -451,7 +451,7 @@ Q_SIGNALS:
|
|||||||
void installedModelsChanged();
|
void installedModelsChanged();
|
||||||
void selectableModelsChanged();
|
void selectableModelsChanged();
|
||||||
void downloadableModelsChanged();
|
void downloadableModelsChanged();
|
||||||
void userDefaultModelListChanged();
|
void selectableModelListChanged();
|
||||||
void asyncModelRequestOngoingChanged();
|
void asyncModelRequestOngoingChanged();
|
||||||
void discoverLimitChanged();
|
void discoverLimitChanged();
|
||||||
void discoverSortDirectionChanged();
|
void discoverSortDirectionChanged();
|
||||||
|
@ -287,8 +287,8 @@ MySettingsTab {
|
|||||||
function rebuildModel() {
|
function rebuildModel() {
|
||||||
defaultModelBoxModel.clear();
|
defaultModelBoxModel.clear();
|
||||||
defaultModelBoxModel.append({"text": qsTr("Application default")});
|
defaultModelBoxModel.append({"text": qsTr("Application default")});
|
||||||
for (var i = 0; i < ModelList.userDefaultModelList.length; ++i)
|
for (var i = 0; i < ModelList.selectableModelList.length; ++i)
|
||||||
defaultModelBoxModel.append({"text": ModelList.userDefaultModelList[i].name});
|
defaultModelBoxModel.append({"text": ModelList.selectableModelList[i].name});
|
||||||
defaultModelBox.updateModel();
|
defaultModelBox.updateModel();
|
||||||
}
|
}
|
||||||
function updateModel() {
|
function updateModel() {
|
||||||
@ -315,7 +315,7 @@ MySettingsTab {
|
|||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
target: ModelList
|
target: ModelList
|
||||||
function onUserDefaultModelListChanged() {
|
function onSelectableModelListChanged() {
|
||||||
defaultModelBox.rebuildModel()
|
defaultModelBox.rebuildModel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void Server::start()
|
|||||||
if (!MySettings::globalInstance()->serverChat())
|
if (!MySettings::globalInstance()->serverChat())
|
||||||
return QHttpServerResponse(QHttpServerResponder::StatusCode::Unauthorized);
|
return QHttpServerResponse(QHttpServerResponder::StatusCode::Unauthorized);
|
||||||
|
|
||||||
const QList<ModelInfo> modelList = ModelList::globalInstance()->userDefaultModelList();
|
const QList<ModelInfo> modelList = ModelList::globalInstance()->selectableModelList();
|
||||||
QJsonObject root;
|
QJsonObject root;
|
||||||
root.insert("object", "list");
|
root.insert("object", "list");
|
||||||
QJsonArray data;
|
QJsonArray data;
|
||||||
@ -117,7 +117,7 @@ void Server::start()
|
|||||||
if (!MySettings::globalInstance()->serverChat())
|
if (!MySettings::globalInstance()->serverChat())
|
||||||
return QHttpServerResponse(QHttpServerResponder::StatusCode::Unauthorized);
|
return QHttpServerResponse(QHttpServerResponder::StatusCode::Unauthorized);
|
||||||
|
|
||||||
const QList<ModelInfo> modelList = ModelList::globalInstance()->userDefaultModelList();
|
const QList<ModelInfo> modelList = ModelList::globalInstance()->selectableModelList();
|
||||||
QJsonObject object;
|
QJsonObject object;
|
||||||
for (const ModelInfo &info : modelList) {
|
for (const ModelInfo &info : modelList) {
|
||||||
Q_ASSERT(info.installed);
|
Q_ASSERT(info.installed);
|
||||||
@ -234,7 +234,7 @@ QHttpServerResponse Server::handleCompletionRequest(const QHttpServerRequest &re
|
|||||||
|
|
||||||
const QString modelRequested = body["model"].toString();
|
const QString modelRequested = body["model"].toString();
|
||||||
ModelInfo modelInfo = ModelList::globalInstance()->defaultModelInfo();
|
ModelInfo modelInfo = ModelList::globalInstance()->defaultModelInfo();
|
||||||
const QList<ModelInfo> modelList = ModelList::globalInstance()->userDefaultModelList();
|
const QList<ModelInfo> modelList = ModelList::globalInstance()->selectableModelList();
|
||||||
for (const ModelInfo &info : modelList) {
|
for (const ModelInfo &info : modelList) {
|
||||||
Q_ASSERT(info.installed);
|
Q_ASSERT(info.installed);
|
||||||
if (!info.installed)
|
if (!info.installed)
|
||||||
|
Loading…
Reference in New Issue
Block a user