@@ -5,6 +5,7 @@ import type {
55 TalkConfig ,
66 TalkConfigResponse ,
77 TalkProviderConfig ,
8+ TalkRealtimeConfig ,
89} from "./types.gateway.js" ;
910import type { OpenClawConfig } from "./types.openclaw.js" ;
1011import { coerceSecretRef } from "./types.secrets.js" ;
@@ -85,6 +86,50 @@ function normalizeTalkProviders(value: unknown): Record<string, TalkProviderConf
8586 return Object . keys ( providers ) . length > 0 ? providers : undefined ;
8687}
8788
89+ function normalizeTalkRealtimeConfig ( value : unknown ) : TalkRealtimeConfig | undefined {
90+ if ( ! isRecord ( value ) ) {
91+ return undefined ;
92+ }
93+ const source = value ;
94+ const normalized : TalkRealtimeConfig = { } ;
95+
96+ const provider = normalizeOptionalString ( source . provider ) ;
97+ if ( provider ) {
98+ normalized . provider = provider ;
99+ }
100+ const providers = normalizeTalkProviders ( source . providers ) ;
101+ if ( providers ) {
102+ normalized . providers = providers ;
103+ }
104+ const model = normalizeOptionalString ( source . model ) ;
105+ if ( model ) {
106+ normalized . model = model ;
107+ }
108+ const voice = normalizeOptionalString ( source . voice ) ;
109+ if ( voice ) {
110+ normalized . voice = voice ;
111+ }
112+ if ( source . mode === "realtime" || source . mode === "stt-tts" || source . mode === "transcription" ) {
113+ normalized . mode = source . mode ;
114+ }
115+ if (
116+ source . transport === "webrtc" ||
117+ source . transport === "provider-websocket" ||
118+ source . transport === "gateway-relay" ||
119+ source . transport === "managed-room"
120+ ) {
121+ normalized . transport = source . transport ;
122+ }
123+ if (
124+ source . brain === "agent-consult" ||
125+ source . brain === "direct-tools" ||
126+ source . brain === "none"
127+ ) {
128+ normalized . brain = source . brain ;
129+ }
130+ return Object . keys ( normalized ) . length > 0 ? normalized : undefined ;
131+ }
132+
88133function activeProviderFromTalk ( talk : TalkConfig ) : string | undefined {
89134 const provider = normalizeOptionalString ( talk . provider ) ;
90135 const providers = talk . providers ;
@@ -118,10 +163,14 @@ export function normalizeTalkSection(value: TalkConfig | undefined): TalkConfig
118163 }
119164
120165 const providers = normalizeTalkProviders ( source . providers ) ;
166+ const realtime = normalizeTalkRealtimeConfig ( source . realtime ) ;
121167 const provider = normalizeOptionalString ( source . provider ) ;
122168 if ( providers ) {
123169 normalized . providers = providers ;
124170 }
171+ if ( realtime ) {
172+ normalized . realtime = realtime ;
173+ }
125174 if ( provider ) {
126175 normalized . provider = provider ;
127176 }
@@ -182,6 +231,9 @@ export function buildTalkConfigResponse(value: unknown): TalkConfigResponse | un
182231 if ( normalized ?. providers && Object . keys ( normalized . providers ) . length > 0 ) {
183232 payload . providers = normalized . providers ;
184233 }
234+ if ( normalized ?. realtime && Object . keys ( normalized . realtime ) . length > 0 ) {
235+ payload . realtime = normalized . realtime ;
236+ }
185237
186238 const resolved =
187239 resolveActiveTalkProviderConfig ( normalized ) ??
0 commit comments