File size: 574 Bytes
e1d1b36 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | console.log("CleanOwl content script loaded");
async function run() {
try {
const text = document.body.innerText.slice(0, 2000);
const res = await fetch("http://127.0.0.1:8000/detect", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({ text })
});
const data = await res.json();
console.log("CleanOwl result:", data);
alert(`CleanOwl: ${data.label}`);
} catch (err) {
console.error("CleanOwl error:", err);
alert("CleanOwl error,請看 Console");
}
}
run(); |