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:
@@ -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;
|
||||
}
|
||||
|
@@ -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],
|
||||
|
Reference in New Issue
Block a user