Skip to content

Commit

Permalink
Merge dev into 320
Browse files Browse the repository at this point in the history
  • Loading branch information
gsproston-scottlogic committed Oct 2, 2023
2 parents d0f99b4 + 47f3eac commit a6424fe
Show file tree
Hide file tree
Showing 28 changed files with 1,317 additions and 187 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ npm install

## Setup
### Environment file
#### Backend
1. Copy the example environment file `.env.example` in the backend directory and rename it to `.env`.
1. Replace the OPENAI_API_KEY value in the `.env` file with your [OpenAI API key](https://platform.openai.com/account/api-keys).
1. Replace the SESSION_SECRET value with a [random UUID](https://www.uuidgenerator.net/).


| env var | default | description |
| ------------------------------- | ------- | ----------- |
| OPENAI_API_KEY | YOUR_API_KEY | API key used to authenticate the user when using the OpenAI API. |
Expand All @@ -35,6 +35,13 @@ npm install
| EMAIL_WHITELIST | [email protected],[email protected],@scottlogic.com | List of emails that the chat bot can 'send' emails to when the EMAIL_WHITELIST defence is active. |
| SESSION_SECRET | YOUR_SESSION_SECRET | A secret string used to set up the backend user session. |

#### Frontend
1. Copy the example environment file `.env.example` in the frontend directory and rename it to `.env`.

| env var | default | description |
| ------------------------------- | ------- | ----------- |
| VITE_BACKEND_URL | http://localhost:3001/ | The base URL to access the backend. |

## Development
### Linting and formatting

Expand Down
2 changes: 1 addition & 1 deletion backend/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ router.post("/openai/chat", async (req: OpenAiChatRequest, res) => {
// enable next level when user wins current level
if (chatResponse.wonLevel) {
console.log("Win conditon met for level: ", currentLevel);
numLevelsCompleted = currentLevel + 1;
numLevelsCompleted = Math.max(numLevelsCompleted, currentLevel + 1);
req.session.numLevelsCompleted = numLevelsCompleted;
chatResponse.numLevelsCompleted = numLevelsCompleted;
}
Expand Down
1 change: 1 addition & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BACKEND_URL=http://localhost:3001/
3 changes: 2 additions & 1 deletion frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ module.exports = {
"plugin:@typescript-eslint/stylistic-type-checked",
"plugin:@typescript-eslint/strict-type-checked",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended",
],
ignorePatterns: ["dist", ".eslintrc.cjs"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
plugins: ["react-refresh"],
plugins: ["react-refresh", "jsx-a11y"],
rules: {
"@typescript-eslint/init-declarations": "error",

Expand Down
Loading

0 comments on commit a6424fe

Please sign in to comment.