@@ -457,16 +457,21 @@ private function default_content() {
457
457
* @return string
458
458
*/
459
459
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.
464
461
if ( ! class_exists ( '\Feedzy_Rss_Feeds_Pro_Openai ' ) ) {
465
- return $ content ;
462
+ return $ this -> current_job -> data -> ChatGPT ;
466
463
}
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 ;
470
475
}
471
476
472
477
/**
0 commit comments