A Spring Boot application that implements a customer service chatbot for ByteBox, a fictitious e-commerce platform specializing in computer components and electronics.
- Real-time chat interface
- OpenAI integration for natural language processing
Chat history management(Disabled due a bug)- Markdown support for formatted responses
- Responsive design
- Shipping cost calculator (fake calculation logic)
-
Backend:
- Java 17
- Spring Boot
- Spring WebFlux
- Thymeleaf
-
Frontend:
- HTML5
- CSS3
- JavaScript
- jQuery
- Marked.js for Markdown rendering
-
AI Integration:
- OpenAI API
- Simple OpenAI Java client
- JTokkit for token counting (indev)
- Java 17+
- Maven
- OpenAI API key
- OpenAI Assistant ID
-
Create an assistant on OpenAI's website
-
Enable File search and add the files
guidelines.md
andabout.md
insrc\main\resources\bytebox
-
Add a function and paste the configuration from
functionCalling.json
insrc\main\resources\bytebox
-
Enter the system instructions in the file
instructions.md
insrc\main\resources\bytebox
-
Create a
.env
file in the root directory with:
OPENAI_API_KEY=your_api_key_here
OPENAI_ASSISTANT_ID=your_assistant_id_here
- Install maven dependencies:
mvn clean install
- Run Spring Boot
mvn spring-boot:run
- Then access localhost:8080
- Build the project
mvn clean package -f pom.xml
- Navigate to maven target folder
cd target
- Run the application replacing with your variables
java "-Dspring.profiles.active=prod" "-DOPENAI_API_KEY=your_api_key_here" "-DOPENAI_ASSISTANT_ID=your_assistant_id_here" -jar chatbot-0.0.1-SNAPSHOT.jar
- Then access localhost:8080
src/
└── main/
├── java/
│ └── dev/raniery/chatbot/
│ ├── web/
│ │ ├── controller/
│ │ └── dto/
│ ├── domain/
│ │ └── service/
│ ├── infra/
│ │ └── openai/
│ └── ChatbotApplication.java
└── resources/
├── static/
│ ├── css/
│ └── js/
├── templates/
└── bytebox/
- simple-openai - Simple OpenAI Java client
- jtokkit - Token counting