Pulastya B commited on
Commit
de17ff9
·
1 Parent(s): ab16b58

Fix deduplication using tool name and summary instead of counts

Browse files
FRRONTEEEND/components/ChatInterface.tsx CHANGED
@@ -117,8 +117,11 @@ export const ChatInterface: React.FC<{ onBack: () => void }> = ({ onBack }) => {
117
  console.log('✅ Analysis completed', data.result);
118
  setIsTyping(false);
119
 
120
- // Create a unique key for this analysis result to prevent duplicates
121
- const resultKey = `${activeSessionId}-${data.result?.workflow_history?.length || 0}-${data.result?.plots?.length || 0}`;
 
 
 
122
 
123
  // Only process if we haven't seen this exact result before
124
  if (!processedAnalysisRef.current.has(resultKey)) {
 
117
  console.log('✅ Analysis completed', data.result);
118
  setIsTyping(false);
119
 
120
+ // Create a unique key based on actual workflow content to prevent duplicates
121
+ // Use the last tool executed + summary hash for uniqueness
122
+ const lastTool = data.result?.workflow_history?.[data.result.workflow_history.length - 1]?.tool || 'unknown';
123
+ const summarySnippet = (data.result?.summary || '').substring(0, 50);
124
+ const resultKey = `${activeSessionId}-${lastTool}-${summarySnippet}`;
125
 
126
  // Only process if we haven't seen this exact result before
127
  if (!processedAnalysisRef.current.has(resultKey)) {