I often observe strange behavior in production mode. The LLM response renders unevenly and eventually freezes midway with an unspecified error. There is nothing in the JS console or stdout. When I switched back to development mode, the issue stopped occurring.
Unfortunately, it's intermittent, and I haven't been able to reliably reproduce it so far.
It seems that the problem lies in the handleSubmitProduction function. I would prefer to use it instead of the one supplied by the useChat hook, but for some reason, it's unstable.