cadman
August 14, 2023, 7:28pm
1
Currently we are using st.text_area to optionally fill an example prompt. We have a separate page filled with example prompts organized by categories that the user can select. The code looks as follows and works fine switching and filling between pages:
user_input = st.text_area(“Ask question:”,value=st.session_state[“example_prompt”], key="question”)
However, we would like to standardize around the ChatGPT interface using st.chat_input and st.chat_message. We appreciate the response in the thread Programmatically update text in chat_input but looking to see if there are plans to update chat_input with a value option and behave like text_area .
Thanks!
edsaac
August 14, 2023, 7:32pm
2
There is a feature request about this that followed this thread .
opened 07:02AM - 13 Aug 23 UTC
type:enhancement
feature:st.chat_input
### Checklist
- [X] I have searched the [existing issues](https://github.com/st… reamlit/streamlit/issues) for similar feature requests.
- [X] I added a descriptive title and summary to this issue.
### Summary
I propose to add a parameter to `st.chat_input` that allows for the customization of the user prompt, similar to the `value` parameter of `st.text_input`.
### Why?
I have been working on an LLM that is built on top of ChatGPT. On the App page, there's a dropdown of prompt examples that users can choose from, and once they select a prompt, it should automatically appear in the `st.chat_input` box (similar to the prompt examples ChatGPT provides). Unfortunately, there is currently no way to set a custom prompt for `st.chat_input`. As this is a common practice for UIs of chat models, this functionality could be extremely helpful for a lot of applications.
### How?
I currently don't have much time to understand the details of `st.chat_input`'s implementation, but I suppose it is at least somewhat similar to how `st.text_input` is implemented. I think the team can look into how the `value` parameter is handled in `st.text_input` and use it as a reference for this functionality.
### Additional Context
_No response_
1 Like
system
Closed
February 10, 2024, 7:32pm
3
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.