Skip to content

Commit 8e94ddc

Browse files
author
Fatih Dinc
committed
fix: Injection-Attempt + Superlativ-Hype tags, combo penalty extended
1 parent 4519a15 commit 8e94ddc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

netlify/functions/validate/index.mts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ function tags(claim: string): string[] {
3434
const t: string[] = [], l = claim.toLowerCase();
3535
if (/never|always|100%|guaranteed/.test(l)) t.push("Absolut-Language");
3636
if (/shocking|breaking|revealed|exposed|alert|never told|hidden truth/.test(l)) t.push("Sensationalism");
37+
if (/ignore.{0,20}instruction|return.{0,20}wise_score|system prompt|jailbreak/.test(l)) t.push("Injection-Attempt");
38+
if (/^\s*[{[]/.test(claim.trim())) t.push("Injection-Attempt");
39+
if (/most important.{0,20}history|greatest.{0,20}ever|change.{0,20}everything forever/.test(l)) t.push("Superlativ-Hype");
3740
if (/conspiracy|hoax|cover.?up/.test(l)) t.push("Conspiracy");
3841
if (/fear|danger|crisis|emergency/.test(l)) t.push("Fear-Language");
3942
if (/10x|100x|moon|rocket/.test(l)) t.push("Hype");
@@ -56,7 +59,7 @@ export default async (req: Request, _ctx: Context) => {
5659
const pen = AMP[amplification.toLowerCase()] ?? 1.0;
5760
const sg = tags(claim); const tp = 1 - sg.length * 0.06;
5861
const sc = sCon(claim); const ps = psi(claim);
59-
const comboFactor = ((sg.includes("Conspiracy") || sg.includes("Absolut-Language")) && sg.includes("Sensationalism")) ? 0.12 : 1.0;
62+
const comboFactor = (sg.includes("Injection-Attempt") || ((sg.includes("Conspiracy") || sg.includes("Absolut-Language")) && sg.includes("Sensationalism"))) ? 0.12 : 1.0;
6063
const t = Math.max(0.1, bt*pen*tp*comboFactor), c = Math.max(0.1, bc*(0.5+sc*0.5)*comboFactor);
6164
const r = Math.max(0.1, br*ps), e = Math.max(0.1, be*pen*comboFactor);
6265
const ws = t*c*r*e;

0 commit comments

Comments
 (0)