Package com.masai.controller
Class ChatController
java.lang.Object
com.masai.controller.ChatController
The ChatController class is a Spring RestController responsible for handling
HTTP requests related to the chat functionality in the ChatBotSpringAI
application.
This controller acts as an interface between the client making requests to
the "/mychat" endpoint and the OpenAiService that handles the actual chatbot
interactions using the OpenAI API.
- Since:
- 2023-08-05
- Version:
- 1.0
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionopenAiHandler
(String userInput) Handles HTTP GET requests to "/mychat" endpoint.
-
Constructor Details
-
ChatController
public ChatController()
-
-
Method Details
-
openAiHandler
Handles HTTP GET requests to "/mychat" endpoint. This method receives user input as a request parameter and delegates the processing to the OpenAiService. The OpenAiService is responsible for invoking the OpenAI's ChatGPT API to generate a response based on the user input and return it to the client.- Parameters:
userInput
- The text input provided by the user in the "userInput" request parameter.- Returns:
- String - The response generated by the OpenAI service for the given user input.
-