Hi all, I am in desperate need of help haha. I am just messing around with Assistants with the OpenAI API and have tried creating some form of chatbot.
So when the user clicks a button “New Chat” I want the current messages in the thread (RP) to disappear and a blank screen to be shown with only the input bar showing. I want it to act similar to ChatGPT where when you click new chat, it shouldnt create a new thread yet but should clear your current messages and then only once you start typing and click send should it then create the new thread.
Most important for now is just clearing the current messages from the UI so if anyone can help with that it would be soooooo much appreciated!!
You will create the messages inside a Session datatype and your page will have a current session custom state to show the messages from.
When a new session is selected as custom state, your repeating group will show messages of this session. Automatically clearing and showing, no need anything else.
See the demo below:
I have this session data type and a list of messages in it:
Message type can be AI or human:
And all is happening with buttons are
- Creating a new session and making it the custom state of the page as the Current session.
- Create a new message and add it to the current session’s message list.
- On click of a session name, change the current session custom state.
This is the messages repeating group (on the right)'s data source: (the custom state):
You can check other details here: