We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c729d67 commit 59e4e5aCopy full SHA for 59e4e5a
modules/openai_dblog/includes/OpenAIDbLog.inc
@@ -6,7 +6,15 @@ class OpenAIDbLog {
6
7
public function __construct() {
8
$config = config_get('openai.settings');
9
- $this->api = new OpenAIApi($config['api_key']);
+
10
+ // Get the key value using the key module.
11
+ $api_key = key_get_key_value($config['api_key']);
12
13
+ if (empty($api_key)) {
14
+ throw new Exception(t('The OpenAI API key is not set or is invalid. Please configure it in the OpenAI settings.'));
15
+ }
16
17
+ $this->api = new OpenAIApi($api_key);
18
}
19
20
public function getOpenAIExplanation($dblog) {
0 commit comments