Skip to content

Commit

Permalink
Adding ability to specify OpenAI LLM model using env variable #1534; …
Browse files Browse the repository at this point in the history
…fixing HTML garbage in Preferences dialog.
  • Loading branch information
dvorka committed Feb 18, 2024
1 parent d240084 commit 20365ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/src/qt/dialogs/configuration_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ ConfigurationDialog::AppTab::AppTab(QWidget *parent)
appearanceLayout->addWidget(menuLabel);
appearanceLayout->addWidget(nerdMenuCheck);
QGroupBox* appearanceGroup = new QGroupBox{
tr("Appearance (<font color='#ff0000'>requires restart</font>)"),
tr("Appearance"),
this};
appearanceGroup->setLayout(appearanceLayout);

Expand Down
6 changes: 3 additions & 3 deletions lib/src/app_info.h
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 9 additions & 1 deletion lib/src/config/configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/config/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 20365ac

Please sign in to comment.