mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
refactor: require canonical talk resolved payload
This commit is contained in:
@@ -831,6 +831,9 @@ extension TalkModeRuntime {
|
||||
timeoutMs: 8000)
|
||||
let talk = snap.config?["talk"]?.dictionaryValue
|
||||
let selection = Self.selectTalkProviderConfig(talk)
|
||||
if talk != nil, selection == nil {
|
||||
self.ttsLogger.info("talk config ignored: normalized payload missing talk.resolved")
|
||||
}
|
||||
let activeProvider = selection?.provider ?? Self.defaultTalkProvider
|
||||
let activeConfig = selection?.config
|
||||
let silenceTimeoutMs = Self.resolvedSilenceTimeoutMs(talk)
|
||||
@@ -870,7 +873,7 @@ extension TalkModeRuntime {
|
||||
self.ttsLogger
|
||||
.info("talk provider \(activeProvider, privacy: .public) unsupported; using system voice")
|
||||
} else if selection?.normalizedPayload == true {
|
||||
self.ttsLogger.info("talk config provider elevenlabs")
|
||||
self.ttsLogger.info("talk config provider from talk.resolved")
|
||||
}
|
||||
return TalkRuntimeConfig(
|
||||
voiceId: resolvedVoice,
|
||||
|
||||
@@ -3,7 +3,7 @@ import Testing
|
||||
@testable import OpenClaw
|
||||
|
||||
struct TalkModeConfigParsingTests {
|
||||
@Test func `prefers normalized talk provider payload`() {
|
||||
@Test func `rejects normalized talk provider payload without resolved`() {
|
||||
let talk: [String: AnyCodable] = [
|
||||
"provider": AnyCodable("elevenlabs"),
|
||||
"providers": AnyCodable([
|
||||
@@ -15,9 +15,7 @@ struct TalkModeConfigParsingTests {
|
||||
]
|
||||
|
||||
let selection = TalkModeRuntime.selectTalkProviderConfig(talk)
|
||||
#expect(selection?.provider == "elevenlabs")
|
||||
#expect(selection?.normalizedPayload == true)
|
||||
#expect(selection?.config["voiceId"]?.stringValue == "voice-normalized")
|
||||
#expect(selection == nil)
|
||||
}
|
||||
|
||||
@Test func `falls back to legacy talk fields when normalized payload missing`() {
|
||||
|
||||
Reference in New Issue
Block a user