mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-05 10:30:29 +00:00
Don't show the download button if we are not connected to an online network.
Signed-off-by: Adam Treat <treat.adam@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include <QResource>
|
||||
#include <QSettings>
|
||||
#include <QUrl>
|
||||
#include <QNetworkInformation>
|
||||
#include <fstream>
|
||||
|
||||
#ifndef GPT4ALL_OFFLINE_INSTALLER
|
||||
@@ -39,6 +40,10 @@ LLM::LLM()
|
||||
#endif
|
||||
|
||||
m_compatHardware = minimal;
|
||||
|
||||
QNetworkInformation::loadDefaultBackend();
|
||||
connect(QNetworkInformation::instance(), &QNetworkInformation::reachabilityChanged,
|
||||
this, &LLM::isNetworkOnlineChanged);
|
||||
}
|
||||
|
||||
bool LLM::hasSettingsAccess() const
|
||||
@@ -100,3 +105,11 @@ QString LLM::systemTotalRAMInGBString() const
|
||||
{
|
||||
return QString::fromStdString(getSystemTotalRAMInGBString());
|
||||
}
|
||||
|
||||
bool LLM::isNetworkOnline() const
|
||||
{
|
||||
if (!QNetworkInformation::instance())
|
||||
return false;
|
||||
|
||||
return QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Online;
|
||||
}
|
||||
|
Reference in New Issue
Block a user