OpenAI·Software Engineer·Technical Phone Screen
- Implement a ChatGPT-like chat UI in React that supports a message list with user and assistant roles, a text input with enter-to-send behavior, a loading state while waiting for the assistant, and streaming token-by-token responses rendered incrementally.
- How would you handle rapid consecutive sends or multiple button clicks while a response is still streaming?
- How do you clean up an in-flight streaming request when the component unmounts?
- How would you handle a failed API response in this chat UI, including giving the user a way to retry?
“This is a lot to hold in your head at once.”