Skip to content

Commit 02b652e

Browse files
Merge pull request #971 from Codeinwp/bugfix/pro/724
[Paraphrase with ChatGPT] Removed prompt content text
2 parents 495d9f7 + d16bc59 commit 02b652e

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.github/workflows/test-php.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
phpunit:
4040
name: PHPUnit
41-
runs-on: ubuntu-22.04
41+
runs-on: ubuntu-latest
4242
services:
4343
mysql:
4444
image: mysql:5.7

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

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

474479
/**

0 commit comments

Comments
 (0)