Some more startup info to help determine what hardware we need to support.

This commit is contained in:
Adam Treat 2023-05-02 16:24:06 -04:00
parent 21dc522200
commit cb085a6418

View File

@ -2,15 +2,27 @@
#include "llm.h" #include "llm.h"
#include <QCoreApplication> #include <QCoreApplication>
#include <QGuiApplication>
#include <QUuid> #include <QUuid>
#include <QJsonDocument> #include <QJsonDocument>
#include <QJsonArray> #include <QJsonArray>
#include <QJsonObject> #include <QJsonObject>
#include <QSettings> #include <QSettings>
#include <QNetworkRequest> #include <QNetworkRequest>
#include <QScreen>
//#define DEBUG //#define DEBUG
#ifdef __APPLE__
#include <sys/sysctl.h>
std::string getCPUModel() {
char buffer[256];
size_t bufferlen = sizeof(buffer);
sysctlbyname("machdep.cpu.brand_string", &buffer, &bufferlen, NULL, 0);
return std::string(buffer);
}
#endif
class MyNetwork: public Network { }; class MyNetwork: public Network { };
Q_GLOBAL_STATIC(MyNetwork, networkInstance) Q_GLOBAL_STATIC(MyNetwork, networkInstance)
Network *Network::globalInstance() Network *Network::globalInstance()
@ -234,6 +246,20 @@ void Network::sendMixpanelEvent(const QString &ev)
+ QCoreApplication::applicationVersion()); + QCoreApplication::applicationVersion());
properties.insert("model", LLM::globalInstance()->chatListModel()->currentChat()->modelName()); properties.insert("model", LLM::globalInstance()->chatListModel()->currentChat()->modelName());
// Some additional startup information
if (ev == "startup") {
const QSize display = QGuiApplication::primaryScreen()->size();
properties.insert("display", QString("%1x%2").arg(display.width()).arg(display.height()));
#if defined(__x86_64__) || defined(__i386__)
properties.insert("avx", __builtin_cpu_supports("avx"));
properties.insert("avx2", __builtin_cpu_supports("avx2"));
properties.insert("fma", __builtin_cpu_supports("fma"));
#endif
#ifdef __APPLE__
properties.insert("cpu", QString::fromStdString(getCPUModel()));
#endif
}
QJsonObject event; QJsonObject event;
event.insert("event", ev); event.insert("event", ev);
event.insert("properties", properties); event.insert("properties", properties);