SvelteKit ChatGPT
Description
ChatGPT app built with SvelteKit.
Features
- 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
Built With
To do
- Improve regex and/or code for catching code blocks
- Improve on TypeScript code
Getting Started
Installing
- Clone the repo:
git clone [email protected]: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
Running
To run the app, run the following commands:
npm run build
npm run preview
Testing
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
My LinkedIn page