ChatGPT app built with SvelteKit.
- Streaming responses with auto scroll (scroll up to stop, scroll down to continue)
- Stop response mid-stream
- Remembers previous messages
- Supports code blocks with syntax highlighting
- Improve regex and/or code for catching code blocks
- Improve on TypeScript code
- Clone the repo:
git clone git@github.com:baresi687/sveltekit-chatgpt.git
- Install the dependencies:
npm install
- Sign up with OpenAI and create an API key.
- Create a file called .env.production in project root with the contents of VITE_CHATGPT_KEY=YOUR_API_KEY
To run the app, run the following commands:
npm run build
npm run preview
Unit tests
The processTextAndCodeblocks function has the following tests:
- Return array with text object and property text
- Return array with text object and property text updated
- Return array with code object and property code updated
- Return array with text and code objects
To run the unit tests:
npm run test