1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-09-03 06:12:53 +02:00

fix: stop streaming

This commit is contained in:
Arik Chakma
2025-06-18 22:10:57 +06:00
parent 412246034b
commit 3faedf80e0
2 changed files with 3 additions and 2 deletions

View File

@@ -297,14 +297,13 @@ export function AIGuideChat(props: AIGuideChatProps) {
<button
className="absolute top-1/2 right-2 -translate-y-1/2 p-1 text-zinc-500 hover:text-black disabled:opacity-50"
disabled={isStreamingMessage}
onClick={() => {
if (!isLoggedIn()) {
showLoginPopup();
return;
}
if (isStreamingMessage) {
if (status !== 'idle') {
stop();
return;
}

View File

@@ -100,6 +100,7 @@ export function useChat(options: UseChatOptions) {
},
});
setStatus('idle');
abortControllerRef.current = null;
onFinish?.();
} catch (error) {
@@ -110,6 +111,7 @@ export function useChat(options: UseChatOptions) {
}
onError?.(error as Error);
setStatus('error');
}
},
[endpoint, onError],