How to roll up a list of json prompts for chap gpt

I’ve got a database type called “messages” where one of the fields is the json for each message. I’m trying to roll them up into a list to be sent to the OpenAI api to get a response.

What’s the best way to roll them up? Can I create a field in data type “conversations” that is a list? If so, what data type would I use? Text?

Any help here would be greatly appreciated.

Thanks.

Hey Dave

One way to do this would be to convert them into a parse-able JSON array
If you have messages as a JSON, you can generate a text like this:

[<LIST_OF_MESSAGES_AS_JSONS>]

Bubble should automatically make the list of JSONs comma separated texts - which will make this a legit JSON format.

If that doesn’t work, you can use the :format as text operator on the list of messages (<LIST_OF_MESSAGES>:formatted as text) and make sure they are properly comma separated

Here’s an example I set up for the formatted as text approach: Demo: Build Custom JSON in Bubble - Component for Bubble Development | Atomic Fusion

1 Like