mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2024-10-01 01:06:10 -04:00
mixpanel: report more information about the build and platform (#2939)
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
parent
39005288c5
commit
08d9a401d2
@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
||||
### Added
|
||||
- Use greedy sampling when temperature is set to zero ([#2854](https://github.com/nomic-ai/gpt4all/pull/2854))
|
||||
- Use configured system prompt in server mode and ignore system messages ([#2921](https://github.com/nomic-ai/gpt4all/pull/2921), [#2924](https://github.com/nomic-ai/gpt4all/pull/2924))
|
||||
- Add more system information to anonymous usage stats ([#2939](https://github.com/nomic-ai/gpt4all/pull/2939))
|
||||
|
||||
### Changed
|
||||
- The offline update button now directs users to the offline installer releases page. (by [@3Simplex](https://github.com/3Simplex) in [#2888](https://github.com/nomic-ai/gpt4all/pull/2888))
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QLibraryInfo>
|
||||
#include <QNetworkRequest>
|
||||
#include <QScreen>
|
||||
#include <QSettings>
|
||||
@ -36,23 +37,52 @@
|
||||
#include <cstring>
|
||||
#include <utility>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
# include <gnu/libc-version.h>
|
||||
#endif
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
#define STR_(x) #x
|
||||
#define STR(x) STR_(x)
|
||||
|
||||
static const char MIXPANEL_TOKEN[] = "ce362e568ddaee16ed243eaffb5860a2";
|
||||
|
||||
#ifdef __clang__
|
||||
#ifdef __apple_build_version__
|
||||
static const char COMPILER_NAME[] = "Apple Clang";
|
||||
#else
|
||||
static const char COMPILER_NAME[] = "LLVM Clang";
|
||||
#endif
|
||||
static const char COMPILER_VER[] = STR(__clang_major__) "." STR(__clang_minor__) "." STR(__clang_patchlevel__);
|
||||
#elifdef _MSC_VER
|
||||
static const char COMPILER_NAME[] = "MSVC";
|
||||
static const char COMPILER_VER[] = STR(_MSC_VER) " (" STR(_MSC_FULL_VER) ")";
|
||||
#elifdef __GNUC__
|
||||
static const char COMPILER_NAME[] = "GCC";
|
||||
static const char COMPILER_VER[] = STR(__GNUC__) "." STR(__GNUC_MINOR__) "." STR(__GNUC_PATCHLEVEL__);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(Q_OS_MAC)
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
static QString getCPUModel()
|
||||
static std::optional<QString> getSysctl(const char *name)
|
||||
{
|
||||
char buffer[256];
|
||||
char buffer[256] = "";
|
||||
size_t bufferlen = sizeof(buffer);
|
||||
sysctlbyname("machdep.cpu.brand_string", &buffer, &bufferlen, NULL, 0);
|
||||
return buffer;
|
||||
if (sysctlbyname(name, &buffer, &bufferlen, NULL, 0) < 0) {
|
||||
int err = errno;
|
||||
qWarning().nospace() << "sysctlbyname(\"" << name << "\") failed: " << strerror(err);
|
||||
return std::nullopt;
|
||||
}
|
||||
return std::make_optional<QString>(buffer);
|
||||
}
|
||||
|
||||
static QString getCPUModel() { return getSysctl("machdep.cpu.brand_string").value_or(u"(unknown)"_s); }
|
||||
|
||||
#elif defined(__x86_64__) || defined(__i386__) || defined(_M_X64) || defined(_M_IX86)
|
||||
|
||||
#ifndef _MSC_VER
|
||||
@ -286,12 +316,36 @@ void Network::sendStartup()
|
||||
|
||||
const auto *display = QGuiApplication::primaryScreen();
|
||||
trackEvent("startup", {
|
||||
{"$screen_dpi", std::round(display->physicalDotsPerInch())},
|
||||
{"display", u"%1x%2"_s.arg(display->size().width()).arg(display->size().height())},
|
||||
{"ram", LLM::globalInstance()->systemTotalRAMInGB()},
|
||||
{"cpu", getCPUModel()},
|
||||
{"cpu_supports_avx2", LLModel::Implementation::cpuSupportsAVX2()},
|
||||
{"datalake_active", mySettings->networkIsActive()},
|
||||
// Build info
|
||||
{ "build_compiler", COMPILER_NAME },
|
||||
{ "build_compiler_ver", COMPILER_VER },
|
||||
{ "build_abi", QSysInfo::buildAbi() },
|
||||
{ "build_cpu_arch", QSysInfo::buildCpuArchitecture() },
|
||||
#ifdef __GLIBC__
|
||||
{ "build_glibc_ver", QStringLiteral(STR(__GLIBC__) "." STR(__GLIBC_MINOR__)) },
|
||||
#endif
|
||||
{ "qt_version", QLibraryInfo::version().toString() },
|
||||
{ "qt_debug" , QLibraryInfo::isDebugBuild() },
|
||||
{ "qt_shared", QLibraryInfo::isSharedBuild() },
|
||||
// System info
|
||||
{ "runtime_cpu_arch", QSysInfo::currentCpuArchitecture() },
|
||||
#ifdef __GLIBC__
|
||||
{ "runtime_glibc_ver", gnu_get_libc_version() },
|
||||
#endif
|
||||
{ "sys_kernel_type", QSysInfo::kernelType() },
|
||||
{ "sys_kernel_ver", QSysInfo::kernelVersion() },
|
||||
{ "sys_product_type", QSysInfo::productType() },
|
||||
{ "sys_product_ver", QSysInfo::productVersion() },
|
||||
#ifdef Q_OS_MAC
|
||||
{ "sys_hw_model", getSysctl("hw.model").value_or(u"(unknown)"_s) },
|
||||
#endif
|
||||
{ "$screen_dpi", std::round(display->physicalDotsPerInch()) },
|
||||
{ "display", u"%1x%2"_s.arg(display->size().width()).arg(display->size().height()) },
|
||||
{ "ram", LLM::globalInstance()->systemTotalRAMInGB() },
|
||||
{ "cpu", getCPUModel() },
|
||||
{ "cpu_supports_avx2", LLModel::Implementation::cpuSupportsAVX2() },
|
||||
// Datalake status
|
||||
{ "datalake_active", mySettings->networkIsActive() },
|
||||
});
|
||||
sendIpify();
|
||||
|
||||
@ -321,7 +375,6 @@ void Network::trackEvent(const QString &ev, const QVariantMap &props)
|
||||
if (!m_sendUsageStats)
|
||||
return;
|
||||
|
||||
Q_ASSERT(ChatListModel::globalInstance()->currentChat());
|
||||
QJsonObject properties;
|
||||
|
||||
properties.insert("token", MIXPANEL_TOKEN);
|
||||
|
Loading…
Reference in New Issue
Block a user