Chatbox

Welcome to the Streamlit community, and thanks for your detailed technical report! :rocket: You’re absolutely right—there are some current limitations with st.chat_input() regarding programmatic control, voice integration, and custom widget composition.

  • As of Streamlit 1.52, you can now enable audio recording directly in st.chat_input() using accept_audio=True, which adds a built-in microphone for voice input. The transcript and audio file are returned in a dict, so users can review/edit before sending. However, programmatically setting the chat input value (e.g., pre-filling with a transcript) is not natively supported, though there are plans and open feature requests for a value parameter and more flexible callbacks. Embedding custom widgets (like extra buttons) inside st.chat_input() is not currently possible, nor is detaching the chatbox from session/page state—chat input is still tightly coupled to the app’s session and layout. For advanced use cases, community-built components like streamlit_chat_widget offer more flexibility, including unified text/audio input and custom styling, but still have some layout constraints compared to your ideal.

For your use case, the best current option is to use st.chat_input(accept_audio=True) for unified voice/text input, or try a custom component for more control. Programmatic value setting and custom widget composition inside st.chat_input() are not yet available, but are on the roadmap and actively discussed in the community and GitHub issues. Voice activation via browser APIs is now supported natively, but full integration with custom workflows is still limited. See the official docs and GitHub issues for the latest updates and workarounds: st.chat_input API, voice input issue, value parameter request, and streamlit_chat_widget.

Sources: