From 20365ac57b3932d04a9c9f4f1c54994c153bc68d Mon Sep 17 00:00:00 2001 From: Martin Dvorak Date: Sun, 18 Feb 2024 16:52:11 +0100 Subject: [PATCH] Adding ability to specify OpenAI LLM model using env variable #1534; fixing HTML garbage in Preferences dialog. --- app/src/qt/dialogs/configuration_dialog.cpp | 2 +- lib/src/app_info.h | 6 +++--- lib/src/config/configuration.cpp | 10 +++++++++- lib/src/config/configuration.h | 1 + 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/src/qt/dialogs/configuration_dialog.cpp b/app/src/qt/dialogs/configuration_dialog.cpp index 0db15217..d68cfe3a 100644 --- a/app/src/qt/dialogs/configuration_dialog.cpp +++ b/app/src/qt/dialogs/configuration_dialog.cpp @@ -160,7 +160,7 @@ ConfigurationDialog::AppTab::AppTab(QWidget *parent) appearanceLayout->addWidget(menuLabel); appearanceLayout->addWidget(nerdMenuCheck); QGroupBox* appearanceGroup = new QGroupBox{ - tr("Appearance (requires restart)"), + tr("Appearance"), this}; appearanceGroup->setLayout(appearanceLayout); diff --git a/lib/src/app_info.h b/lib/src/app_info.h index 2381bf07..0ea13b2f 100644 --- a/lib/src/app_info.h +++ b/lib/src/app_info.h @@ -1,8 +1,8 @@ #define MINDFORGER_VERSION_MAJOR "2" #define MINDFORGER_VERSION_MINOR "0" -#define MINDFORGER_VERSION_REVISION "0" -#define MINDFORGER_VERSION_STRING "2.0.0" -#define MINDFORGER_VERSION_DWORD 2,0,0,2 +#define MINDFORGER_VERSION_REVISION "1" +#define MINDFORGER_VERSION_STRING "2.0.1" +#define MINDFORGER_VERSION_DWORD 2,0,1,2 #define MINDFORGER_APP_NAME "MindForger" #define MINDFORGER_APP_DESCRIPTION "MindForger Thinking Notebook" #define MINDFORGER_APP_AUTHOR "Martin Dvorak" diff --git a/lib/src/config/configuration.cpp b/lib/src/config/configuration.cpp index b7b167e6..310d3fe2 100644 --- a/lib/src/config/configuration.cpp +++ b/lib/src/config/configuration.cpp @@ -446,7 +446,15 @@ bool Configuration::initWingmanOpenAi() { MF_DEBUG(" Wingman API key loaded from the env: " << apiKeyEnv << endl); wingmanApiKey = apiKeyEnv; } - wingmanLlmModel = DEFAULT_WINGMAN_LLM_MODEL_OPENAI; + + const char* llmModelEnv = std::getenv(ENV_VAR_OPENAI_LLM_MODEL); + if(llmModelEnv) { + MF_DEBUG(" Wingman LLM model loaded from the env: " << llmModelEnv << endl); + wingmanLlmModel = llmModelEnv; + } else { + MF_DEBUG(" Wingman LLM model set to default: " << DEFAULT_WINGMAN_LLM_MODEL_OPENAI << endl); + wingmanLlmModel = DEFAULT_WINGMAN_LLM_MODEL_OPENAI; + } wingmanProvider = WingmanLlmProviders::WINGMAN_PROVIDER_OPENAI; return true; } diff --git a/lib/src/config/configuration.h b/lib/src/config/configuration.h index 08790b19..647f8617 100644 --- a/lib/src/config/configuration.h +++ b/lib/src/config/configuration.h @@ -177,6 +177,7 @@ struct KnowledgeTool // Wingman LLM models API keys constexpr const auto ENV_VAR_OPENAI_API_KEY = "MINDFORGER_OPENAI_API_KEY"; +constexpr const auto ENV_VAR_OPENAI_LLM_MODEL = "MINDFORGER_OPENAI_LLM_MODEL"; // improve platform/language specific constexpr const auto DEFAULT_NEW_OUTLINE = "# New Markdown File\n\nThis is a new Markdown file created by MindForger.\n\n#Section 1\nThe first section.\n\n";