How to refresh to get latest version of widget in mobile app?

Hey all,

I’m trying to test my embedded widget from within the ChatGPT Android app. However, I’ve noticed that the ChatGPT app is using an old version of my widget. Is there a way to refresh it so that it will pull the latest version of the widget?

I have gone into settings on web and hit the “Refresh” button there and the web version of ChatGPT has updated to use the latest version of my widget but even after doing that the Android app is still using an old widget version.

I have also tried clearing the app cache and force stopping the app but this didn’t make any difference.

Thanks for any assistance anyone can offer.

4 Likes

I understand your frustration, however, this is a developer community: a space for developers building apps with OpenAI APIs and tools to have technical discussions with other developers. The ChatGPT team does not monitor this forum.

For ChatGPT discussion, join the official Discord: OpenAI. For support, you can visit https://help.openai.com/en/articles/6614161-how-can-i-contact-support.

Thank you!

4 Likes

Hello,

Thanks for the response but I think you may have misunderstood me - or I’ve misunderstood you!

I am a developer. I’m developing a ChatGPT app with the apps SDK. I have my app working via developer mode within ChatGPT. I am currently running it locally and serving it to ChatGPT via ngrok.

I am able to make changes to my app and then get the updated version in the web version of ChatGPT by going into Settings and then hitting the “Refresh” button. I can then test my updated version on the web version of ChatGPT.

However, I am getting inconsistent results with the same widget when testing it within the Android version of ChatGPT. In order to debug the widget within the Android ChatGPT app I would like to be able to update the version of my widget in the same way that I can do for the web app (pressing the “Refresh” button).

So, my question is, is there a way to reliably get the ChatGPT Android app to pull the latest version of my widget so that I can test it?

Thank you.

2 Likes

You can use the Skybridge framework by Alpic to have hot reloading while in development mode. (Please Google that as the forum doesn’t allow me to post with a link)

2 Likes

Thanks @avishay

Your framework looks great for app development. Well done with getting that set up so quickly. :clap:

Unfortunately, I don’t believe it will help with testing the apps actually on ChatGPT on the different platforms (web/Android/iOS), which is definitely necessary as I’ve found a few inconsistencies in the way they present the widgets.

1 Like

I’ll just clarify, that’s not my framework, I found it and using it myself for development. What are you experiencing that’s not enough? I’ll encourage you to open an issue on their repository if that’s a problem on their end.

1 Like

Ah, ok, got you.

I found a couple of inconsistencies on the mobile apps vs the web.
Scroll behavior was different on iOS which meant I had to ensure there was no scroll bar in the widget.
The way the widget state was returned was different on Android - it would return the state but then subsequently also return a null value, which was throwing my widget logic off.

So, as a result, it was imperative to do some iteration on the widgets through the ChatGPT mobile apps and that was made more difficult due to the inconsistency of getting the latest version of the widget on the app.

Having said that, I did find that refreshing the widget on web and then ensuring the mobile app was closed and reopened did mostly result in getting the latest version of the widget.

Actually debugging the widget on mobile was another challenge entirely but that’s not the subject of this thread!

1 Like

Wondering how you solved this? I am getting similar issues on web.. sporadic older versions of widgets. I have tried adding timestamp to the template / tool url … but still having issues.

Any help appreciated

I actually found that the web version did reliably refresh to use the latest if you go into the app settings and hit the Refresh button.
You do need some sort of versioning (like your timestamp idea) in the widget url though to ensure that the ChatGPT back end will fetch the new version when you hit “Refresh”.

If you’re still having trouble then you might want to check to ensure you’re serving suitable cache headers on your mcp endpoint and also that you’re not serving a cached version of your mcp server.

1 Like

Thanks… ok will try that with the MCP endpoint

Update: I think I solved - I had not include the cache bust in the second set of template urls… that seems to have sorted this out. I also added no-chace directives to MCP endpoint, but that did not seem to solve it.

Update 2: mmmm.. not solved :frowning: still behaving sporadically with cache-busting

FYI - had also posted here Issues refreshing widgets - keep getting cached versions - #6 by Adam_Ginsburg

Thanks for raising this @ablestyle !

I am facing similar issues and more, mainly inconsistent results on the ChatGPT Android compared to the web/ios version.

In my case an issue with how the android app handle the file attachements (openai/fileParams)… I raised a bug report on discord but not sure if it is the right place.

PS: If only there was a possibility we can publish our Apps on other platforms till they fix the Android one :thinking:

The solution is to version your widgets. I had the same problem. I wrote a script to generate a new widget version each time I publish the code to production. The widget version gets appended to the uri for each widget, making it unique. So when you hit refresh inside the android app, it’s getting the meta data (list tools) and because the uri is different, it’s forced to get the new (updated) widget. I will post some screen shots.

1 Like

All of your widget URIs should look like this:

uri = f"ui://widget/{WIDGET_NAME}@v{WIDGET_VERSION_NO}",

Then you store the value of WIDGET_VERSION_NO inside a constants.py file.
When you want to update the version number, you run this code:

sed -i -E “/^WIDGET_VERSION_NO[[:space:]]*=/{
s/([0-9]+)/(( (grep -E ‘^WIDGET_VERSION_NO[[:space:]]*=’ server/constants.py | sed -E ‘s/.*= *([0-9]+).*/\1/’) + 1 ))/
}” server/constants.py

And of course, this goes in your app.py file

from constants import WIDGET_VERSION_NO

1 Like

@OpenAI_Support Can you support? :slight_smile: