-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* migrate frontend to typescript (#60) * Removed DEFENCE_NAMES enum * Typing emails in ChatBox component * Removed references to OpenAI in the frontend * Moved defences about * DefenceInfo class * Models directory * Removed unused import --------- Co-authored-by: George Sproston <gsproston@scottlogic.com>
- Loading branch information
1 parent
437a79b
commit 004f57f
Showing
30 changed files
with
365 additions
and
283 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,8 @@ | |
"last 1 firefox version", | ||
"last 1 safari version" | ||
] | ||
}, | ||
"devDependencies": { | ||
"typescript": "^4.1.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { DEFENCE_TYPES, DefenceInfo } from "./models/defence"; | ||
|
||
const DEFENCE_DETAILS: DefenceInfo[] = [ | ||
new DefenceInfo( | ||
DEFENCE_TYPES.CHARACTER_LIMIT, | ||
"Character Limit", | ||
"Limit the number of characters in the user input. This is a form of prompt validation." | ||
), | ||
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 DefenceInfo( | ||
DEFENCE_TYPES.RANDOM_SEQUENCE_ENCLOSURE, | ||
"Random Sequence Enclosure", | ||
"Enclose the prompt between a random string and instruct bot to only follow enclosed instructions. This is a form of prompt validation." | ||
), | ||
new DefenceInfo( | ||
DEFENCE_TYPES.SYSTEM_ROLE, | ||
"System Role", | ||
"Tell the chat bot to follow a specific role." | ||
), | ||
new DefenceInfo( | ||
DEFENCE_TYPES.XML_TAGGING, | ||
"XML Tagging", | ||
"Enclose the users prompt between <user_input> tags and escapes xml characters in raw input. This is a form of prompt validation." | ||
), | ||
]; | ||
|
||
export { DEFENCE_DETAILS }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import "./ChatBoxFeed.css"; | ||
import { ChatMessage } from "../../models/chat"; | ||
import ChatBoxMessage from "./ChatBoxMessage"; | ||
|
||
function ChatBoxFeed({ messages }: { messages: ChatMessage[] }) { | ||
return ( | ||
<div id="chat-box-feed"> | ||
{[...messages].reverse().map((message, index) => { | ||
return <ChatBoxMessage key={index} message={message} />; | ||
})} | ||
</div> | ||
); | ||
} | ||
|
||
export default ChatBoxFeed; |
15 changes: 8 additions & 7 deletions
15
...src/components/ChatBox/ChatBoxMessage.jsx → ...src/components/ChatBox/ChatBoxMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.