fix(claw): allow ten-minute chat tasks
This commit is contained in:
parent
7708b66e8d
commit
f1b769490a
@ -2225,7 +2225,7 @@ export function AdminSettingsClient() {
|
|||||||
enabled: false,
|
enabled: false,
|
||||||
baseUrl: DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
baseUrl: DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
||||||
token: "",
|
token: "",
|
||||||
timeoutMs: 180_000,
|
timeoutMs: 600_000,
|
||||||
});
|
});
|
||||||
const [openClawChatTokenConfigured, setOpenClawChatTokenConfigured] =
|
const [openClawChatTokenConfigured, setOpenClawChatTokenConfigured] =
|
||||||
useState(false);
|
useState(false);
|
||||||
@ -2518,8 +2518,8 @@ export function AdminSettingsClient() {
|
|||||||
String(raw.baseUrl || "").trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
String(raw.baseUrl || "").trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
||||||
token: "",
|
token: "",
|
||||||
timeoutMs: Math.min(
|
timeoutMs: Math.min(
|
||||||
300_000,
|
600_000,
|
||||||
Math.max(5_000, Math.round(Number(raw.timeoutMs) || 180_000))
|
Math.max(5_000, Math.round(Number(raw.timeoutMs) || 600_000))
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
setOpenClawChatTokenConfigured(
|
setOpenClawChatTokenConfigured(
|
||||||
@ -4372,8 +4372,8 @@ export function AdminSettingsClient() {
|
|||||||
openClawChatConfig.baseUrl.trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
openClawChatConfig.baseUrl.trim() || DEFAULT_OPENCLAW_CHAT_BASE_URL,
|
||||||
token: openClawChatConfig.token.trim(),
|
token: openClawChatConfig.token.trim(),
|
||||||
timeoutMs: Math.min(
|
timeoutMs: Math.min(
|
||||||
300_000,
|
600_000,
|
||||||
Math.max(5_000, Math.round(Number(openClawChatConfig.timeoutMs) || 180_000))
|
Math.max(5_000, Math.round(Number(openClawChatConfig.timeoutMs) || 600_000))
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -12694,11 +12694,11 @@ export function AdminSettingsClient() {
|
|||||||
<Input
|
<Input
|
||||||
id="openClawChatTimeoutMs"
|
id="openClawChatTimeoutMs"
|
||||||
min={5000}
|
min={5000}
|
||||||
max={300000}
|
max={600000}
|
||||||
onChange={(event) =>
|
onChange={(event) =>
|
||||||
setOpenClawChatConfig((prev) => ({
|
setOpenClawChatConfig((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
timeoutMs: Number(event.target.value) || 180000,
|
timeoutMs: Number(event.target.value) || 600000,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
type="number"
|
type="number"
|
||||||
|
|||||||
@ -20,9 +20,9 @@ export type AdminOpenClawChatConfig = Omit<OpenClawChatConfig, "token"> & {
|
|||||||
tokenPreview: string;
|
tokenPreview: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const DEFAULT_TIMEOUT_MS = 180_000;
|
const DEFAULT_TIMEOUT_MS = 600_000;
|
||||||
const MIN_TIMEOUT_MS = 5_000;
|
const MIN_TIMEOUT_MS = 5_000;
|
||||||
const MAX_TIMEOUT_MS = 300_000;
|
const MAX_TIMEOUT_MS = 600_000;
|
||||||
|
|
||||||
function readRecord(value: unknown): Record<string, unknown> {
|
function readRecord(value: unknown): Record<string, unknown> {
|
||||||
return value && typeof value === "object" && !Array.isArray(value)
|
return value && typeof value === "object" && !Array.isArray(value)
|
||||||
|
|||||||
@ -16,6 +16,7 @@ export default defineConfig({
|
|||||||
/routes\/clawd-request-lifecycle\.test\.ts/,
|
/routes\/clawd-request-lifecycle\.test\.ts/,
|
||||||
/routes\/canvas-skill-tag-order\.test\.ts/,
|
/routes\/canvas-skill-tag-order\.test\.ts/,
|
||||||
/routes\/openclaw-client-errors\.test\.ts/,
|
/routes\/openclaw-client-errors\.test\.ts/,
|
||||||
|
/routes\/openclaw-config\.test\.ts/,
|
||||||
/routes\/openclaw-durable-task-state\.test\.ts/,
|
/routes\/openclaw-durable-task-state\.test\.ts/,
|
||||||
/routes\/openclaw-request-state\.test\.ts/,
|
/routes\/openclaw-request-state\.test\.ts/,
|
||||||
/routes\/openclaw-video-attachments\.test\.ts/,
|
/routes\/openclaw-video-attachments\.test\.ts/,
|
||||||
|
|||||||
14
tests/routes/openclaw-config.test.ts
Normal file
14
tests/routes/openclaw-config.test.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { expect, test } from "@playwright/test";
|
||||||
|
import { normalizeOpenClawChatConfig } from "@/lib/openclaw-chat/config";
|
||||||
|
|
||||||
|
test.describe("OpenClaw chat timeout config", () => {
|
||||||
|
test("defaults long-running tasks to ten minutes", () => {
|
||||||
|
expect(normalizeOpenClawChatConfig({}).timeoutMs).toBe(600_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("caps configured timeouts at ten minutes", () => {
|
||||||
|
expect(
|
||||||
|
normalizeOpenClawChatConfig({ timeoutMs: 900_000 }).timeoutMs
|
||||||
|
).toBe(600_000);
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user