Skip to content

Commit 28ba6ef

Browse files
fix: show classification feedback during LLM intent detection
Add "Understanding your request..." indicator with spinner above the chat input while LLM-based intent classification is running. Previously the classification status was written to appStore but the UI read from the image generation service, so feedback was never visible. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ec5685c commit 28ba6ef

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

src/screens/ChatScreen.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const ChatScreen: React.FC = () => {
5959
const [debugInfo, setDebugInfo] = useState<DebugInfo | null>(null);
6060
const [alertState, setAlertState] = useState<AlertState>(initialAlertState);
6161
const [showScrollToBottom, setShowScrollToBottom] = useState(false);
62+
const [isClassifying, setIsClassifying] = useState(false);
6263
// Message entry animation gating — only animate newly arriving messages
6364
const lastMessageCountRef = useRef(0);
6465
const [animateLastN, setAnimateLastN] = useState(0);
@@ -558,10 +559,9 @@ export const ChatScreen: React.FC = () => {
558559
? downloadedModels.find(m => m.id === settings.classifierModelId)
559560
: null;
560561

561-
// Show status when using LLM classification (only if not already generating)
562-
if (useLLM && !isGeneratingImage) {
563-
setAppIsGeneratingImage(true);
564-
setAppImageGenerationStatus('Preparing classifier...');
562+
// Show classifying indicator for LLM-based classification
563+
if (useLLM) {
564+
setIsClassifying(true);
565565
}
566566

567567
const intent = await intentClassifier.classifyIntent(text, {
@@ -572,7 +572,9 @@ export const ChatScreen: React.FC = () => {
572572
modelLoadingStrategy: settings.modelLoadingStrategy,
573573
});
574574

575-
// Clear status if not generating image (and we set it during classification)
575+
setIsClassifying(false);
576+
577+
// Clear status if not generating image
576578
if (intent !== 'image' && useLLM) {
577579
setAppImageGenerationStatus(null);
578580
setAppIsGeneratingImage(false);
@@ -581,6 +583,7 @@ export const ChatScreen: React.FC = () => {
581583
return intent === 'image';
582584
} catch (error) {
583585
console.warn('[ChatScreen] Intent classification failed:', error);
586+
setIsClassifying(false);
584587
setAppImageGenerationStatus(null);
585588
setAppIsGeneratingImage(false);
586589
return false;
@@ -1309,6 +1312,14 @@ export const ChatScreen: React.FC = () => {
13091312
</View>
13101313
)}
13111314

1315+
{/* Intent classification indicator */}
1316+
{isClassifying && (
1317+
<View style={styles.classifyingBar}>
1318+
<ActivityIndicator size="small" color={colors.primary} />
1319+
<Text style={styles.classifyingText}>Understanding your request...</Text>
1320+
</View>
1321+
)}
1322+
13121323
{/* Input */}
13131324
<ChatInput
13141325
onSend={handleSend}
@@ -1642,6 +1653,20 @@ const createStyles = (colors: ThemeColors, _shadows: ThemeShadows) => ({
16421653
...TYPOGRAPHY.body,
16431654
color: colors.primary,
16441655
},
1656+
classifyingBar: {
1657+
flexDirection: 'row' as const,
1658+
alignItems: 'center' as const,
1659+
gap: 8,
1660+
paddingHorizontal: 16,
1661+
paddingVertical: 8,
1662+
borderTopWidth: 1,
1663+
borderTopColor: colors.border,
1664+
backgroundColor: colors.background,
1665+
},
1666+
classifyingText: {
1667+
...TYPOGRAPHY.meta,
1668+
color: colors.textSecondary,
1669+
},
16451670
imageProgressContainer: {
16461671
paddingHorizontal: 12,
16471672
paddingTop: 8,

0 commit comments

Comments
 (0)