mirror of
https://github.com/nomic-ai/gpt4all
synced 2024-11-08 07:10:32 +00:00
chat: better handle case where network reachability is unknown
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
c19b763e03
commit
0fc071d228
@ -42,8 +42,11 @@ LLM::LLM()
|
||||
m_compatHardware = minimal;
|
||||
|
||||
QNetworkInformation::loadDefaultBackend();
|
||||
connect(QNetworkInformation::instance(), &QNetworkInformation::reachabilityChanged,
|
||||
this, &LLM::isNetworkOnlineChanged);
|
||||
auto * netinfo = QNetworkInformation::instance();
|
||||
if (netinfo) {
|
||||
connect(netinfo, &QNetworkInformation::reachabilityChanged,
|
||||
this, &LLM::isNetworkOnlineChanged);
|
||||
}
|
||||
}
|
||||
|
||||
bool LLM::hasSettingsAccess() const
|
||||
@ -108,8 +111,6 @@ QString LLM::systemTotalRAMInGBString() const
|
||||
|
||||
bool LLM::isNetworkOnline() const
|
||||
{
|
||||
if (!QNetworkInformation::instance())
|
||||
return false;
|
||||
|
||||
return QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Online;
|
||||
auto * netinfo = QNetworkInformation::instance();
|
||||
return !netinfo || netinfo->reachability() == QNetworkInformation::Reachability::Online;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user