mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-02 21:50:52 +00:00
feat(insight): add progress tracking for insight generation and display updates
This commit is contained in:
parent
20de2a001a
commit
0dc359405e
8 changed files with 188 additions and 19 deletions
|
|
@ -7,6 +7,7 @@
|
|||
import type { CommandContext, SlashCommand } from './types.js';
|
||||
import { CommandKind } from './types.js';
|
||||
import { MessageType } from '../types.js';
|
||||
import type { HistoryItemInsightProgress } from '../types.js';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { join } from 'path';
|
||||
import os from 'os';
|
||||
|
|
@ -67,17 +68,33 @@ export const insightCommand: SlashCommand = {
|
|||
context.services.config,
|
||||
);
|
||||
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.INFO,
|
||||
text: t('Processing your chat history...'),
|
||||
},
|
||||
Date.now(),
|
||||
);
|
||||
const updateProgress = (
|
||||
stage: string,
|
||||
progress: number,
|
||||
detail?: string,
|
||||
) => {
|
||||
const progressItem: HistoryItemInsightProgress = {
|
||||
type: MessageType.INSIGHT_PROGRESS,
|
||||
progress: {
|
||||
stage,
|
||||
progress,
|
||||
detail,
|
||||
},
|
||||
};
|
||||
context.ui.setPendingItem(progressItem);
|
||||
};
|
||||
|
||||
// Initial progress
|
||||
updateProgress(t('Starting insight generation...'), 0);
|
||||
|
||||
// Generate the static insight HTML file
|
||||
const outputPath =
|
||||
await insightGenerator.generateStaticInsight(projectsDir);
|
||||
const outputPath = await insightGenerator.generateStaticInsight(
|
||||
projectsDir,
|
||||
updateProgress,
|
||||
);
|
||||
|
||||
// Clear pending item
|
||||
context.ui.setPendingItem(null);
|
||||
|
||||
context.ui.addItem(
|
||||
{
|
||||
|
|
@ -119,6 +136,9 @@ export const insightCommand: SlashCommand = {
|
|||
|
||||
context.ui.setDebugMessage(t('Insights ready.'));
|
||||
} catch (error) {
|
||||
// Clear pending item on error
|
||||
context.ui.setPendingItem(null);
|
||||
|
||||
context.ui.addItem(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue