You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
OK. I've tracked this down to typical usage in the Flutter AI Toolkit implementation of the LLM providers, e.g. in the GeminiProvider:
final response =contentStreamGenerator(content);
awaitfor (final chunk in response) {
final text = chunk.text;
if (text !=null) yield text;
}
}
On not web, if there's an exception in contentStreamGenerator, then the exception propagates to the listen call upstream and it's reported to the user. On the web, however, things just hang, which is a known Dart bug: flutter/flutter#108866 (which is a closed dupe of still very open dart-lang/sdk#47764, but I don't know what DDC is and I do know what Web is, so...).
I can't use listen, since this is a single-subscriber stream and upstream needs to call listen (which can only be called once on a single-subscriber stream).
I can't use stream.forEach(processEach) because I can't call yield instead the processEach function (even if it's a closure) and the upstream needs the responses as they come in (so give that cool LLM streaming response effect).
So I'm happy to rewrite all my await for calls to work around this bug, but I have no idea how to rewrite them. And since the samples are going to be run in Debug and not Release mode, having the code correctly report errors in Debug mode is pretty important.
@kevmoo was nice enough to grab a quick GVC with me and help me rewrite the code w/o await for as a work-around, which cleared up this bug and helped clear up another one (it turns out that exceptions are a pretty handy wait to help track down bugs -- who knew??).
I dropped the work around details into the original bug, which will hopefully be fixed one day but is no longer blocking the AI Toolkit: dart-lang/sdk#47764 (comment)
Uh oh!
There was an error while loading. Please reload this page.
On the web, it just hangs (bad).
<img width="200" src="https://github.com/user-attachments/assets/e3ea273e-4a10-4c75-9c2c-2ea51326d914"
On desktop, there's an error message (good):

On iOS, there's an error message (good):

On Android, there's an error message (good):

Combine this bug with this bug and it looks like a problem with error handle on the web.
The text was updated successfully, but these errors were encountered: