| @@ -1,171 +1,168 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | - namespace WPDeveloper\BetterDocs\Core; | |
| 3 | +namespace WPDeveloper\BetterDocs\Core; | |
| 4 | 4 | |
| 5 | - use WPDeveloper\BetterDocs\Utils\Base; | |
| 6 | - use WPDeveloper\BetterDocs\Core\Settings; | |
| 7 | - use WPDeveloper\BetterDocs\Core\PostType; | |
| 5 | +use WPDeveloper\BetterDocs\Utils\Base; | |
| 6 | +use WPDeveloper\BetterDocs\Core\Settings; | |
| 7 | +use WPDeveloper\BetterDocs\Core\PostType; | |
| 8 | 8 | |
| 9 | - use WPDeveloper\BetterDocs\Utils\Helper; | |
| 9 | +use WPDeveloper\BetterDocs\Utils\Helper; | |
| 10 | 10 | |
| 11 | - class WriteWithAI extends Base { | |
| 11 | +class WriteWithAI extends Base { | |
| 12 | 12 | |
| 13 | - public $settings; | |
| 13 | + public $settings; | |
| 14 | 14 | |
| 15 | - public function __construct( Settings $settings ) { | |
| 16 | - $this->settings = $settings; | |
| 15 | + public function __construct( Settings $settings ) { | |
| 16 | + $this->settings = $settings; | |
| 17 | + // Get the post ID from the URL | |
| 18 | + $post_id = isset($_GET['post']) ? intval($_GET['post']) : 0; // phpcs:ignore | |
| 17 | 19 | |
| 18 | - if ( ! empty( $this->isEnabledWriteWithAI() ) ) { | |
| 19 | - add_action( 'current_screen', array( $this, 'maybe_register_ai_autowrite_button' ) ); | |
| 20 | - } | |
| 21 | - add_action( 'wp_ajax_generate_openai_content', array( $this, 'generate_openai_content_callback' ) ); | |
| 22 | - } | |
| 20 | + if (!empty($_GET['post_type'])) { // phpcs:ignore | |
| 21 | + $post_type = $_GET['post_type']; // phpcs:ignore | |
| 22 | + } elseif ( $post_id > 0 ) { | |
| 23 | + $post_type = get_post_type( $post_id ); | |
| 24 | + } else { | |
| 25 | + $post_type = ''; | |
| 26 | + } | |
| 23 | 27 | |
| 24 | - public function maybe_register_ai_autowrite_button() { | |
| 25 | - if ( ! current_user_can( 'edit_posts' ) ) { | |
| 26 | - return; | |
| 27 | - } | |
| 28 | + if ( ! empty( $this->isEnabledWriteWithAI() ) && $post_type == 'docs' ) { | |
| 29 | + add_action( 'admin_footer', [ $this, 'ai_autowrite_button' ] ); | |
| 30 | + } | |
| 31 | + add_action( 'wp_ajax_generate_openai_content', [ $this, 'generate_openai_content_callback' ] ); | |
| 32 | + } | |
| 28 | 33 | |
| 29 | - $screen = get_current_screen(); | |
| 30 | - if ( $screen && 'docs' === $screen->post_type && 'post' === $screen->base ) { | |
| 31 | - add_action( 'admin_footer', array( $this, 'ai_autowrite_button' ) ); | |
| 32 | - } | |
| 33 | - } | |
| 34 | + public function isEnabledWriteWithAI() { | |
| 35 | + $isEnableAutoWrite = $this->settings->get( 'enable_write_with_ai', true ); | |
| 36 | + return $isEnableAutoWrite; | |
| 37 | + } | |
| 34 | 38 | |
| 35 | - public function isEnabledWriteWithAI() { | |
| 36 | - $isEnableAutoWrite = $this->settings->get( 'enable_write_with_ai', true ); | |
| 37 | - return $isEnableAutoWrite; | |
| 38 | - } | |
| 39 | + public function isValidAPIKey( $apiKey ) { | |
| 40 | + if ( empty( $apiKey ) ) { | |
| 41 | + $api_response['valid'] = false; | |
| 42 | + $api_response['message'] = 'Please Insert your <a href="/admin.php?page=betterdocs-settings">OpenAI API Key</a> to use this Write with AI feature.'; | |
| 39 | 43 | |
| 40 | - public function isValidAPIKey( $apiKey ) { | |
| 41 | - if ( empty( $apiKey ) ) { | |
| 42 | - $api_response[ 'valid' ] = false; | |
| 43 | - $api_response[ 'message' ] = 'Please Insert your <a href="/admin.php?page=betterdocs-settings">OpenAI API Key</a> to use this Write with AI feature.'; | |
| 44 | + return $api_response; | |
| 45 | + } | |
| 44 | 46 | |
| 45 | - return $api_response; | |
| 46 | - } | |
| 47 | + $ch = curl_init( 'https://api.openai.com/v1/engines' ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_init | |
| 48 | + curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_setopt | |
| 49 | + curl_setopt( | |
| 50 | + $ch, | |
| 51 | + CURLOPT_HTTPHEADER, | |
| 52 | + [ //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_setopt | |
| 53 | + 'Content-Type: application/json', | |
| 54 | + 'Authorization: Bearer ' . $apiKey, | |
| 55 | + ] | |
| 56 | + ); | |
| 47 | 57 | |
| 48 | - $ch = curl_init( 'https://api.openai.com/v1/engines' ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_init | |
| 49 | - curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_setopt | |
| 50 | - curl_setopt( | |
| 51 | - $ch, | |
| 52 | - CURLOPT_HTTPHEADER, | |
| 53 | - array( //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_setopt | |
| 54 | - 'Content-Type: application/json', | |
| 55 | - 'Authorization: Bearer ' . $apiKey | |
| 56 | - ) | |
| 57 | - ); | |
| 58 | + $api_response = []; | |
| 58 | 59 | |
| 59 | - $api_response = array(); | |
| 60 | + $response = curl_exec( $ch ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_exec | |
| 61 | + $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_getinfo | |
| 60 | 62 | |
| 61 | - $response = curl_exec( $ch ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_exec | |
| 62 | - $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_getinfo | |
| 63 | + curl_close( $ch ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_close | |
| 63 | 64 | |
| 64 | - curl_close( $ch ); //phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_close | |
| 65 | + if ( $httpCode == 200 ) { | |
| 66 | + $api_response['valid'] = true; | |
| 67 | + $api_response['message'] = 'Valid API Key'; | |
| 68 | + } else { | |
| 69 | + $responseData = json_decode( $response, true ); | |
| 70 | + // Access the message data (replace 'data' with the actual key used in the response) | |
| 71 | + $messageData = $responseData['error'] ? $responseData['error'] : ''; | |
| 72 | + $api_response['valid'] = false; | |
| 73 | + $api_response['message'] = $messageData['message'] ? $messageData['message'] : 'Invalid API Key'; | |
| 74 | + } | |
| 65 | 75 | |
| 66 | - if ( 200 == $httpCode ) { | |
| 67 | - $api_response[ 'valid' ] = true; | |
| 68 | - $api_response[ 'message' ] = 'Valid API Key'; | |
| 69 | - } else { | |
| 70 | - $responseData = json_decode( $response, true ); | |
| 71 | - // Access the message data (replace 'data' with the actual key used in the response) | |
| 72 | - $messageData = $responseData[ 'error' ] ? $responseData[ 'error' ] : ''; | |
| 73 | - $api_response[ 'valid' ] = false; | |
| 74 | - $api_response[ 'message' ] = $messageData[ 'message' ] ? $messageData[ 'message' ] : 'Invalid API Key'; | |
| 75 | - } | |
| 76 | + // print_r($response); | |
| 76 | 77 | |
| 77 | - // print_r($response); | |
| 78 | + return $api_response; | |
| 79 | + } | |
| 78 | 80 | |
| 79 | - return $api_response; | |
| 80 | - } | |
| 81 | + public function get_api_key() { | |
| 82 | + $api_key = $this->settings->get( 'ai_autowrite_api_key', '' ); | |
| 83 | + return $api_key; | |
| 84 | + } | |
| 81 | 85 | |
| 82 | - public function get_api_key() { | |
| 83 | - $api_key = $this->settings->get( 'ai_autowrite_api_key', '' ); | |
| 84 | - return $api_key; | |
| 85 | - } | |
| 86 | 86 | |
| 87 | - public function generate_openai_response( $prompt, $keywords ) { | |
| 88 | - try { | |
| 89 | - $api_key = $this->settings->get( 'ai_autowrite_api_key', '' ); | |
| 90 | - $max_tokens = $this->settings->get( 'ai_autowrite_max_token', 1500 ); | |
| 91 | - $model = $this->settings->get( 'write_with_ai_model', 'gpt-4o-mini' ); | |
| 87 | + public function generate_openai_response( $prompt, $keywords ) { | |
| 88 | + try { | |
| 89 | + $api_key = $this->settings->get( 'ai_autowrite_api_key', '' ); | |
| 90 | + $max_tokens = $this->settings->get( 'ai_autowrite_max_token', 1500 ); | |
| 92 | 91 | |
| 93 | - $api_endpoint = 'https://api.openai.com/v1/chat/completions'; // Update the endpoint based on OpenAI API version | |
| 92 | + $api_endpoint = 'https://api.openai.com/v1/chat/completions'; // Update the endpoint based on OpenAI API version | |
| 94 | 93 | |
| 95 | - $request_options = array( | |
| 96 | - 'headers' => array( | |
| 97 | - 'Content-Type' => 'application/json', | |
| 98 | - 'Authorization' => 'Bearer ' . $api_key | |
| 99 | - ), | |
| 100 | - 'body' => json_encode( | |
| 101 | - array( | |
| 102 | - 'model' => $model, | |
| 103 | - 'messages' => array( | |
| 104 | - array( | |
| 105 | - 'role' => 'system', | |
| 106 | - 'content' => 'You are a Senior Technical Writer specializing in comprehensive, high-quality documentation. Your goal is to write documentation that scores 100/100 on clarity, completeness, and structure.' | |
| 107 | - ), | |
| 108 | - array( | |
| 109 | - 'role' => 'user', | |
| 110 | - 'content' => $prompt | |
| 111 | - ) | |
| 112 | - ), | |
| 113 | - 'max_tokens' => $max_tokens | |
| 114 | - ) | |
| 115 | - ), | |
| 116 | - 'timeout' => 50 | |
| 117 | - ); | |
| 94 | + $request_options = array( | |
| 95 | + 'headers' => array( | |
| 96 | + 'Content-Type' => 'application/json', | |
| 97 | + 'Authorization' => 'Bearer ' . $api_key, | |
| 98 | + ), | |
| 99 | + 'body' => json_encode( | |
| 100 | + array( //phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode | |
| 101 | + 'model' => 'gpt-4o-mini', // Add the model parameter here | |
| 102 | + 'messages' => array( | |
| 103 | + array( | |
| 104 | + 'role' => 'system', | |
| 105 | + 'content' => 'You are a helpful assistant who writes documentation for users.' | |
| 106 | + ), | |
| 107 | + array( | |
| 108 | + 'role' => 'user', | |
| 109 | + 'content' => $prompt | |
| 110 | + ), | |
| 111 | + ), | |
| 112 | + 'max_tokens' => $max_tokens, | |
| 118 | 113 | |
| 119 | - $response = wp_remote_post( $api_endpoint, $request_options ); | |
| 114 | + ) | |
| 115 | + ), | |
| 116 | + 'timeout' => 50, | |
| 117 | + ); | |
| 120 | 118 | |
| 121 | - if ( is_wp_error( $response ) ) { | |
| 122 | - return 'Error: ' . $response->get_error_message(); | |
| 123 | - } else { | |
| 124 | - $body = wp_remote_retrieve_body( $response ); | |
| 119 | + $response = wp_remote_post( $api_endpoint, $request_options ); | |
| 125 | 120 | |
| 126 | - $data = json_decode( $body, true ); | |
| 121 | + if ( is_wp_error( $response ) ) { | |
| 122 | + return 'Error: ' . $response->get_error_message(); | |
| 123 | + } else { | |
| 124 | + $body = wp_remote_retrieve_body( $response ); | |
| 127 | 125 | |
| 128 | - if ( ! empty( $data[ 'error' ] ) ) { | |
| 129 | - return $data[ 'error' ][ 'message' ]; | |
| 130 | - } | |
| 126 | + $data = json_decode( $body, true ); | |
| 131 | 127 | |
| 132 | - return $data[ 'choices' ][ 0 ][ 'message' ][ 'content' ]; // Update this line to get the assistant's message | |
| 133 | - } | |
| 134 | - } catch ( Exception $error ) { | |
| 135 | - return 'Error: ' . $error->getMessage(); | |
| 136 | - } | |
| 137 | - } | |
| 128 | + if ( ! empty( $data['error'] ) ) { | |
| 129 | + return $data['error']['message']; | |
| 130 | + } | |
| 138 | 131 | |
| 139 | - public function generate_openai_content_callback() { | |
| 140 | - if ( ! current_user_can( 'edit_posts' ) ) { | |
| 141 | - wp_send_json_error( 'Unauthorized' ); | |
| 142 | - wp_die(); | |
| 143 | - } | |
| 132 | + return $data['choices'][0]['message']['content']; // Update this line to get the assistant's message | |
| 133 | + } | |
| 134 | + } catch ( Exception $error ) { | |
| 135 | + return 'Error: ' . $error->getMessage(); | |
| 136 | + } | |
| 137 | + } | |
| 144 | 138 | |
| 145 | - // Verify the nonce | |
| 146 | - if ( ! isset( $_POST[ 'ai_nonce' ] ) || ! wp_verify_nonce( $_POST[ 'ai_nonce' ], 'generate_openai_content_nonce' ) ) { //phpcs:ignore | |
| 147 | - wp_send_json_error( 'Invalid nonce' ); | |
| 148 | - wp_die(); | |
| 149 | - } | |
| 150 | 139 | |
| 151 | - $prompt = sanitize_text_field( $_POST[ 'prompt' ] ); //phpcs:ignore | |
| 152 | - // $num_of_sections = sanitize_text_field($_POST['numOfSections']); | |
| 153 | - // $num_of_paragraphs = sanitize_text_field($_POST['numOfParagraphs']); | |
| 154 | - $keywords = sanitize_text_field( $_POST[ 'keywords' ] ); //phpcs:ignore | |
| 155 | 140 | |
| 156 | - $ai_instance = new WriteWithAI( $this->settings ); | |
| 141 | + public function generate_openai_content_callback() { | |
| 142 | + // Verify the nonce | |
| 143 | + if (!isset($_POST['ai_nonce']) || !wp_verify_nonce($_POST['ai_nonce'], 'generate_openai_content_nonce')) { //phpcs:ignore | |
| 144 | + wp_send_json_error( 'Invalid nonce' ); | |
| 145 | + wp_die(); | |
| 146 | + } | |
| 157 | 147 | |
| 158 | - $generated_content = $ai_instance->generate_openai_response( $prompt, $keywords ); | |
| 148 | + $prompt = sanitize_text_field($_POST['prompt']); //phpcs:ignore | |
| 149 | + // $num_of_sections = sanitize_text_field($_POST['numOfSections']); | |
| 150 | + // $num_of_paragraphs = sanitize_text_field($_POST['numOfParagraphs']); | |
| 151 | + $keywords = sanitize_text_field($_POST['keywords']); //phpcs:ignore | |
| 159 | 152 | |
| 160 | - // Send the generated content as the AJAX response | |
| 161 | - wp_send_json_success( $generated_content ); | |
| 162 | - wp_die(); | |
| 163 | - } | |
| 153 | + $ai_instance = new WriteWithAI( $this->settings ); | |
| 164 | 154 | |
| 165 | - public function ai_autowrite_button() { | |
| 155 | + $generated_content = $ai_instance->generate_openai_response( $prompt, $keywords ); | |
| 166 | 156 | |
| 167 | - ?> | |
| 157 | + // Send the generated content as the AJAX response | |
| 158 | + wp_send_json_success( $generated_content ); | |
| 159 | + wp_die(); | |
| 160 | + } | |
| 161 | + | |
| 162 | + public function ai_autowrite_button() { | |
| 163 | + | |
| 164 | + ?> | |
| 168 | 165 | <script> |
| 169 | 166 | var docsTitle; |
| 170 | 167 | |
| 171 | 168 | function responseMessage(message) { |
| @@ -231,8 +228,14 @@ | ||
| 231 | 228 | setTimeout(() => { |
| 232 | 229 | insertContentToEditor(title, response.data, isOverwrite, keywords); |
| 233 | 230 | docGenerateBtnTxt.innerHTML = reGenerateDocLabel; |
| 234 | 231 | jQuery('.generate-btn').removeAttr('disabled'); |
| 232 | + | |
| 233 | + // console.log(jQuery('.betterdocs-ai-autowrite-form-container').data('new-doc-page')); | |
| 234 | + | |
| 235 | + // if(jQuery('.betterdocs-ai-autowrite-form-container')?.data('new-doc-page')) { | |
| 236 | + // docGenerateBtnTxt.innerHTML = reGenerateDocLabel; | |
| 237 | + // } | |
| 235 | 238 | }, 2000); |
| 236 | 239 | } else { |
| 237 | 240 | // alert(response.data.message); |
| 238 | 241 | jQuery('#betterdocs-ai-error-message').parent().removeClass('hidden'); |
| @@ -317,8 +320,9 @@ | ||
| 317 | 320 | var match = htmlString.match(/<body[^>]*>([\s\S]*?)<\/body>/i); |
| 318 | 321 | |
| 319 | 322 | // Check if match is null before accessing match[1] |
| 320 | 323 | if (match) { |
| 324 | + console.log(match[1].replace(/<p>\s+/g, '<p>')); | |
| 321 | 325 | return match[1].replace(/<p>\s+/g, '<p>'); |
| 322 | 326 | } else { |
| 323 | 327 | return ''; |
| 324 | 328 | } |
| @@ -335,9 +339,9 @@ | ||
| 335 | 339 | |
| 336 | 340 | htmlContent = getBodyContent(htmlContent); |
| 337 | 341 | htmlContent = removeFirstHeading(htmlContent); |
| 338 | 342 | htmlContent = wrapwithHeighlight(htmlContent, keywords); |
| 339 | - const isPostContent = `<?php echo isset( $_GET[ 'post' ] ) ? esc_html( get_the_content( $_GET[ 'post' ] ) ) : ''; // phpcs:ignore ?>`; | |
| 343 | + const isPostContent = `<?php echo isset($_GET['post']) ? esc_html(get_the_content($_GET['post'])) : ''; // phpcs:ignore ?>`; | |
| 340 | 344 | |
| 341 | 345 | const blocks = wp.blocks.rawHandler({ |
| 342 | 346 | HTML: htmlContent |
| 343 | 347 | }); |
| @@ -409,14 +413,14 @@ | ||
| 409 | 413 | |
| 410 | 414 | |
| 411 | 415 | function writeWithAIForm() { |
| 412 | 416 | |
| 413 | - let title = `<?php echo isset( $_GET[ 'post' ] ) ? esc_html( get_the_title( $_GET[ 'post' ] ) ) : ''; // phpcs:ignore ?>`; | |
| 417 | + let title = `<?php echo isset($_GET['post']) ? esc_html(get_the_title($_GET['post'])) : ''; // phpcs:ignore ?>`; | |
| 414 | 418 | if (docsTitle) { |
| 415 | 419 | title = docsTitle; |
| 416 | 420 | } |
| 417 | 421 | |
| 418 | - const promtTitle = `<?php echo isset( $_GET[ 'post' ] ) ? esc_html( get_the_title( $_GET[ 'post' ] ) ) : '{Documentation Title}'; // phpcs:ignore ?>`; | |
| 422 | + const promtTitle = `<?php echo isset($_GET['post']) ? esc_html(get_the_title($_GET['post'])) : '{Documentation Title}'; // phpcs:ignore ?>`; | |
| 419 | 423 | const titlePlaceholder = "<?php echo esc_attr__( 'Enter a descriptive title for your documentation.', 'betterdocs' ); ?>"; |
| 420 | 424 | const keywords = "<?php echo esc_attr( '{Documentation Keywords}' ); ?>"; |
| 421 | 425 | const keywordsPlaceholder = "<?php echo esc_attr__( 'Add keywords to generate precise & relevant documentation (comma-separated).', 'betterdocs' ); ?>"; |
| 422 | 426 | const language = "<?php echo esc_attr( 'English' ); ?>"; |
| @@ -431,18 +435,18 @@ | ||
| 431 | 435 | const checkboxLabel = "<?php echo esc_html__( 'Overwrite your existing Doc:', 'betterdocs' ); ?>"; |
| 432 | 436 | const nonce = "<?php echo esc_attr( wp_create_nonce( 'generate_openai_content_nonce' ) ); ?>"; |
| 433 | 437 | |
| 434 | 438 | <?php |
| 435 | - $is_valid = $this->get_api_key(); | |
| 436 | - $disable_field = 'disabled-input-field'; | |
| 437 | - if ( $this->get_api_key() ) { | |
| 438 | - $disable_field = ''; | |
| 439 | - } | |
| 440 | - ?> | |
| 439 | + $is_valid = $this->get_api_key(); | |
| 440 | + $disable_field = 'disabled-input-field'; | |
| 441 | + if ( $this->get_api_key() ) { | |
| 442 | + $disable_field = ''; | |
| 443 | + } | |
| 444 | + ?> | |
| 441 | 445 | |
| 442 | 446 | let hiddenClass = 'hidden'; |
| 443 | 447 | let newDocPageAtt = 'data-new-doc-page="true"'; |
| 444 | - const isPostContent = `<?php echo isset( $_GET[ 'post' ] ) ? esc_html( get_the_content( $_GET[ 'post' ] ) ) : ''; // phpcs:ignore ?>`; | |
| 448 | + const isPostContent = `<?php echo isset($_GET['post']) ? esc_html(get_the_content($_GET['post'])) : ''; // phpcs:ignore ?>`; | |
| 445 | 449 | |
| 446 | 450 | if (isPostContent !== '') { |
| 447 | 451 | hiddenClass = ''; |
| 448 | 452 | newDocPageAtt = ''; |
| @@ -491,14 +495,14 @@ | ||
| 491 | 495 | <div class="autowrite-subheadding"> |
| 492 | 496 | <p><?php echo esc_html__( 'Generate documentation effortlessly with BetterDocs AI. Simply input your doc title, keywords, prompt and let the system automatically generate comprehensive documentation tailored to your needs.', 'betterdocs' ); ?></p> |
| 493 | 497 | </div> |
| 494 | 498 | |
| 495 | - <?php if ( empty( $this->get_api_key() ) ): ?> | |
| 499 | + <?php if ( empty( $this->get_api_key() ) ) : ?> | |
| 496 | 500 | <div id="betterdocs-ai-message"> |
| 497 | 501 | <div class="warning-message"> |
| 498 | 502 | <span class="dashicons dashicons-warning"></span> |
| 499 | 503 | <div> |
| 500 | - <?php echo wp_kses_post( 'Please Insert your <a target="_blank" href="' . esc_url( admin_url( 'admin.php?page=betterdocs-settings&tab=tab-betterdocs-ai' ) ) . '">OpenAI API Key</a> to use this Write with AI feature.', 'betterdocs' ); ?> | |
| 504 | + <?php echo wp_kses_post( 'Please Insert your <a target="_blank" href="' . esc_url( admin_url( 'admin.php?page=betterdocs-settings&tab=tab-ai-autowrite' ) ) . '">OpenAI API Key</a> to use this Write with AI feature.', 'betterdocs' ); ?> | |
| 501 | 505 | </div> |
| 502 | 506 | </div> |
| 503 | 507 | |
| 504 | 508 | </div> |
| @@ -634,10 +638,8 @@ | ||
| 634 | 638 | } |
| 635 | 639 | |
| 636 | 640 | .betterdocs-ai-button-container { |
| 637 | 641 | margin-left: 10px; |
| 638 | - white-space: nowrap; | |
| 639 | - max-width: 145px; | |
| 640 | 642 | } |
| 641 | 643 | |
| 642 | 644 | .autowrite-icon { |
| 643 | 645 | display: flex; |
| @@ -707,9 +709,8 @@ | ||
| 707 | 709 | display: flex; |
| 708 | 710 | align-items: center; |
| 709 | 711 | justify-content: space-between; |
| 710 | 712 | gap: 10px; |
| 711 | - width: 135px; | |
| 712 | 713 | } |
| 713 | 714 | |
| 714 | 715 | .betterdocs-ai-button img { |
| 715 | 716 | width: 20px; |
| @@ -1014,18 +1015,20 @@ | ||
| 1014 | 1015 | font-size: 18px; |
| 1015 | 1016 | font-weight: bold; |
| 1016 | 1017 | float: right; |
| 1017 | 1018 | position: absolute; |
| 1018 | - top: -16px; | |
| 1019 | - border-radius: 50%; | |
| 1019 | + right: 1px; | |
| 1020 | + top: 1px; | |
| 1021 | + padding: 10px; | |
| 1020 | 1022 | background: #ffffff; |
| 1021 | - width: 40px; | |
| 1022 | - height: 40px; | |
| 1023 | + border-radius: 25px; | |
| 1024 | + width: 20px; | |
| 1025 | + height: 20px; | |
| 1023 | 1026 | display: flex; |
| 1024 | 1027 | align-items: center; |
| 1025 | 1028 | justify-content: center; |
| 1026 | 1029 | color: #281617; |
| 1027 | - right: -42px; | |
| 1030 | + right: -60px; | |
| 1028 | 1031 | } |
| 1029 | 1032 | |
| 1030 | 1033 | div#betterdocs-ai-error-message, |
| 1031 | 1034 | #betterdocs-ai-message { |
| @@ -1110,6 +1113,6 @@ | ||
| 1110 | 1113 | |
| 1111 | 1114 | } |
| 1112 | 1115 | </style> |
| 1113 | 1116 | <?php |
| 1114 | - } | |
| 1115 | - } | |
| 1117 | + } | |
| 1118 | +} | |