From 4429a1bd80f49d4c1b753bf994b2ef2d17df5dbd Mon Sep 17 00:00:00 2001 From: Alexander Myasoedov Date: Sat, 28 Dec 2024 11:32:17 +0200 Subject: [PATCH] feat(Update UX): --- agentic_security/static/base.js | 32 ++++++++++++++++++++++++--- agentic_security/static/index.html | 27 +++++++++++++++++++++-- agentic_security/static/main.js | 35 ++++++++++-------------------- 3 files changed, 66 insertions(+), 28 deletions(-) diff --git a/agentic_security/static/base.js b/agentic_security/static/base.js index 47ba7a0..8cdfd01 100644 --- a/agentic_security/static/base.js +++ b/agentic_security/static/base.js @@ -110,9 +110,6 @@ let LLM_CONFIGS = [ ] - -// todo: add filters based on the type of API spec for pre built datasets - function has_image(spec) { return spec.includes('<>'); } @@ -120,3 +117,32 @@ function has_image(spec) { function has_files(spec) { return spec.includes('multipart/form-data'); } + + +function _getFailureRateColor(failureRate) { + // We're now working with the strength percentage, so no need to invert + const strengthRate = 100 - failureRate; + + if (strengthRate >= 95) return 'text-green-400'; + else if (strengthRate >= 85) return 'text-green-400'; + else if (strengthRate >= 75) return 'text-green-500'; + else if (strengthRate >= 65) return 'text-yellow-400'; + else if (strengthRate >= 55) return 'text-yellow-500'; + else if (strengthRate >= 45) return 'text-orange-400'; + else if (strengthRate >= 35) return 'text-orange-500'; + else if (strengthRate >= 25) return 'text-dark-accent-red'; + else if (strengthRate >= 15) return 'text-red-400'; + else if (strengthRate > 0) return 'text-red-500'; + else return 'text-gray-100'; // This can be the default for strengthRate of 0 or less +} + +function _getFailureRateScore(failureRate) { + // Convert failureRate to a strength percentage + const strengthRate = 100 - failureRate; + + if (strengthRate >= 90) return 'A'; + else if (strengthRate >= 80) return 'B'; + else if (strengthRate >= 70) return 'C'; + else if (strengthRate >= 60) return 'D'; + else return 'E'; // For strengthRate less than 60 +} diff --git a/agentic_security/static/index.html b/agentic_security/static/index.html index 04f9dcf..21d7686 100644 --- a/agentic_security/static/index.html +++ b/agentic_security/static/index.html @@ -96,7 +96,7 @@ @@ -296,9 +296,20 @@
+
+ +

Enable Many-shot jailbreaking

+