mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 16:03:43 +00:00
talk: add configurable silence timeout
This commit is contained in:
committed by
Peter Steinberger
parent
097c588a6b
commit
6ff7e8f42e
@@ -47,6 +47,13 @@ function normalizeTalkSecretInput(value: unknown): TalkProviderConfig["apiKey"]
|
||||
return coerceSecretRef(value) ?? undefined;
|
||||
}
|
||||
|
||||
function normalizeSilenceTimeoutMs(value: unknown): number | undefined {
|
||||
if (typeof value !== "number" || !Number.isInteger(value) || value <= 0) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function normalizeTalkProviderConfig(value: unknown): TalkProviderConfig | undefined {
|
||||
if (!isPlainObject(value)) {
|
||||
return undefined;
|
||||
@@ -125,6 +132,10 @@ function normalizedLegacyTalkFields(source: Record<string, unknown>): Partial<Ta
|
||||
if (apiKey !== undefined) {
|
||||
legacy.apiKey = apiKey;
|
||||
}
|
||||
const silenceTimeoutMs = normalizeSilenceTimeoutMs(source.silenceTimeoutMs);
|
||||
if (silenceTimeoutMs !== undefined) {
|
||||
legacy.silenceTimeoutMs = silenceTimeoutMs;
|
||||
}
|
||||
return legacy;
|
||||
}
|
||||
|
||||
@@ -267,6 +278,9 @@ export function buildTalkConfigResponse(value: unknown): TalkConfig | undefined
|
||||
if (typeof normalized.interruptOnSpeech === "boolean") {
|
||||
payload.interruptOnSpeech = normalized.interruptOnSpeech;
|
||||
}
|
||||
if (typeof normalized.silenceTimeoutMs === "number") {
|
||||
payload.silenceTimeoutMs = normalized.silenceTimeoutMs;
|
||||
}
|
||||
if (normalized.providers && Object.keys(normalized.providers).length > 0) {
|
||||
payload.providers = normalized.providers;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user