| @@ -541,8 +541,9 @@ | ||
| 541 | 541 | 'messages' => $messages, |
| 542 | 542 | 'stream' => true, |
| 543 | 543 | ] ); |
| 544 | 544 | |
| 545 | + // phpcs:disable WordPress.WP.AlternativeFunctions.curl_curl_init, WordPress.WP.AlternativeFunctions.curl_curl_setopt, WordPress.WP.AlternativeFunctions.curl_curl_exec, WordPress.WP.AlternativeFunctions.curl_curl_errno, WordPress.WP.AlternativeFunctions.curl_curl_error, WordPress.WP.AlternativeFunctions.curl_curl_close -- SSE streaming requires cURL write callback. | |
| 545 | 546 | $ch = curl_init( 'https://api.openai.com/v1/chat/completions' ); |
| 546 | 547 | curl_setopt( $ch, CURLOPT_POST, true ); |
| 547 | 548 | curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers ); |
| 548 | 549 | curl_setopt( $ch, CURLOPT_POSTFIELDS, $post_data ); |
| @@ -557,8 +558,9 @@ | ||
| 557 | 558 | echo 'data: [ERROR] ' . esc_html( curl_error( $ch ) ) . "\n\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- curl_error is already escaped above |
| 558 | 559 | flush(); |
| 559 | 560 | } |
| 560 | 561 | curl_close( $ch ); |
| 562 | + // phpcs:enable WordPress.WP.AlternativeFunctions.curl_curl_init, WordPress.WP.AlternativeFunctions.curl_curl_setopt, WordPress.WP.AlternativeFunctions.curl_curl_exec, WordPress.WP.AlternativeFunctions.curl_curl_errno, WordPress.WP.AlternativeFunctions.curl_curl_error, WordPress.WP.AlternativeFunctions.curl_curl_close | |
| 561 | 563 | do_action( 'qcld_openai_user_rate_cal', 1 ); |
| 562 | 564 | exit; |
| 563 | 565 | } |
| 564 | 566 | |
| @@ -892,8 +894,9 @@ | ||
| 892 | 894 | if( $ai_enabled == 1 ){ |
| 893 | 895 | update_option('qcld_openrouter_enabled',0); |
| 894 | 896 | update_option('qcld_grok_enabled',0); |
| 895 | 897 | update_option('qcld_gemini_enabled',0); |
| 898 | + update_option('qcld_claude_enabled',0); | |
| 896 | 899 | update_option('disable_wp_chatbot_site_search',1); |
| 897 | 900 | } |
| 898 | 901 | |
| 899 | 902 | update_option('qcld_openai_relevant_enabled',$is_relevant_enabled); |
| @@ -1342,9 +1345,9 @@ | ||
| 1342 | 1345 | if (isset($form['email'])) { |
| 1343 | 1346 | $email_enabled = $form['email'] == 1; |
| 1344 | 1347 | } |
| 1345 | 1348 | $per_action_emails = isset($form['email_addresses']) ? trim($form['email_addresses']) : ''; |
| 1346 | - error_log('[WPBot AI] Matched form: "' . $form['title'] . '" | email_addresses stored: "' . $per_action_emails . '"'); | |
| 1349 | + //error_log('[WPBot AI] Matched form: "' . $form['title'] . '" | email_addresses stored: "' . $per_action_emails . '"'); | |
| 1347 | 1350 | break; |
| 1348 | 1351 | } |
| 1349 | 1352 | } |
| 1350 | 1353 | } |
| @@ -1356,10 +1359,8 @@ | ||
| 1356 | 1359 | } else { |
| 1357 | 1360 | $default = get_option('qlcd_wp_chatbot_admin_email', ''); |
| 1358 | 1361 | $to = !empty($default) ? array_map('trim', explode(',', $default)) : get_option('admin_email'); |
| 1359 | 1362 | } |
| 1360 | - error_log('[WPBot AI] Sending email to: ' . print_r($to, true)); | |
| 1361 | - error_log('[WPBot AI] Reply-To email: ' . $reply_to); | |
| 1362 | 1363 | $subject = sanitize_text_field($data['form_title']) . " - " . esc_html__('New AI Chat Submission', 'chatbot'); |
| 1363 | 1364 | $headers = array('Content-Type: text/html; charset=UTF-8'); |
| 1364 | 1365 | if (!empty($reply_to)) { |
| 1365 | 1366 | $headers[] = 'Reply-To: ' . $reply_to; |