Skip to content

Commit

Permalink
add second parameter to init'ed objects
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Oct 24, 2023
1 parent 8ded044 commit 568e388
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions includes/Classifai/Providers/OpenAI/ChatGPT.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ public function generate_excerpt( int $post_id = 0, array $args = [] ) {

$excerpt_length = absint( $settings['length'] ?? 55 );

$request = new APIRequest( $settings['api_key'] ?? '' );
$request = new APIRequest( $settings['api_key'] ?? '', $this->get_option_name() );

$excerpt_prompt = ! empty( $settings['generate_excerpt_prompt'] ) ? esc_textarea( $settings['generate_excerpt_prompt'] ) : $this->generate_excerpt_prompt;

Expand Down Expand Up @@ -899,7 +899,7 @@ public function generate_titles( int $post_id = 0, array $args = [] ) {
return new WP_Error( 'not_enabled', esc_html__( 'Title generation is disabled or OpenAI authentication failed. Please check your settings.', 'classifai' ) );
}

$request = new APIRequest( $settings['api_key'] ?? '' );
$request = new APIRequest( $settings['api_key'] ?? '', $this->get_option_name() );

$prompt = ! empty( $settings['generate_title_prompt'] ) ? esc_textarea( $settings['generate_title_prompt'] ) : $this->generate_title_prompt;

Expand Down Expand Up @@ -998,7 +998,7 @@ public function resize_content( int $post_id, array $args = array() ) {
]
);

$request = new APIRequest( $settings['api_key'] ?? '' );
$request = new APIRequest( $settings['api_key'] ?? '', $this->get_option_name() );

if ( 'shrink' === $args['resize_type'] ) {
$prompt = ! empty( $settings['shrink_content_prompt'] ) ? esc_textarea( $settings['shrink_content_prompt'] ) : $this->shrink_content_prompt;
Expand Down
2 changes: 1 addition & 1 deletion includes/Classifai/Providers/OpenAI/DallE.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ public function generate_image_callback( string $prompt = '', array $args = [] )
return new WP_Error( 'invalid_param', esc_html__( 'Your image prompt is too long. Please ensure it doesn\'t exceed 1000 characters.', 'classifai' ) );
}

$request = new APIRequest( $settings['api_key'] ?? '' );
$request = new APIRequest( $settings['api_key'] ?? '', 'generate-image' );

/**
* Filter the request body before sending to DALL·E.
Expand Down
2 changes: 1 addition & 1 deletion includes/Classifai/Providers/OpenAI/Embeddings.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public function generate_embeddings( int $id = 0, $type = 'post' ) {
return false;
}

$request = new APIRequest( $settings['api_key'] ?? '' );
$request = new APIRequest( $settings['api_key'] ?? '', $this->get_option_name() );

/**
* Filter the request body before sending to OpenAI.
Expand Down
2 changes: 1 addition & 1 deletion includes/Classifai/Providers/OpenAI/Whisper/Transcribe.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function process() {
return new WP_Error( 'process_error', esc_html__( 'Attachment does not meet processing requirements. Ensure the file type and size meet requirements.', 'classifai' ) );
}

$request = new APIRequest( $this->settings['api_key'] ?? '' );
$request = new APIRequest( $this->settings['api_key'] ?? '', 'whisper' );

/**
* Filter the request body before sending to Whisper.
Expand Down

0 comments on commit 568e388

Please sign in to comment.