How do I wait for the language model to generate a response before allowing the user to type in something into the chat interface?

I am using the streamlit chat component to make an interactive game. In ChatGPT, we aren’t allowed to submit a response until the assistant has finished generating a response. Is there a similar way to implement this functionality using streamlit?

Hi @Derek_Hu

I would recommend to explore the disabled parameter of chat_input() that will render the chat input box to be inactive while a certain condition is met or not met.

More info on the Docs page:

Example of this in-action is at
where the chat input box is disabled when no API key is provided.