mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-22 07:01:44 +03:00
refactor(auto-reply): dedupe inline action command handling
This commit is contained in:
@@ -272,16 +272,11 @@ export async function handleInlineActions(params: {
|
|||||||
directives = { ...directives, hasStatusDirective: false };
|
directives = { ...directives, hasStatusDirective: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inlineCommand) {
|
const runCommands = (commandInput: typeof command) =>
|
||||||
const inlineCommandContext = {
|
handleCommands({
|
||||||
...command,
|
|
||||||
rawBodyNormalized: inlineCommand.command,
|
|
||||||
commandBodyNormalized: inlineCommand.command,
|
|
||||||
};
|
|
||||||
const inlineResult = await handleCommands({
|
|
||||||
ctx,
|
ctx,
|
||||||
cfg,
|
cfg,
|
||||||
command: inlineCommandContext,
|
command: commandInput,
|
||||||
agentId,
|
agentId,
|
||||||
directives,
|
directives,
|
||||||
elevated: {
|
elevated: {
|
||||||
@@ -308,6 +303,14 @@ export async function handleInlineActions(params: {
|
|||||||
isGroup,
|
isGroup,
|
||||||
skillCommands,
|
skillCommands,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (inlineCommand) {
|
||||||
|
const inlineCommandContext = {
|
||||||
|
...command,
|
||||||
|
rawBodyNormalized: inlineCommand.command,
|
||||||
|
commandBodyNormalized: inlineCommand.command,
|
||||||
|
};
|
||||||
|
const inlineResult = await runCommands(inlineCommandContext);
|
||||||
if (inlineResult.reply) {
|
if (inlineResult.reply) {
|
||||||
if (!inlineCommand.cleaned) {
|
if (!inlineCommand.cleaned) {
|
||||||
typing.cleanup();
|
typing.cleanup();
|
||||||
@@ -341,36 +344,7 @@ export async function handleInlineActions(params: {
|
|||||||
abortedLastRun = getAbortMemory(command.abortKey) ?? false;
|
abortedLastRun = getAbortMemory(command.abortKey) ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const commandResult = await handleCommands({
|
const commandResult = await runCommands(command);
|
||||||
ctx,
|
|
||||||
cfg,
|
|
||||||
command,
|
|
||||||
agentId,
|
|
||||||
directives,
|
|
||||||
elevated: {
|
|
||||||
enabled: elevatedEnabled,
|
|
||||||
allowed: elevatedAllowed,
|
|
||||||
failures: elevatedFailures,
|
|
||||||
},
|
|
||||||
sessionEntry,
|
|
||||||
previousSessionEntry,
|
|
||||||
sessionStore,
|
|
||||||
sessionKey,
|
|
||||||
storePath,
|
|
||||||
sessionScope,
|
|
||||||
workspaceDir,
|
|
||||||
defaultGroupActivation: defaultActivation,
|
|
||||||
resolvedThinkLevel,
|
|
||||||
resolvedVerboseLevel: resolvedVerboseLevel ?? "off",
|
|
||||||
resolvedReasoningLevel,
|
|
||||||
resolvedElevatedLevel,
|
|
||||||
resolveDefaultThinkingLevel,
|
|
||||||
provider,
|
|
||||||
model,
|
|
||||||
contextTokens,
|
|
||||||
isGroup,
|
|
||||||
skillCommands,
|
|
||||||
});
|
|
||||||
if (!commandResult.shouldContinue) {
|
if (!commandResult.shouldContinue) {
|
||||||
typing.cleanup();
|
typing.cleanup();
|
||||||
return { kind: "reply", reply: commandResult.reply };
|
return { kind: "reply", reply: commandResult.reply };
|
||||||
|
|||||||
Reference in New Issue
Block a user