Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gsproston-scottlogic committed Aug 9, 2023
1 parent db1182b commit 8dc6291
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/src/openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async function chatGptCallFunction(functionCall, defenceInfo, session) {
}
} else if (functionName == "getEmailWhitelist") {
response = getEmailWhitelist(
isDefenceActive("EMAIL_WHITELIST", session.activeDefences)
isDefenceActive("EMAIL_WHITELIST", session.defences)
);
}
if (functionName === "askQuestion") {
Expand Down Expand Up @@ -228,7 +228,7 @@ async function chatGptSendMessage(message, session) {
const evalPrompt = await queryPromptEvaluationModel(message);
if (evalPrompt.isMalicious) {
defenceInfo.triggeredDefences.push("LLM_EVALUATION");
if (isDefenceActive("LLM_EVALUATION", session.activeDefences)) {
if (isDefenceActive("LLM_EVALUATION", session.defences)) {
console.debug("LLM evalutation defence active.");
defenceInfo.blocked = true;
const evalResponse =
Expand Down
2 changes: 1 addition & 1 deletion backend/src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ router.post("/openai/chat", async (req, res, next) => {
defenceInfo.blocked || openAiReply.defenceInfo.blocked;
} catch (error) {
console.log(error);
if (error.response.status == 401) {
if (error.response?.status == 401) {
res.statusCode = 401;
reply = "Please enter a valid OpenAI API key to chat to me!";
} else {
Expand Down

0 comments on commit 8dc6291

Please sign in to comment.