mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 16:21:26 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -1,25 +1,44 @@
|
||||
import type { QueueDropPolicy, QueueMode } from "./types.js";
|
||||
|
||||
export function normalizeQueueMode(raw?: string): QueueMode | undefined {
|
||||
if (!raw) return undefined;
|
||||
if (!raw) {
|
||||
return undefined;
|
||||
}
|
||||
const cleaned = raw.trim().toLowerCase();
|
||||
if (cleaned === "queue" || cleaned === "queued") return "steer";
|
||||
if (cleaned === "interrupt" || cleaned === "interrupts" || cleaned === "abort")
|
||||
if (cleaned === "queue" || cleaned === "queued") {
|
||||
return "steer";
|
||||
}
|
||||
if (cleaned === "interrupt" || cleaned === "interrupts" || cleaned === "abort") {
|
||||
return "interrupt";
|
||||
if (cleaned === "steer" || cleaned === "steering") return "steer";
|
||||
if (cleaned === "followup" || cleaned === "follow-ups" || cleaned === "followups")
|
||||
}
|
||||
if (cleaned === "steer" || cleaned === "steering") {
|
||||
return "steer";
|
||||
}
|
||||
if (cleaned === "followup" || cleaned === "follow-ups" || cleaned === "followups") {
|
||||
return "followup";
|
||||
if (cleaned === "collect" || cleaned === "coalesce") return "collect";
|
||||
if (cleaned === "steer+backlog" || cleaned === "steer-backlog" || cleaned === "steer_backlog")
|
||||
}
|
||||
if (cleaned === "collect" || cleaned === "coalesce") {
|
||||
return "collect";
|
||||
}
|
||||
if (cleaned === "steer+backlog" || cleaned === "steer-backlog" || cleaned === "steer_backlog") {
|
||||
return "steer-backlog";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function normalizeQueueDropPolicy(raw?: string): QueueDropPolicy | undefined {
|
||||
if (!raw) return undefined;
|
||||
if (!raw) {
|
||||
return undefined;
|
||||
}
|
||||
const cleaned = raw.trim().toLowerCase();
|
||||
if (cleaned === "old" || cleaned === "oldest") return "old";
|
||||
if (cleaned === "new" || cleaned === "newest") return "new";
|
||||
if (cleaned === "summarize" || cleaned === "summary") return "summarize";
|
||||
if (cleaned === "old" || cleaned === "oldest") {
|
||||
return "old";
|
||||
}
|
||||
if (cleaned === "new" || cleaned === "newest") {
|
||||
return "new";
|
||||
}
|
||||
if (cleaned === "summarize" || cleaned === "summary") {
|
||||
return "summarize";
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user