Step 1: API Key lena
Pehle, aapko ek AI content detection API ki zaroorat padegi. OpenAI jaise providers se API key le sakte hain. Yahan main ek generic example dunga.
Step 2: Basic HTML aur JavaScript Script likhna
Niche diya gaya code ek basic example hai jo ek text input le kar uski AI content detection karega.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI Content Detection Tool</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #f0f0f0;
margin: 0;
}
.container {
text-align: center;
background: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
textarea, button {
padding: 10px;
margin: 10px 0;
border-radius: 4px;
border: 1px solid #ccc;
width: 100%;
box-sizing: border-box;
}
button {
background-color: #007bff;
color: white;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="container">
<h1>AI Content Detection Tool</h1>
<textarea id="content" rows="10" placeholder="Paste your content here..."></textarea>
<button onclick="detectAIContent()">Detect AI Content</button>
<div id="result"></div>
</div>
<script>
async function detectAIContent() {
const apiKey = 'YOUR_API_KEY_HERE'; // Replace with your actual API key
const content = document.getElementById('content').value;
const resultDiv = document.getElementById('result');
if (!content) {
resultDiv.innerHTML = 'Please enter some content';
return;
}
const apiUrl = 'https://api.example.com/detect-ai-content'; // Replace with actual API URL
resultDiv.innerHTML = 'Detecting...';
try {
const response = await fetch(apiUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({ text: content })
});
const data = await response.json();
if (data.error) {
resultDiv.innerHTML = `Error: ${data.error.message}`;
return;
}
const isAIContent = data.isAIContent;
resultDiv.innerHTML = `<p>AI Content Detected: ${isAIContent ? 'Yes' : 'No'}</p>`;
} catch (error) {
resultDiv.innerHTML = `Error: ${error.message}`;
}
}
</script>
</body>
</html>
Step 3: API Key ko Replace karna
Script me const apiKey = 'YOUR_API_KEY_HERE';
line me YOUR_API_KEY_HERE
ko apni asli API key se replace karein.
Step 4: API URL ko Update karna
Script me const apiUrl = 'https://api.example.com/detect-ai-content';
line me https://api.example.com/detect-ai-content
ko apni API provider ke actual endpoint URL se replace karein.
Step 5: Script ko Apne WordPress Website me Use karna
Is script ko apni WordPress website me use karne ke liye aap niche diye steps follow karein:
- Appearance > Customize > Additional CSS section me jaake CSS code paste karein.
- Appearance > Theme Editor me jaake Theme Header (header.php) ya Theme Footer (footer.php) me HTML aur JavaScript code ko paste karein.
Aap alternatively ek plugin ka bhi use kar sakte hain jaise ki Insert Headers and Footers plugin aur wahan par HTML aur JavaScript code ko add kar sakte hain.
Is tarah aap apne WordPress website par easily AI content detection functionality add kar sakte hain. Agar aapko kisi bhi step me dikkat ho, to zaroor batayein.