talk: add configurable silence timeout

This commit is contained in:
dano does design
2026-03-08 17:58:15 +11:00
committed by Peter Steinberger
parent 097c588a6b
commit 6ff7e8f42e
18 changed files with 162 additions and 9 deletions

View File

@@ -42,6 +42,7 @@ export const TalkConfigResultSchema = Type.Object(
outputFormat: Type.Optional(Type.String()),
apiKey: Type.Optional(Type.String()),
interruptOnSpeech: Type.Optional(Type.Boolean()),
silenceTimeoutMs: Type.Optional(Type.Integer({ minimum: 1 })),
},
{ additionalProperties: false },
),

View File

@@ -56,7 +56,11 @@ async function connectOperator(ws: GatewaySocket, scopes: string[]) {
});
}
async function writeTalkConfig(config: { apiKey?: string; voiceId?: string }) {
async function writeTalkConfig(config: {
apiKey?: string;
voiceId?: string;
silenceTimeoutMs?: number;
}) {
const { writeConfigFile } = await import("../config/config.js");
await writeConfigFile({ talk: config });
}
@@ -68,6 +72,7 @@ describe("gateway talk.config", () => {
talk: {
voiceId: "voice-123",
apiKey: "secret-key-abc", // pragma: allowlist secret
silenceTimeoutMs: 1500,
},
session: {
mainKey: "main-test",
@@ -88,6 +93,7 @@ describe("gateway talk.config", () => {
};
apiKey?: string;
voiceId?: string;
silenceTimeoutMs?: number;
};
};
}>(ws, "talk.config", {});
@@ -99,6 +105,7 @@ describe("gateway talk.config", () => {
);
expect(res.payload?.config?.talk?.voiceId).toBe("voice-123");
expect(res.payload?.config?.talk?.apiKey).toBe("__OPENCLAW_REDACTED__");
expect(res.payload?.config?.talk?.silenceTimeoutMs).toBe(1500);
});
});