Files
GMW/services/discord-gateway/tests/visionNoImageSeen.test.ts
T
asepharyana ffbe9959ab chore: migrate AI LLM router from 9router to omniroute
Switch GMW's AI LLM base URL from 9router (https://9router.asepharyana.my.id/v1)
to omniroute on imrnes (http://100.121.180.82:20128/api/v1).

- Update default AI_LLM_BASE_URL in discord-gateway + backend config schemas
- Update .env.example documentation
- Update all 9router references in comments/docs/tests to omniroute
- Production BWS secret gmw_ai_llm_base_url already updated

Omniroute uses /api/v1 prefix (not /v1 like 9router), so the base URL
now correctly points at the right API path for the OpenAI SDK.
2026-08-28 20:18:48 +07:00

53 lines
2.5 KiB
TypeScript

// ═══════════════════════════════════════════════════════════════════════════
// isNoImageSeenText — vision outputs that claim "no image" must not be cached
// ═══════════════════════════════════════════════════════════════════════════
// Regression (2026-08-11): the vision model sometimes answered "Maaf, saya
// tidak melihat gambar apapun yang terlampir..." and that text was cached as
// a VALID vision_llm result. Every later analysis of the same image (same
// hash / phash) then hit the poisoned cache and the moderation LLM wrote
// "lampiran yang gagal terbaca" — image analysis seemed permanently broken
// even though omniroute was responding fine.
import { describe, expect, it } from "vitest";
import { isNoImageSeenText } from "../src/modules/ai-moderation/visionAnalyzer.js";
describe("isNoImageSeenText — poisoned vision output detection", () => {
it("detects the exact poisoned strings seen in production", () => {
expect(
isNoImageSeenText(
"Maaf, saya tidak melihat gambar apapun yang terlampir dalam pesan Anda. Mohon kirimkan ulang gambarnya agar saya bisa mendeskripsikannya secara objektif dan spesifik.",
),
).toBe(true);
expect(
isNoImageSeenText(
"Tidak ada gambar yang terlampir. Tidak bisa deskripsi tanpa input visual.",
),
).toBe(true);
});
it("detects English variants", () => {
expect(isNoImageSeenText("I cannot see any image in this message")).toBe(
true,
);
expect(isNoImageSeenText("No image provided")).toBe(true);
expect(isNoImageSeenText("there is no image attached")).toBe(true);
expect(isNoImageSeenText("I don't see an image")).toBe(true);
});
it("does NOT flag legitimate image descriptions", () => {
expect(
isNoImageSeenText(
"Gambar ini menampilkan dua panel komik, seorang gadis berambut biru tersipu saat dipuji.",
),
).toBe(false);
expect(
isNoImageSeenText("Ini adalah screenshot dari sebuah website rekrutmen."),
).toBe(false);
expect(isNoImageSeenText("Emoji menampilkan ekspresi wajah tertawa.")).toBe(
false,
);
expect(isNoImageSeenText(null)).toBe(false);
expect(isNoImageSeenText(undefined)).toBe(false);
expect(isNoImageSeenText("")).toBe(false);
});
});