fix: keep status for directive-only messages
This commit is contained in:
@@ -40,7 +40,11 @@ import { getAbortMemory } from "./reply/abort.js";
|
||||
import { runReplyAgent } from "./reply/agent-runner.js";
|
||||
import { resolveBlockStreamingChunking } from "./reply/block-streaming.js";
|
||||
import { applySessionHints } from "./reply/body.js";
|
||||
import { buildCommandContext, handleCommands } from "./reply/commands.js";
|
||||
import {
|
||||
buildCommandContext,
|
||||
buildStatusReply,
|
||||
handleCommands,
|
||||
} from "./reply/commands.js";
|
||||
import {
|
||||
handleDirectiveOnly,
|
||||
type InlineDirectives,
|
||||
@@ -346,7 +350,6 @@ export async function getReplyFromConfig(
|
||||
};
|
||||
}
|
||||
}
|
||||
const disableElevatedInGroup = isGroup && ctx.WasMentioned !== true;
|
||||
const hasDirective =
|
||||
parsedDirectives.hasThinkDirective ||
|
||||
parsedDirectives.hasVerboseDirective ||
|
||||
@@ -483,6 +486,21 @@ export async function getReplyFromConfig(
|
||||
? undefined
|
||||
: directives.rawModelDirective;
|
||||
|
||||
const command = buildCommandContext({
|
||||
ctx,
|
||||
cfg,
|
||||
agentId,
|
||||
sessionKey,
|
||||
isGroup,
|
||||
triggerBodyNormalized,
|
||||
commandAuthorized,
|
||||
});
|
||||
const allowTextCommands = shouldHandleTextCommands({
|
||||
cfg,
|
||||
surface: command.surface,
|
||||
commandSource: ctx.CommandSource,
|
||||
});
|
||||
|
||||
if (
|
||||
isDirectiveOnly({
|
||||
directives,
|
||||
@@ -528,8 +546,36 @@ export async function getReplyFromConfig(
|
||||
currentReasoningLevel,
|
||||
currentElevatedLevel,
|
||||
});
|
||||
let statusReply: ReplyPayload | undefined;
|
||||
if (directives.hasStatusDirective && allowTextCommands) {
|
||||
statusReply = await buildStatusReply({
|
||||
cfg,
|
||||
command,
|
||||
sessionEntry,
|
||||
sessionKey,
|
||||
sessionScope,
|
||||
provider,
|
||||
model,
|
||||
contextTokens,
|
||||
resolvedThinkLevel:
|
||||
currentThinkLevel ??
|
||||
(agentCfg?.thinkingDefault as ThinkLevel | undefined),
|
||||
resolvedVerboseLevel: (currentVerboseLevel ?? "off") as VerboseLevel,
|
||||
resolvedReasoningLevel: (currentReasoningLevel ??
|
||||
"off") as ReasoningLevel,
|
||||
resolvedElevatedLevel: currentElevatedLevel,
|
||||
resolveDefaultThinkingLevel: async () =>
|
||||
currentThinkLevel ??
|
||||
(agentCfg?.thinkingDefault as ThinkLevel | undefined),
|
||||
isGroup,
|
||||
defaultGroupActivation: () => defaultActivation,
|
||||
});
|
||||
}
|
||||
typing.cleanup();
|
||||
return directiveReply;
|
||||
if (statusReply?.text && directiveReply?.text) {
|
||||
return { text: `${directiveReply.text}\n${statusReply.text}` };
|
||||
}
|
||||
return statusReply ?? directiveReply;
|
||||
}
|
||||
|
||||
const persisted = await persistInlineDirectives({
|
||||
@@ -569,20 +615,6 @@ export async function getReplyFromConfig(
|
||||
}
|
||||
: undefined;
|
||||
|
||||
const command = buildCommandContext({
|
||||
ctx,
|
||||
cfg,
|
||||
agentId,
|
||||
sessionKey,
|
||||
isGroup,
|
||||
triggerBodyNormalized,
|
||||
commandAuthorized,
|
||||
});
|
||||
const allowTextCommands = shouldHandleTextCommands({
|
||||
cfg,
|
||||
surface: command.surface,
|
||||
commandSource: ctx.CommandSource,
|
||||
});
|
||||
const isEmptyConfig = Object.keys(cfg).length === 0;
|
||||
if (
|
||||
command.isWhatsAppProvider &&
|
||||
|
||||
Reference in New Issue
Block a user