Changeset 12624 for sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php
- Timestamp:
- 06/06/2023 09:10:32 AM (23 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/gp-translation-helpers/includes/class-gp-translation-helpers.php
r12435 r12624 435 435 ) 436 436 ); 437 } 438 439 /** 440 * Is called from the AJAX request in reject-feedback.js to use ChatGPT to review a translation. 441 * 442 * @since 0.0.2 443 * 444 * @return void 445 */ 446 public static function fetch_openai_review() { 447 check_ajax_referer( 'gp_comment_feedback', 'nonce' ); 448 $translation_id = sanitize_text_field( $_POST['data']['translation_id'] ); 449 $locale_slug = sanitize_text_field( $_POST['data']['locale_slug'] ); 450 $glossary_query = sanitize_text_field( $_POST['data']['glossary_query'] ); 451 $is_retry = filter_var( $_POST['data']['is_retry'], FILTER_VALIDATE_BOOLEAN ); 452 453 $translation = GP::$translation->get( $translation_id ); 454 $original = GP::$original->get( $translation->original_id ); 455 456 $openai_response = GP_OpenAI_Review::get_openai_review( $original->singular, $translation->translation_0, $locale_slug, $glossary_query, $is_retry ); 457 458 wp_send_json_success( $openai_response['openai'] ); 437 459 } 438 460
Note: See TracChangeset
for help on using the changeset viewer.