promptable / chat-bot-starter

Chatbot starter with GPT3, Twilio, and React
https://chat-bot-starter.fly.dev/
237 stars 100 forks source link

chat improvements #17

Open colin-codegen[bot] opened 1 year ago

colin-codegen[bot] commented 1 year ago

The proposed approach offers substantial improvements in terms of modularity and readability. It intends to split the main Chat component into several smaller functional parts. It starts by moving the API call functions getAgentReply and clearChatHistory to a new file named src/hooks/chatApi.ts. Additionally, the useMutation calls are moved to chatApi.ts too. Furthermore, the state management of messages, user inputs, along with handleScroll and submit functionality are moved into a new hook src/hooks/useMessages.ts. Lastly, the smaller components UserMessage and BotMessage are each moved to new separate files.