Need help Integrating Open ai threads

I



have this little issue I need help with…
So… I am currently working on a Speech to text app with OpenAI so now I have integrated the open ai and it is responding to me now I wanted to create a thread that allows it to remember our previous convo so we can start from there any time.

Now the issue is when I tried that it does not work now even the AI does not respond again and it keeps showing an error I can figure out…

Abeg how can I fix this… I have been at it for weeks

Hey @drspark32 :waving_hand:

I just recently set this up. Best thing to do would be to see what the value is that you are sending. Save it somewhere in your database or try using the logs. Then check your value with a JSON validator since it says your formatting is incorrect.

Hope that helps a bit. :blush:

@drspark32 The big this about anything json is that any minor deviation can throw it off.
@J805 is right. You definitely need to take a look at what you are passing to chatJSON to understand why is it not a valid json.

What works best for me when passing any values as json is to run it by Bubble’s “format as json” function.
Note that as soon as you do Input message value’s format as json, this will add an extra " " around the entire message, so need to get rid of that, by using regex or somethis. See this post How to remove first and last character of a string? - #2 by mikeloc

If it still gives you issues, and the json that you are generating passes the “json formatter test” but bubble still says “failed to parse json”,
Convert the whole json to a compact json, which is remove every space and enter fro the entire json and then pass it.

The combination if these 3 hygiene never fails me.
Let me know if you need me to take a look at the json or help you on how to log the actual json for troubleshooting.