MCPcopy Create free account
hub / github.com/Palm1r/QodeAssist / deferSendForAutoCompress

Method deferSendForAutoCompress

ChatView/ChatRootView.cpp:428–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428bool ChatRootView::deferSendForAutoCompress(
429 const QString &message,
430 const QStringList &attachments,
431 const QStringList &linkedFiles,
432 bool useToolsArg,
433 bool useThinkingArg)
434{
435 auto &settings = Settings::chatAssistantSettings();
436 if (!settings.autoCompress())
437 return false;
438
439 const int threshold = settings.autoCompressThreshold();
440 const int inputTokens = m_tokenCounter->inputTokens();
441 if (inputTokens < threshold)
442 return false;
443
444 if (m_recentFilePath.isEmpty()) {
445 QString filePath = getAutosaveFilePath(message, attachments);
446 if (filePath.isEmpty())
447 return false;
448 setRecentFilePath(filePath);
449 LOG_MESSAGE(QString("Set chat file path for new chat (auto-compress): %1").arg(filePath));
450 }
451
452 if (m_chatCompressor->isCompressing() || m_pendingSend.active)
453 return false;
454
455 LOG_MESSAGE(QString("Auto-compress preempt: estimated next=%1 ≥ threshold=%2; deferring send")
456 .arg(inputTokens)
457 .arg(threshold));
458
459 m_pendingSend = {message, attachments, linkedFiles, useToolsArg, useThinkingArg, true};
460 compressCurrentChat();
461 return true;
462}
463
464void ChatRootView::dispatchSend(
465 const QString &message,

Callers

nothing calls this directly

Calls 3

inputTokensMethod · 0.80
isEmptyMethod · 0.45
isCompressingMethod · 0.45

Tested by

no test coverage detected