mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 20:08:48 +00:00
fix: forward chat send run overrides
This commit is contained in:
@@ -2159,6 +2159,7 @@ export const chatHandlers: GatewayRequestHandlers = {
|
||||
sessionId?: string;
|
||||
message: string;
|
||||
thinking?: string;
|
||||
fastMode?: boolean;
|
||||
deliver?: boolean;
|
||||
originatingChannel?: string;
|
||||
originatingTo?: string;
|
||||
@@ -2822,6 +2823,8 @@ export const chatHandlers: GatewayRequestHandlers = {
|
||||
abortSignal: activeRunAbort.controller.signal,
|
||||
images: replyOptionImages,
|
||||
imageOrder: imageOrder.length > 0 ? imageOrder : undefined,
|
||||
thinkingLevelOverride: p.thinking,
|
||||
fastModeOverride: p.fastMode,
|
||||
onAgentRunStart: (runId) => {
|
||||
agentRunStarted = true;
|
||||
const connId = typeof client?.connId === "string" ? client.connId : undefined;
|
||||
|
||||
@@ -851,6 +851,37 @@ describe("gateway server chat", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("chat.send forwards one-shot thinking and fast mode overrides", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const spy = getReplyFromConfig;
|
||||
await connectOk(ws);
|
||||
|
||||
await createSessionDir();
|
||||
await seedMainSessionEntry();
|
||||
let capturedOpts: GetReplyOptions | undefined;
|
||||
mockGetReplyFromConfigOnce(async (_ctx, opts) => {
|
||||
capturedOpts = opts;
|
||||
return undefined;
|
||||
});
|
||||
|
||||
const sendRes = await rpcReq(ws, "chat.send", {
|
||||
sessionKey: "main",
|
||||
message: "hello",
|
||||
thinking: "high",
|
||||
fastMode: true,
|
||||
idempotencyKey: "idem-thinking-fast",
|
||||
});
|
||||
expect(sendRes.ok).toBe(true);
|
||||
|
||||
await vi.waitFor(() => {
|
||||
expect(spy.mock.calls.length).toBeGreaterThan(0);
|
||||
}, FAST_WAIT_OPTS);
|
||||
|
||||
expect(capturedOpts?.thinkingLevelOverride).toBe("high");
|
||||
expect(capturedOpts?.fastModeOverride).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
test("chat.history hard-caps single oversized nested payloads", async () => {
|
||||
await withGatewayChatHarness(async ({ ws, createSessionDir }) => {
|
||||
const historyMaxBytes = 64 * 1024;
|
||||
|
||||
Reference in New Issue
Block a user