From 82fc7ef0a49b7826b5765deb808de3ac5a84ec36 Mon Sep 17 00:00:00 2001 From: Alexander Myasoedov Date: Fri, 12 Jul 2024 15:21:39 +0300 Subject: [PATCH] feat(Improve UX): --- agentic_security/probe_data/__init__.py | 24 +-- agentic_security/static/index.html | 187 ++++++++++++++---------- pyproject.toml | 2 +- 3 files changed, 126 insertions(+), 87 deletions(-) diff --git a/agentic_security/probe_data/__init__.py b/agentic_security/probe_data/__init__.py index 700be74..d98cbaf 100644 --- a/agentic_security/probe_data/__init__.py +++ b/agentic_security/probe_data/__init__.py @@ -7,7 +7,7 @@ "tokens": 224196, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/ShawnMenz/DAN_jailbreak", }, @@ -17,7 +17,7 @@ "tokens": 6988, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/deepset/prompt-injections", }, @@ -27,7 +27,7 @@ "tokens": 26971, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/rubend18/ChatGPT-Jailbreak-Prompts", }, @@ -37,7 +37,7 @@ "tokens": 7172, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/notrichardren/refuse-to-answer-prompts", }, @@ -47,7 +47,7 @@ "tokens": 19758, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/Lemhf14/EasyJailbreak_Datasets", }, @@ -57,7 +57,7 @@ "tokens": 19758, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/markush1/LLM-Jailbreak-Classifier", }, @@ -77,7 +77,7 @@ "tokens": 1975800, "approx_cost": 0.0, "source": "Hugging Face Datasets", - "selected": True, + "selected": False, "dynamic": False, "url": "https://huggingface.co/ShawnMenz/jailbreak_sft_rm_ds", }, @@ -87,7 +87,7 @@ "tokens": 0, "approx_cost": 0.0, "source": "Local mutation dataset", - "selected": True, + "selected": False, "dynamic": True, "url": "", }, @@ -97,7 +97,7 @@ "tokens": 0, "approx_cost": 0.0, "source": "Local mutation dataset", - "selected": True, + "selected": False, "dynamic": True, "url": "", }, @@ -107,7 +107,7 @@ "tokens": 0, "approx_cost": 0.0, "source": "Local dataset", - "selected": True, + "selected": False, "dynamic": True, "url": "", }, @@ -117,7 +117,7 @@ "tokens": 0, "approx_cost": 0.0, "source": "Github", - "selected": True, + "selected": False, "dynamic": True, "url": "https://github.com/verazuo/jailbreak_llms", }, @@ -127,7 +127,7 @@ "tokens": 0, "approx_cost": 0.0, "source": "Github", - "selected": True, + "selected": False, "dynamic": True, "url": "https://github.com/verazuo/jailbreak_llms", }, diff --git a/agentic_security/static/index.html b/agentic_security/static/index.html index aeb4abc..8955a8a 100644 --- a/agentic_security/static/index.html +++ b/agentic_security/static/index.html @@ -143,89 +143,98 @@ v-model="modelSpec" @input="adjustHeight"> -
- - + +
+
+ +
+ + M + Tokens +
+
+ +
+ +
+ 1M + 25M + 50M + 75M + 100M +
+
-
-
-
- + + +
+ +
+
- - + +
+
-
-
-
- {{ package.dataset_name }} -
- - - -
-
- {{ package.source || 'Local dataset' }} -
-
- {{ package.num_prompts.toLocaleString() }} prompts -
-
- Dynamic dataset -
+ v-for="(package, index) in dataConfig" + :key="index" + @click="addPackage(index)" + class="border rounded-md p-3 cursor-pointer transition-all hover:shadow-md" + :class="{'border-indigo-500 bg-indigo-50': package.selected, 'border-gray-200': !package.selected}"> +
+ {{ package.dataset_name }} +
+
{{ package.source + || 'Local dataset' }}
+
+ {{ package.dynamic ? 'Dynamic dataset' : + `${package.num_prompts.toLocaleString()} prompts` }}
+
@@ -589,6 +599,35 @@ this.reportImageUrl = reader.result; }; }, + selectAllPackages() { + this.dataConfig.forEach(package => { + package.selected = true; + }); + this.updateSelectedDS(); + }, + + deselectAllPackages() { + this.dataConfig.forEach(package => { + package.selected = false; + }); + this.updateSelectedDS(); + }, + + updateSelectedDS() { + this.selectedDS = this.dataConfig.filter(package => package.selected).length; + }, + updateBudgetFromSlider(event) { + this.budget = parseInt(event.target.value); + }, + updateBudgetFromInput(event) { + let value = parseInt(event.target.value); + if (isNaN(value) || value < 1) { + value = 1; + } else if (value > 100) { + value = 100; + } + this.budget = value; + }, startScan: async function() { let payload = { maxBudget: this.budget, diff --git a/pyproject.toml b/pyproject.toml index 19a4f58..36d371f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "agentic_security" -version = "0.1.6" +version = "0.1.7g" description = "Agentic LLM vulnerability scanner" authors = ["Alexander Miasoiedov "] maintainers = ["Alexander Miasoiedov "]