mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 04:32:44 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -10,7 +10,9 @@ export type ChatAbortControllerEntry = {
|
||||
|
||||
export function isChatStopCommandText(text: string): boolean {
|
||||
const trimmed = text.trim();
|
||||
if (!trimmed) return false;
|
||||
if (!trimmed) {
|
||||
return false;
|
||||
}
|
||||
return trimmed.toLowerCase() === "/stop" || isAbortTrigger(trimmed);
|
||||
}
|
||||
|
||||
@@ -74,8 +76,12 @@ export function abortChatRunById(
|
||||
): { aborted: boolean } {
|
||||
const { runId, sessionKey, stopReason } = params;
|
||||
const active = ops.chatAbortControllers.get(runId);
|
||||
if (!active) return { aborted: false };
|
||||
if (active.sessionKey !== sessionKey) return { aborted: false };
|
||||
if (!active) {
|
||||
return { aborted: false };
|
||||
}
|
||||
if (active.sessionKey !== sessionKey) {
|
||||
return { aborted: false };
|
||||
}
|
||||
|
||||
ops.chatAbortedRuns.set(runId, Date.now());
|
||||
active.controller.abort();
|
||||
@@ -97,9 +103,13 @@ export function abortChatRunsForSessionKey(
|
||||
const { sessionKey, stopReason } = params;
|
||||
const runIds: string[] = [];
|
||||
for (const [runId, active] of ops.chatAbortControllers) {
|
||||
if (active.sessionKey !== sessionKey) continue;
|
||||
if (active.sessionKey !== sessionKey) {
|
||||
continue;
|
||||
}
|
||||
const res = abortChatRunById(ops, { runId, sessionKey, stopReason });
|
||||
if (res.aborted) runIds.push(runId);
|
||||
if (res.aborted) {
|
||||
runIds.push(runId);
|
||||
}
|
||||
}
|
||||
return { aborted: runIds.length > 0, runIds };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user