I'm trying to make an AI GUI. When entered the prompt the app will submit into the backend and then the backend will provide a stream of responses. All goes well until I tried to build the app, where normal fetch doesn't work. Then, I switched to @tauri-apps/plugin-http, but it cannot watch stream responses? Like it received all of it at once and concating them with newlines and errors out my JSON.parse(). Is there a workaround of this?
I've found this: https://github.com/tauri-apps/tauri/discussions/6613
but I don't know how to receive the stream responses in realtime? I don't want to collect it at the end, I want to render it as it is streaming. Maybe it does that but I'm a bit unfamiliar with Rust, so how would the frontend look like using that?
Like fetch https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream/getReader const response = await fetch(url); const reader = response.body.getReader(); while (true) { const { value, done ...