// Conversation.h #pragma once #include #include #include #include #include #include #include #include #include #include #include //NEED THIS IN MAKE FILE TO USE PRIVATE HEADERS //CXXFLAGS = -std=c++17 -Wall -I/boot/system/develop/headers/private //Build works but Genio doesn't see class definitions unless I use full path ? #include "/boot/system/develop/headers/private/netservices2/NetServicesDefs.h" #include "/boot/system/develop/headers/private/netservices2/HttpSession.h" #include "/boot/system/develop/headers/private/netservices2/HttpRequest.h" #include "/boot/system/develop/headers/private/netservices2/HttpResult.h" #include "/boot/system/develop/headers/private/netservices2/HttpFields.h" #include "/boot/system/develop/headers/private/netservices2/ErrorsExt.h" //From private headers ! //#include //#include //#include //#include //#include //#include static const uint32 kSendReply = 'krpl'; static const uint32 kModelsReceived = 'mdls'; static const uint32 kClearHistory = 'clrh'; #include "include/json.hpp" using json = nlohmann::json; using namespace BPrivate::Network; using namespace BPrivate::Network; class Conversation : public BHandler { public: bool validKey = false; Conversation(BHandler* replyTo); virtual ~Conversation() ; virtual void MessageReceived(BMessage *msg); std::vector FilterTextModels(const json& modelsJson); void ask(const std::string& prompt); void setModel(const std::string& prompt); void loadModels(); void PrintAsJsonArray(const std::vector& models) ; void ClearHistory(); std::string buildHistoryInfoLine(); private: std::string buildBearerKey(); std::vector _messageHistory; void sendReply(BMessage message); BHandler* replyTarget; BString ReadOpenAIKey(); BString _apiKey; BHttpSession _sharedSession = BHttpSession (); std::optional _lastResult; std::string _activeModel = "gpt-4o"; };