iOS/Safari - Lost chat in background
EngineLessCC opened this issue · comments
Whenever I send some input and put my device in standby or the app in background while the answer is being written, both my input as well as the GPT answer get erased from chat history.
Likely a bug?
I'd prefer my input wouldn't be lost and even if the response is not complete, that the received data remains as well.
iOS 16.4.1 (a) - iPhone 13 Pro Max
This has to do with how your browser is suspended in iOS. When you minimize, the browser goes to "sleep" and cancels running requests. We call the OpenAI completion API as eventstream, so this stream gets terminated. Then SlickGPT realizes (correctly) that the answer stream was ended abruptly and removes the incomplete message (and your last prompt in addition to that) from the chat history.
I don't think we can do much there as long as SlickGPT is just running in the browser instead of a native app.
The better "fix" or workaround would probably be to allow disabling completion streaming so that it's a single request and response instead of a stream. There is another issue for that but it's a bit more complicated to implement. I'll close this issue for now but I have the problem in mind.
why not have SlickGPT keep the incomplete message instead of removing it? (With a simple warning about being incomplete)
The issue was not about the terminated stream as that is obvious, the issue was about the wrong behaviour on resume
I just tried on my iPhone 13 Pro with Safari and if I minimize the browser and lock my phone while the completion is being generated, it continues receiving in the background. When I unlock the phone later and reopen Safari, the answer is displayed correctly. Do you have special battery saver options enabled or something like that?
I did make a change in the past to keep incomplete answers (to implement the "stop generating" button). This should theoretically cover it. Could you please retest?
Okay I retested:
gpt4, "Give me a random sentence with 50 words".
Went to standby, waited 10 seconds, resumed, and my message + response are gone.
I'm not using any special battery savings or webkit settings.
Ok weird, thanks. I'll investigate. I did the exact same thing with 300 words and waited like 30 seconds...