feat(cli): Refine insight progress indicator UI

- Single-line layout with muted bar, accent stage text
- Inline

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>... in stage messages for cleaner code
- Simplify command intro text
This commit is contained in:
tanzhenxin 2026-02-26 15:25:39 +08:00
parent 509260ddfc
commit 5926b37f4d
3 changed files with 24 additions and 18 deletions

View file

@ -284,20 +284,20 @@ export class DataProcessor {
facetsOutputDir?: string,
onProgress?: InsightProgressCallback,
): Promise<InsightData> {
if (onProgress) onProgress('Scanning chat files', 0);
if (onProgress) onProgress('Scanning chat history...', 0);
const allChatFiles = await this.scanChatFiles(baseDir);
if (onProgress) onProgress('Generating metrics', 10);
if (onProgress) onProgress('Crunching the numbers', 10);
const metrics = await this.generateMetrics(allChatFiles, onProgress);
if (onProgress) onProgress('Analyzing sessions', 20);
if (onProgress) onProgress('Preparing sessions...', 20);
const facets = await this.generateFacets(
allChatFiles,
facetsOutputDir,
onProgress,
);
if (onProgress) onProgress('Generating qualitative insights', 80);
if (onProgress) onProgress('Generating personalized insights...', 80);
const qualitative = await this.generateQualitativeInsights(metrics, facets);
// Aggregate satisfaction, friction, success and outcome data from facets
@ -309,7 +309,7 @@ export class DataProcessor {
goalsAgg,
} = this.aggregateFacetsData(facets);
if (onProgress) onProgress('Finalizing report', 100);
if (onProgress) onProgress('Assembling report...', 100);
return {
...metrics,
@ -924,7 +924,7 @@ None captured`;
const percentComplete = batchEnd / totalFiles;
const overallProgress = 10 + Math.round(percentComplete * 10);
onProgress(
`Generating metrics (${batchEnd}/${totalFiles})`,
`Crunching the numbers (${batchEnd}/${totalFiles})`,
overallProgress,
);
}

View file

@ -53,6 +53,14 @@ export const insightCommand: SlashCommand = {
context.ui.setPendingItem(progressItem);
};
context.ui.addItem(
{
type: MessageType.INFO,
text: t('This may take a couple minutes. Sit tight!'),
},
Date.now(),
);
// Initial progress
updateProgress(t('Starting insight generation...'), 0);

View file

@ -44,18 +44,16 @@ export const InsightProgressMessage: React.FC<InsightProgressMessageProps> = ({
}
return (
<Box flexDirection="column">
<Box flexDirection="row" marginBottom={0}>
<Box marginRight={1}>
<Spinner type="dots" />
</Box>
<Text color={theme.text.accent}>{stage}</Text>
</Box>
<Box flexDirection="row" marginLeft={2}>
<Text color={theme.text.primary}>
{bar} {Math.round(percent)}%
</Text>
</Box>
<Box flexDirection="row">
<Text color={theme.text.accent}>
<Spinner type="dots" />
</Text>
<Text> </Text>
<Text color={theme.text.secondary}>{bar} </Text>
<Text color={theme.text.accent}>
{stage}
{progress.detail ? ` (${progress.detail})` : ''}
</Text>
</Box>
);
};