Michael Cruden
 · Seamless Technology Integration

Recreating a thread using OpenAI message list endpoint

Database & APIs

I have been stuck at this spot for a few days now, hoping for an assist. Also I know how JSON responses are handled in FF is rapidly updating, so I am just unsure which is the best method.

Goal is to rebuilt the thread by looping through the output of a response from the listMessages endpoint.

I have done several tutorials but mainly they focus on building it for the first time, not reloading an existing one. I structured my data types like it is done in this video. I added role and time to this one, but I may adjust that if needed.

Tutorial I followed: https://youtu.be/rWArVlymIPw?t=2222

OpenAI docs - https://platform.openai.com/docs/api-reference/messages/listMessages

I can't figure out how to properly pull data out of this structure.
Here is a simplified version of it for quick reference. I want to reference 3 fields in the list view -
role, created_at and text.value

{
  "object": "list",
  "data": [
    {
      "created_at": 1699016383,
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": {
            "value": "How does AI work? Explain it in simple terms."
          }
        }
      ]
    },
    { repeats }
  ]
}

Any help with this is greatly appreciated. Thanks!

What have you tried so far?

Several list view and data type configurations.

Did you check FlutterFlow's Documentation for this topic?
Yes
1 reply