ChatGPT'ti ne kadar iyi kullanıyorsunuz?
15
●630
- 26-02-2024, 23:30:05Merhaba, wp plugin yazmak istiyorum. Plugin sunişi yapacak, chatgpt apiye bağlanıp verilen başlıkta makale yazdırıp wordprese siteye ekleyecek. Birlikte yazabilirmiyiz plugini lutfen
Sonuç fena değil gibi
<?php
/**
* Plugin Name: ChatGPT Article Writer
* Description: Connects to the ChatGPT API to generate articles based on a given title and adds them to the WordPress site.
* Version: 1.0
* Author: Your Name
*/
function chatgpt_generate_article($title) {
$api_key = 'YOUR_API_KEY';
$prompt = "Please write a detailed article about: " . $title;
$api_url = 'https://api.openai.com/v4/completions';
// API'ye istek yapma
$response = wp_remote_post($api_url, [
'body' => json_encode([
'model' => 'text-davinci-003', // Modeli güncelleyin
'prompt' => $prompt,
'temperature' => 0.7,
'max_tokens' => 2048,
]),
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $api_key,
],
]);
if (is_wp_error($response)) {
return;
}
$body = wp_remote_retrieve_body($response);
$data = json_decode($body, true);
$article_content = $data['choices'][0]['text'];
// WordPress'e makale ekleme
wp_insert_post([
'post_title' => $title,
'post_content' => $article_content,
'post_status' => 'publish',
'post_author' => 1, // Yazar ID'si
'post_category' => [2], // Kategori ID'si
]);
}
// Bu fonksiyonu tetiklemek için bir yol sağlamanız gerekecek, örneğin bir shortcode veya bir WP-Cron işi.
?> - 26-02-2024, 23:34:04Şuanda GPT 3.5 vasat durumda zorla GPT 4 aldırtmak için veya sistemleri hızlandırmak için böyle birşey yaptılar. Tek ben böyle düşünmüyormuşum.
https://www.r10.net/sorum-var/399435...post1086892590 - 27-02-2024, 00:03:28Teşekkürler hocam tekrar deneyeceğimNookta adlı üyeden alıntı: mesajı görüntüle
- 27-02-2024, 00:16:15kesinlikle zaten bazen yanlıs yapsada uyarınca düzeltiyor o yüzden chatgpt devamNookta adlı üyeden alıntı: mesajı görüntüle
- 27-02-2024, 00:48:19yukardaki kodu düzenledim basitçe . kullanmak isteyenler için

https://dosya.co/rdyadvkassxq/chatgp...er(1).zip.html
settings den api girilmesi lazım .
$prompt = "Write a detailed, informative article about " . $title;
$api_url = 'https://api.openai.com/v1/completions';
$response = wp_remote_post($api_url, [
'body' => json_encode([
'model' => 'gpt-3.5-turbo-instruct', // veya güncel bir model
'prompt' => $prompt,
'temperature' => 0.7,
'max_tokens' => 2048,
'top_p' => 1,
'frequency_penalty' => 0,
'presence_penalty' => 0,
]),
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $api_key,
],
'timeout' => 45, // İsteğin zaman aşımı süresi, saniye olarak.
]);


