MCPcopy Index your code
hub / github.com/continuedev/continue / processMessage

Function processMessage

extensions/cli/src/ui/hooks/useChat.ts:479–657  ·  view source on GitHub ↗
(
    message: string,
    imageMap?: Map<string, Buffer>,
    isQueuedMessage: boolean = false,
    baseHistory?: ChatHistoryItem[],
  )

Source from the content-addressed store, hash-verified

477 };
478
479 const processMessage = async (
480 message: string,
481 imageMap?: Map<string, Buffer>,
482 isQueuedMessage: boolean = false,
483 baseHistory?: ChatHistoryItem[],
484 ) => {
485 // Use baseHistory if provided (e.g., when editing a message),
486 // otherwise use current chatHistory
487 const currentHistory = baseHistory ?? chatHistory;
488 // Handle special commands
489 const handled = await handleSpecialCommands({
490 message,
491 isRemoteMode,
492 remoteUrl,
493 onShowConfigSelector,
494 exit,
495 onShowDiff,
496 onShowStatusMessage,
497 });
498
499 if (handled) return;
500
501 // Handle shell mode commands (before slash commands)
502 const bashProcessedMessage = await handleBashModeProcessing(message);
503 if (bashProcessedMessage === null) {
504 return; // Bash command was handled and no further processing needed
505 }
506 message = bashProcessedMessage;
507
508 // Handle slash commands (MUST happen before remote message handling)
509 const processedMessage = await handleSlashCommandProcessing(message);
510 if (processedMessage === null) {
511 return; // Command was handled and no further processing needed
512 }
513 message = processedMessage;
514
515 // Track telemetry
516 trackUserMessage(message, model);
517
518 // In remote mode, send message to server instead of processing locally
519 if (isRemoteMode && remoteUrl) {
520 const messageContentString = convertMessageContentToString(message);
521
522 await handleRemoteMessage({
523 remoteUrl,
524 messageContent: messageContentString,
525 });
526 return;
527 }
528
529 // For non-queued messages, format and add to chat history
530 if (isQueuedMessage) {
531 // For queued messages, we need to format and add to history after compaction
532 // First, format the message
533 const formattedQueuedMessage = await formatMessageWithFiles(
534 message,
535 [], // No attached files for queued messages
536 imageMap,

Callers 3

processQueuedMessageFunction · 0.70
handleUserMessageFunction · 0.70
handleEditMessageFunction · 0.70

Calls 11

handleSpecialCommandsFunction · 0.85
handleBashModeProcessingFunction · 0.85
trackUserMessageFunction · 0.85
handleRemoteMessageFunction · 0.85
formatMessageWithFilesFunction · 0.85
setChatHistoryFunction · 0.85
executeStreamingResponseFunction · 0.85
handleAutoCompactionFunction · 0.70
debugMethod · 0.45

Tested by

no test coverage detected