See the solution for a similar problem using the API here,
You can modify this to work in ChatGPT by putting the system message into a Custom Instruction.
system