Skip to content

Commit

Permalink
Larger configuration input boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
gsproston-scottlogic committed Aug 8, 2023
1 parent fcbf23a commit 80b96ba
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 10 deletions.
13 changes: 13 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-contenteditable": "^3.3.7",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-scripts": "5.0.1",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Attacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ATTACK_TYPES, AttackInfo } from "./models/attack";
const ATTACKS: AttackInfo[] = [
{
id: ATTACK_TYPES.JAILBREAK_PROMPT,
name: "jailbreak prompt",
info: "using prompt injection, get the chat bot in a state where it no longer follows its original instructions.",
name: "Jailbreak Prompt",
info: "Using prompt injection, get the chat bot in a state where it no longer follows its original instructions.",
},
];

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/Defences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const DEFENCE_DETAILS: DefenceInfo[] = [
DEFENCE_TYPES.CHARACTER_LIMIT,
"Character Limit",
"Limit the number of characters in the user input. This is a form of prompt validation.",
[new DefenceConfig("maxMessageLength", "max Message Length")]
[new DefenceConfig("maxMessageLength", "max message length")]
),
new DefenceInfo(
DEFENCE_TYPES.EMAIL_WHITELIST,
"Email Whitelist",
"Only allow emails to those on a whitelist. They can be full email addresses, or domains in the format '*@scottlogic.com'",
[new DefenceConfig("whitelist", "email Whitelist")]
[new DefenceConfig("whitelist", "email whitelist")]
),
new DefenceInfo(
DEFENCE_TYPES.RANDOM_SEQUENCE_ENCLOSURE,
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/components/DefenceBox/DefenceConfiguration.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.defence-config-value {
border-color: #444;
border-radius: 5px;
border-style: solid;
border-width: 1px;
font-size: 14px;
padding: 2px 4px;
margin: 4px 0px;
}
13 changes: 7 additions & 6 deletions frontend/src/components/DefenceBox/DefenceConfiguration.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import "./DefenceConfiguration.css";
import { DefenceConfig } from "../../models/defence";
import ContentEditable from "react-contenteditable";

function DefenceConfiguration(
this: any,
Expand All @@ -18,15 +20,14 @@ function DefenceConfiguration(

return (
<div>
<span className="defence-config-name">{config.name} </span>
<input
<span className="defence-config-name">{config.name}: </span>
<ContentEditable
className="defence-config-value"
type="text"
title="Press enter to save"
defaultValue={config.value}
html={config.value}
onKeyUp={setConfiguration.bind(this)}
onClick={(event) => event.stopPropagation()}
></input>
onChange={() => {}}
/>
</div>
);
}
Expand Down

0 comments on commit 80b96ba

Please sign in to comment.