chat: set search path early

This fixes the issues with installed versions of v2.6.0.
This commit is contained in:
Jared Van Bortel
2024-01-11 12:02:39 -05:00
parent f7aeeca884
commit 7e9786fccf
5 changed files with 27 additions and 27 deletions

View File

@@ -1,15 +1,14 @@
#include "llm.h"
#include "../gpt4all-backend/sysinfo.h"
#include "../gpt4all-backend/llmodel.h"
#include "network.h"
#include <QCoreApplication>
#include <QDesktopServices>
#include <QDir>
#include <QFile>
#include <QProcess>
#include <QResource>
#include <QSettings>
#include <QDesktopServices>
#include <QUrl>
#include <fstream>
class MyLLM: public LLM { };
@@ -23,20 +22,6 @@ LLM::LLM()
: QObject{nullptr}
, m_compatHardware(true)
{
QString llmodelSearchPaths = QCoreApplication::applicationDirPath();
const QString libDir = QCoreApplication::applicationDirPath() + "/../lib/";
if (directoryExists(libDir))
llmodelSearchPaths += ";" + libDir;
#if defined(Q_OS_MAC)
const QString binDir = QCoreApplication::applicationDirPath() + "/../../../";
if (directoryExists(binDir))
llmodelSearchPaths += ";" + binDir;
const QString frameworksDir = QCoreApplication::applicationDirPath() + "/../Frameworks/";
if (directoryExists(frameworksDir))
llmodelSearchPaths += ";" + frameworksDir;
#endif
LLModel::Implementation::setImplementationsSearchPath(llmodelSearchPaths.toStdString());
#if defined(__x86_64__)
#ifndef _MSC_VER
const bool minimal(__builtin_cpu_supports("avx"));
@@ -86,7 +71,7 @@ bool LLM::checkForUpdates() const
#endif
}
bool LLM::directoryExists(const QString &path) const
bool LLM::directoryExists(const QString &path)
{
const QUrl url(path);
const QString localFilePath = url.isLocalFile() ? url.toLocalFile() : path;
@@ -94,7 +79,7 @@ bool LLM::directoryExists(const QString &path) const
return info.exists() && info.isDir();
}
bool LLM::fileExists(const QString &path) const
bool LLM::fileExists(const QString &path)
{
const QUrl url(path);
const QString localFilePath = url.isLocalFile() ? url.toLocalFile() : path;