perf(ai-moderation): dual-key write-back — clean verdict ikut di-cache global
Analisis pertama tetap berkonteks (chat history) demi akurasi, tapi verdict clean non-actionable (conf>=0.85) juga ditulis di bare key tanpa konteks. Repeat teks sama di channel lain -> exact cache HIT, bukan LLM call baru. Guard sama dgn read path; dedupe LRU per proses; bare row tanpa embedding (tier semantic sudah global).
This commit is contained in:
@@ -157,4 +157,13 @@ describe("isGloballyReusableCleanVerdict", () => {
|
||||
it("skips the age check when analyzedAt is unknown", () => {
|
||||
expect(isGloballyReusableCleanVerdict(makeVerdict(), undefined)).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects non-standard statuses such as processing write-backs", () => {
|
||||
expect(
|
||||
isGloballyReusableCleanVerdict(
|
||||
{ ...makeVerdict(), status: "processing" },
|
||||
undefined,
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user