Skip to content
Snippets Groups Projects

Allow use of the API key in the additional headers configuration.

1 file
+ 3
1
Compare changes
  • Side-by-side
  • Inline
@@ -270,6 +270,8 @@ class AzureProvider extends AiProviderClientBase implements
// Also check for extra headers.
if (!empty($data['extra_headers'])) {
// String replacement for @apikey.
$data['extra_headers'] = str_replace('@apikey', $this->apiKey, $data['extra_headers']);
foreach (explode("\n", $data['extra_headers']) as $header) {
// Tokenize the header.
if ($this->tokenTree) {
@@ -634,7 +636,7 @@ class AzureProvider extends AiProviderClientBase implements
$form['model_data']['advanced_settings']['extra_headers'] = [
'#type' => 'textarea',
'#title' => $this->t('Extra headers'),
'#description' => $this->t('Sometimes you might need extra headers for Azure, you can add it here. One header per line in key:value format. If Token module is installed, user tokens are available here.'),
'#description' => $this->t('Sometimes you might need extra headers for Azure, you can add it here. One header per line in key:value format. If Token module is installed, user tokens are available here. The API key can be substituted with <em>@apikey</em>'),
'#attributes' => [
'placeholder' => "Authorization:Bearer 123\nContent-Type:application/json",
],
Loading