Shows how to use the ChatGPT API to make jokes based on the users input.
This project was originally made by my fellow computer science lecturer Lars Mortensen (retired), from the Copenhagen School of Design & Technology.
It consists of a simple Java Spring backend and a browser-based frontend (HTML, CSS and JavaScript) page.
There are 3 different features (controllers) in the backend:
Gets ChatGPT to create a joke, by passing an input, telling what the joke should be about.
Does the same as above, but implements an IP-rate limitation (max. number of request in a small timeframe.)
Shows how to make custom responses that the ChatGPT AI has not been trained in.
You have to create a OpenAI account with credits and an API key to run this example successfully.