Auto-reply: treat prefixed think directives as directive-only

This commit is contained in:
Peter Steinberger
2025-12-03 08:57:30 +00:00
parent 48dfb1c8ca
commit 8ba35a2dc3
2 changed files with 55 additions and 1 deletions

View File

@@ -224,8 +224,16 @@ export async function getReplyFromConfig(
(sessionEntry?.thinkingLevel as ThinkLevel | undefined) ??
(reply?.thinkingDefault as ThinkLevel | undefined);
const directiveOnly = (() => {
if (!hasThinkDirective) return false;
if (!thinkCleaned) return true;
// Ignore bracketed prefixes (timestamps, same-phone markers, etc.)
const stripped = thinkCleaned.replace(/\[[^\]]+\]\s*/g, "").trim();
return stripped.length === 0;
})();
// Directive-only message => persist session thinking level and return ack
if (hasThinkDirective && !thinkCleaned) {
if (directiveOnly) {
if (!inlineThink) {
cleanupTyping();
return {