diff --git a/packages/cli/src/services/insight/generators/DataProcessor.ts b/packages/cli/src/services/insight/generators/DataProcessor.ts index 10c212172..e2e0cf5d4 100644 --- a/packages/cli/src/services/insight/generators/DataProcessor.ts +++ b/packages/cli/src/services/insight/generators/DataProcessor.ts @@ -45,6 +45,8 @@ import { const logger = createDebugLogger('DataProcessor'); +const CONCURRENCY_LIMIT = 2; + export class DataProcessor { constructor(private config: Config) {} @@ -565,7 +567,7 @@ export class DataProcessor { ], }; - const limit = pLimit(2); + const limit = pLimit(CONCURRENCY_LIMIT); try { const [ @@ -969,7 +971,7 @@ None captured`; logger.info(`Analyzing ${recentFiles.length} recent sessions with LLM...`); // Create a limit function with concurrency of 4 to avoid 429 errors - const limit = pLimit(2); + const limit = pLimit(CONCURRENCY_LIMIT); let completed = 0; const total = recentFiles.length; diff --git a/packages/cli/src/ui/hooks/slashCommandProcessor.ts b/packages/cli/src/ui/hooks/slashCommandProcessor.ts index 2595aa99b..e3243a2bb 100644 --- a/packages/cli/src/ui/hooks/slashCommandProcessor.ts +++ b/packages/cli/src/ui/hooks/slashCommandProcessor.ts @@ -187,15 +187,9 @@ export const useSlashCommandProcessor = ( progress: message.progress, }; } else { - // At this point message should be of type { type: INFO|ERROR|USER, content: string } - // We cast to be sure or check existence of content - const msg = message as { - type: MessageType.INFO | MessageType.ERROR | MessageType.USER; - content: string; - }; historyItemContent = { - type: msg.type, - text: msg.content, + type: message.type, + text: message.content, }; } addItem(historyItemContent, message.timestamp.getTime());