Disclaimer
This project is intended primarily for internal use by Oak National Academy. While the repository is public, there is no expectation for external users to run the application. The installation instructions and other documentation are currently tailored for internal use and may not be comprehensive for external users.
Oak AI Lesson Assistant is a project focused on experimenting with AI models and their applications. This repository contains several components designed to facilitate AI research and development.
- Oak AI Lesson Assistant
Oak AI Lesson Assistant is a project designed to facilitate the development and testing of AI tools and models. The project is structured as a Turborepo monorepo, leveraging various open-source tools and libraries.
With pnpm installed, run the following command from the project root:
pnpm install -r
This application is structured as a Turborepo monorepo. Install the "turbo" command globally:
pnpm install turbo --global
Instructions are available for both Homebrew and Dockerized setups.
Navigate to the packages/db
directory:
cd packages/db
Build and run the Docker container to create a database named oai
, with the username and password both as oai
, bound to port 5432. It will also install pgvector
and postgresql-contrib
.
pnpm run docker-bootstrap
To run psql
, ssh into the box using:
pnpm run docker-psql
To seed the database:
pnpm run db-push
pnpm run db-seed
From the repo root, then run:
pnpm run prompts
To reset and start fresh:
pnpm run docker-reset
To import a snapshot of production or staging databases into your local instance:
pnpm run docker-reset
pnpm run db-restore-from:prd
where :prd
can be either :prd
or :stg
(the Doppler environments).
Install and start PostgreSQL:
brew install postgresql
brew services start postgresql
createdb oai
psql
In PSQL:
sudo -u postgres psql
CREATE USER oai WITH ENCRYPTED PASSWORD 'oai';
GRANT ALL PRIVILEGES ON DATABASE oai TO oai;
ALTER USER oai WITH SUPERUSER;
Note: Running in superuser mode is not ideal; consider separate users for migrations and queries.
Exit PSQL using \quit
.
Install PG Vector:
brew install pgvector
psql postgres
CREATE EXTENSION vector;
Quit PSQL.
We use Doppler for secrets management. To run the application, you need to set up the Doppler CLI.
Navigate to the turborepo root:
brew install dopplerhq/cli/doppler
doppler login
doppler setup
pnpm doppler:pull:dev
This command copies the Doppler environment variables for the dev environment to a local .env
file. When secrets change, run this command again.
Start the server with:
pnpm dev
Then visit http://localhost:2525.
The apps/nextjs
and packages/aila
projects have Jest tests. Run all tests using:
pnpm test
Ensure the dev server is running with pnpm dev
. Use the Playwright UI to select and run individual tests interactively.
pnpm test-e2e-ui
To run tests headlessly in the CLI:
pnpm test-e2e
Our Playwright tests are organised with tags:
@authenticated
: Tests with this tag use a pre-created test user, reused without cleanup between tests.@openai
: Indicates that the test calls the OpenAI API without a mock. These are excluded from CI runs due to potential slowness, flakiness, or expense. We aim to use mocks for these tests in the future.
Install the Jest and Playwright extensions recommended in the workspace config. Testing icons should appear in the gutter to the left of each test when viewing a test file. Clicking the icon will run the test. The testing tab in the VSCode nav bar provides an overview.
The current release process is fully documented in Notion, but broadly works as follows:
- Work is completed in branches that are merged to
main
using squash merge, with the commit message (set by the PR title) matching conventional commit convention. - When ready to release, a 'release candidate' branch is created from
main
and a PR opened to merge that branch intoproduction
(where the live site is deployed from). - The PR then contains all the commits to be released. This is manually tested.
- Once approved, the PR is merged into
production
and semantic release creates a tagged version commit, also updating the change log from the merged commits. Theproduction
branch is the merged back intomain
to ensure tags, change log, and hotfixes (raised toproduction
directly from a working branch) are on themain
branch.
If you encounter issues with dependencies causing errors, try using PNPM's prune command:
pnpm prune
pnpm install -r
If issues persist, remove all node_modules
folders in all packages and apps:
turbo clean
pnpm install -r
You may also want to clear your global npx
cache:
rm -rf ~/.npm/_npx
Please see our security.txt file.
We don't currently accept external contributions to the codebase, but this is under review, and we hope to find an approach that works for us and the community.
As with all web projects, we depend on open-source libraries maintained by others. While it's not practical to acknowledge them all, we express our gratitude for the contributions and efforts of the OSS community.
Unless stated otherwise, the codebase is released under the MIT License. This covers both the codebase and any sample code in the documentation. Where any Oak National Academy trademarks or logos are included, these are not released under the MIT License and should be used in line with Oak National Academy brand guidelines.
Any documentation included is © Oak National Academy and available under the terms of the Open Government Licence v3.0, except where otherwise stated.