mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
main: set llmodel search path before initializing MySettings
This fixes a regression in PR #2659. Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
73eef88138
commit
702e3fad13
@ -33,18 +33,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
// Set the local and language translation before the qml engine has even been started. This will
|
// set search path before constructing the MySettings instance, which relies on this
|
||||||
// use the default system locale unless the user has explicitly set it to use a different one.
|
|
||||||
MySettings::globalInstance()->setLanguageAndLocale();
|
|
||||||
|
|
||||||
QQmlApplicationEngine engine;
|
|
||||||
|
|
||||||
// Add a connection here from MySettings::languageAndLocaleChanged signal to a lambda slot where I can call
|
|
||||||
// engine.uiLanguage property
|
|
||||||
QObject::connect(MySettings::globalInstance(), &MySettings::languageAndLocaleChanged, [&engine]() {
|
|
||||||
engine.setUiLanguage(MySettings::globalInstance()->languageAndLocale());
|
|
||||||
});
|
|
||||||
|
|
||||||
QString llmodelSearchPaths = QCoreApplication::applicationDirPath();
|
QString llmodelSearchPaths = QCoreApplication::applicationDirPath();
|
||||||
const QString libDir = QCoreApplication::applicationDirPath() + "/../lib/";
|
const QString libDir = QCoreApplication::applicationDirPath() + "/../lib/";
|
||||||
if (LLM::directoryExists(libDir))
|
if (LLM::directoryExists(libDir))
|
||||||
@ -59,6 +48,18 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
LLModel::Implementation::setImplementationsSearchPath(llmodelSearchPaths.toStdString());
|
LLModel::Implementation::setImplementationsSearchPath(llmodelSearchPaths.toStdString());
|
||||||
|
|
||||||
|
// Set the local and language translation before the qml engine has even been started. This will
|
||||||
|
// use the default system locale unless the user has explicitly set it to use a different one.
|
||||||
|
MySettings::globalInstance()->setLanguageAndLocale();
|
||||||
|
|
||||||
|
QQmlApplicationEngine engine;
|
||||||
|
|
||||||
|
// Add a connection here from MySettings::languageAndLocaleChanged signal to a lambda slot where I can call
|
||||||
|
// engine.uiLanguage property
|
||||||
|
QObject::connect(MySettings::globalInstance(), &MySettings::languageAndLocaleChanged, [&engine]() {
|
||||||
|
engine.setUiLanguage(MySettings::globalInstance()->languageAndLocale());
|
||||||
|
});
|
||||||
|
|
||||||
qmlRegisterSingletonInstance("mysettings", 1, 0, "MySettings", MySettings::globalInstance());
|
qmlRegisterSingletonInstance("mysettings", 1, 0, "MySettings", MySettings::globalInstance());
|
||||||
qmlRegisterSingletonInstance("modellist", 1, 0, "ModelList", ModelList::globalInstance());
|
qmlRegisterSingletonInstance("modellist", 1, 0, "ModelList", ModelList::globalInstance());
|
||||||
qmlRegisterSingletonInstance("chatlistmodel", 1, 0, "ChatListModel", ChatListModel::globalInstance());
|
qmlRegisterSingletonInstance("chatlistmodel", 1, 0, "ChatListModel", ChatListModel::globalInstance());
|
||||||
|
Loading…
Reference in New Issue
Block a user