Skip to content

Commit 6746722

Browse files
committed
fix: remove intrusive input injection and raise flagging threshold to 30.0
1 parent 7e05f4a commit 6746722

2 files changed

Lines changed: 5 additions & 30 deletions

File tree

extension/background.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ async function scanText(text, platform, endpoint) {
9696
};
9797
}
9898

99-
// Reprompt threshold: anything flagged, any hallucination, or low-to-medium risk
100-
if (riskScore > 0 || data.verdict === "flagged" || isHallucination) {
99+
// Reprompt threshold: only if risk is high enough to be "flagged" (>= 30 per backend)
100+
if (riskScore >= 30 || data.verdict === "flagged" || isHallucination) {
101101
return {
102102
action: "reprompt",
103103
reason: data.explanation || "Safety/Consistency concern detected",

extension/content.js

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -229,34 +229,9 @@ async function handleNewResponse(node) {
229229
setTimeout(() => statusBadge.remove(), 3000);
230230
} else if (response.action === "reprompt" || response.action === "flagged") {
231231
node.style.filter = "blur(4px)";
232-
node.title = "IntellectSafe: Auto-correcting response...";
233-
statusBadge.innerHTML = `<span style="color: #f59e0b">⚠️ Auto-correcting: ${response.reason?.substring(0, 30)}...</span>`;
234-
235-
const inputEl = document.querySelector(currentPlatform.input);
236-
if (inputEl) {
237-
// AI-driven re-prompt based on context
238-
let promptText = "";
239-
if (response.isHallucination) {
240-
promptText = `[IntellectSafe Correction] I noticed some potential factual inconsistencies or hallucinations in your last response regarding: "${response.reason}". Please re-verify your internal knowledge and provide a corrected, factually accurate version of that response.`;
241-
} else {
242-
promptText = `[IntellectSafe Safety Guard] Your previous response touched on sensitive areas (${response.reason}). Please reformulate your answer to be strictly safe, unbiased, and compliant with safety guidelines while maintaining helpfulness.`;
243-
}
244-
245-
if (inputEl.tagName === "TEXTAREA" || inputEl.tagName === "INPUT") {
246-
inputEl.value = promptText;
247-
} else {
248-
inputEl.innerText = promptText;
249-
}
250-
inputEl.dispatchEvent(new Event('input', { bubbles: true }));
251-
252-
// Auto-send the correction
253-
setTimeout(() => {
254-
const enterEvent = new KeyboardEvent("keydown", { key: "Enter", code: "Enter", bubbles: true, cancelable: true, shiftKey: false });
255-
inputEl.dispatchEvent(enterEvent);
256-
statusBadge.innerHTML = `<span style="color: #10b981">🔄 Correction sent</span>`;
257-
setTimeout(() => statusBadge.remove(), 3000);
258-
}, 500);
259-
}
232+
node.title = "IntellectSafe: Potential safety/accuracy concern detected.";
233+
statusBadge.innerHTML = `<span style="color: #f59e0b">⚠️ Safety Concern: ${response.reason?.substring(0, 50)}...</span>`;
234+
// Removed auto-injection into user input field as it was intrusive.
260235
} else if (response.action === "block") {
261236
// BLOCKED: apply blur/block
262237
node.style.filter = "blur(20px) opacity(0.05)";

0 commit comments

Comments
 (0)