follow mode actually works

This commit is contained in:
geoffsee
2025-05-30 23:38:33 -04:00
committed by Geoff Seemueller
parent 6bdce23137
commit 5f913eb2d7

View File

@@ -89,9 +89,9 @@ export const StreamStore = types
const parsed = JSON.parse(event.data); const parsed = JSON.parse(event.data);
if (parsed.type === "error") { if (parsed.type === "error") {
root.updateLast(parsed.error); root.updateLast(parsed.error);
cleanup();
root.setIsLoading(false); root.setIsLoading(false);
UserOptionsStore.setFollowModeEnabled(false); UserOptionsStore.setFollowModeEnabled(false);
cleanup();
return; return;
} }
@@ -101,8 +101,8 @@ export const StreamStore = types
) { ) {
root.appendLast(parsed.data.choices[0]?.delta?.content ?? ""); root.appendLast(parsed.data.choices[0]?.delta?.content ?? "");
UserOptionsStore.setFollowModeEnabled(false); UserOptionsStore.setFollowModeEnabled(false);
cleanup();
root.setIsLoading(false); root.setIsLoading(false);
cleanup();
return; return;
} }
@@ -116,9 +116,9 @@ export const StreamStore = types
const handleError = () => { const handleError = () => {
root.updateLast("Error • connection lost."); root.updateLast("Error • connection lost.");
root.setIsLoading(false);
UserOptionsStore.setFollowModeEnabled(false); UserOptionsStore.setFollowModeEnabled(false);
cleanup(); cleanup();
root.setIsLoading(false);
}; };
self.eventSource.onmessage = handleMessage; self.eventSource.onmessage = handleMessage;
@@ -126,9 +126,9 @@ export const StreamStore = types
} catch (err) { } catch (err) {
console.error("sendMessage", err); console.error("sendMessage", err);
root.updateLast("Sorry • network error."); root.updateLast("Sorry • network error.");
cleanup();
root.setIsLoading(false); root.setIsLoading(false);
UserOptionsStore.setFollowModeEnabled(false); UserOptionsStore.setFollowModeEnabled(false);
cleanup();
} }
}); });