| 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(); |