Hello everyone! I am new to bubble and I am creating a chatGPT clone on it as the first project. When the ‘New Conversation’ button is clicked, I wish to reset the history of chats in the JSON requests sent to openAI such that the new conversation does not contain any context/ information from the previous chats. If anyone can tell me how I can make this happen, it would be a great help!
Hi @est9358swmst! To perform this action of resetting the context of a conversation in an integration with the OpenAI API, you need to start a new chat session without including previous messages, that is, you must only send a new message from the user or, if necessary, include a system message that defines the AI behavior for the new chat.
ex: ```son
POST https://api.openai.com/v1/chat/completions
Content type: application/json
Authorization: Bearer YOUR_API_KEY
{
“model”: “gpt-4”,
“messages”: [
{
“role”: “system”,
“content”: “You are a useful assistant.”
},
{
“role”: “user”,
“content”: “Starting a new chat. What’s the weather today?”
}
]
}