Skip to content

Commit c7c3b91

Browse files
add event tracking for stop button click (opendatahub-io#5580)
1 parent e301e0a commit c7c3b91

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/gen-ai/frontend/src/app/Chatbot/hooks/useChatbotMessages.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ const useChatbotMessages = ({
130130
const handleStopStreaming = React.useCallback(() => {
131131
if (abortControllerRef.current) {
132132
isStoppingStreamRef.current = true;
133+
134+
// Track stop button click
135+
fireMiscTrackingEvent('Playground Query Stopped', {
136+
isStreaming: isStreamingEnabled,
137+
isRag: isRawUploaded,
138+
});
139+
133140
// Clear any pending streaming updates to prevent them from overwriting the stop message
134141
if (timeoutRef.current) {
135142
clearTimeout(timeoutRef.current);
@@ -138,7 +145,7 @@ const useChatbotMessages = ({
138145
abortControllerRef.current.abort();
139146
abortControllerRef.current = null;
140147
}
141-
}, []);
148+
}, [isStreamingEnabled, isRawUploaded]);
142149

143150
const clearConversation = React.useCallback(() => {
144151
// Mark that we're clearing (not just stopping)

0 commit comments

Comments
 (0)