Skip to content

Commit 23c71bb

Browse files
Remove prompt content text
1 parent 4a46f97 commit 23c71bb

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

includes/admin/feedzy-rss-feeds-actions.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -457,16 +457,21 @@ private function default_content() {
457457
* @return string
458458
*/
459459
private function chat_gpt_rewrite() {
460-
$content = call_user_func( array( $this, $this->current_job->tag ) );
461-
$content = wp_strip_all_tags( $content );
462-
$content = substr( $content, 0, apply_filters( 'feedzy_chat_gpt_content_limit', 3000 ) );
463-
$content = str_replace( array( '{content}' ), array( $content ), $this->current_job->data->ChatGPT );
460+
// Return prompt content if openAI class does not exist.
464461
if ( ! class_exists( '\Feedzy_Rss_Feeds_Pro_Openai' ) ) {
465-
return $content;
462+
return $this->current_job->data->ChatGPT;
466463
}
467-
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
468-
$content = $openai->call_api( $this->settings, $content, '', array() );
469-
return $content;
464+
465+
$content = call_user_func( array( $this, $this->current_job->tag ) );
466+
$content = wp_strip_all_tags( $content );
467+
$content = substr( $content, 0, apply_filters( 'feedzy_chat_gpt_content_limit', 3000 ) );
468+
$prompt_content = $this->current_job->data->ChatGPT;
469+
$content = str_replace( array( '{content}' ), array( $content ), $prompt_content );
470+
$openai = new \Feedzy_Rss_Feeds_Pro_Openai();
471+
$rewrite_content = $openai->call_api( $this->settings, $content, '', array() );
472+
// Replace prompt content string for specific cases.
473+
$rewrite_content = str_replace( explode( '{content}', $prompt_content ), '', $rewrite_content );
474+
return $rewrite_content;
470475
}
471476

472477
/**

0 commit comments

Comments
 (0)