Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions lib/experimental/connectors/default-connectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,32 +91,32 @@ function _gutenberg_get_real_api_key( string $option_name, callable $mask_callba
return $value;
}

// --- Gemini (Google) ---
// --- Google ---

/**
* Masks the Gemini API key on read.
* Masks the Google API key on read.
*
* @access private
*
* @param string $value The raw option value.
* @return string Masked key or empty string.
*/
function _gutenberg_mask_gemini_api_key( string $value ): string {
function _gutenberg_mask_google_api_key( string $value ): string {
if ( '' === $value ) {
return $value;
}
return _gutenberg_mask_api_key( $value );
}

/**
* Sanitizes and validates the Gemini API key before saving.
* Sanitizes and validates the Google API key before saving.
*
* @access private
*
* @param string $value The new value.
* @return string The sanitized value, or empty string if the key is not valid.
*/
function _gutenberg_sanitize_gemini_api_key( string $value ): string {
function _gutenberg_sanitize_google_api_key( string $value ): string {
$value = sanitize_text_field( $value );
if ( '' === $value ) {
return $value;
Expand Down Expand Up @@ -204,17 +204,17 @@ function _gutenberg_sanitize_anthropic_api_key( string $value ): string {
*/
function _gutenberg_get_connectors(): array {
return array(
'connectors_gemini_api_key' => array(
'connectors_ai_google_api_key' => array(
'provider' => 'google',
'mask' => '_gutenberg_mask_gemini_api_key',
'sanitize' => '_gutenberg_sanitize_gemini_api_key',
'mask' => '_gutenberg_mask_google_api_key',
'sanitize' => '_gutenberg_sanitize_google_api_key',
),
'connectors_openai_api_key' => array(
'connectors_ai_openai_api_key' => array(
'provider' => 'openai',
'mask' => '_gutenberg_mask_openai_api_key',
'sanitize' => '_gutenberg_sanitize_openai_api_key',
),
'connectors_anthropic_api_key' => array(
'connectors_ai_anthropic_api_key' => array(
'provider' => 'anthropic',
'mask' => '_gutenberg_mask_anthropic_api_key',
'sanitize' => '_gutenberg_sanitize_anthropic_api_key',
Expand Down
6 changes: 3 additions & 3 deletions routes/connectors-home/default-connectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function OpenAIConnector( props: ConnectorRenderProps ) {
<ProviderConnector
{ ...props }
pluginSlug="ai-provider-for-openai"
settingName="connectors_openai_api_key"
settingName="connectors_ai_openai_api_key"
helpUrl="https://platform.openai.com"
helpLabel="platform.openai.com"
Logo={ OpenAILogo }
Expand All @@ -129,7 +129,7 @@ function ClaudeConnector( props: ConnectorRenderProps ) {
<ProviderConnector
{ ...props }
pluginSlug="ai-provider-for-anthropic"
settingName="connectors_anthropic_api_key"
settingName="connectors_ai_anthropic_api_key"
helpUrl="https://console.anthropic.com"
helpLabel="console.anthropic.com"
Logo={ ClaudeLogo }
Expand All @@ -143,7 +143,7 @@ function GeminiConnector( props: ConnectorRenderProps ) {
<ProviderConnector
{ ...props }
pluginSlug="ai-provider-for-google"
settingName="connectors_gemini_api_key"
settingName="connectors_ai_google_api_key"
helpUrl="https://aistudio.google.com"
helpLabel="aistudio.google.com"
Logo={ GeminiLogo }
Expand Down
Loading