Skip to content

Commit

Permalink
Update OpenAIDbLog.inc
Browse files Browse the repository at this point in the history
  • Loading branch information
keiserjb authored Nov 26, 2024
1 parent c729d67 commit 59e4e5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/openai_dblog/includes/OpenAIDbLog.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ class OpenAIDbLog {

public function __construct() {
$config = config_get('openai.settings');
$this->api = new OpenAIApi($config['api_key']);

// Get the key value using the key module.
$api_key = key_get_key_value($config['api_key']);

if (empty($api_key)) {
throw new Exception(t('The OpenAI API key is not set or is invalid. Please configure it in the OpenAI settings.'));
}

$this->api = new OpenAIApi($api_key);
}

public function getOpenAIExplanation($dblog) {
Expand Down

0 comments on commit 59e4e5a

Please sign in to comment.