mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-10 23:23:29 +08:00
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
46 lines
1.6 KiB
Swift
46 lines
1.6 KiB
Swift
import Speech
|
|
import Testing
|
|
@testable import OpenClaw
|
|
|
|
struct TalkModeRuntimeSpeechTests {
|
|
@Test func `speech request uses dictation defaults`() {
|
|
let request = SFSpeechAudioBufferRecognitionRequest()
|
|
|
|
TalkModeRuntime.configureRecognitionRequest(request)
|
|
|
|
#expect(request.shouldReportPartialResults)
|
|
#expect(request.taskHint == .dictation)
|
|
}
|
|
|
|
@Test func `playback plan falls back only from elevenlabs`() {
|
|
let elevenLabsPlan = TalkModeRuntime.playbackPlan(
|
|
provider: "elevenlabs",
|
|
apiKey: "key",
|
|
voiceId: "voice"
|
|
)
|
|
let missingKeyPlan = TalkModeRuntime.playbackPlan(
|
|
provider: "elevenlabs",
|
|
apiKey: nil,
|
|
voiceId: "voice"
|
|
)
|
|
let missingVoicePlan = TalkModeRuntime.playbackPlan(
|
|
provider: "elevenlabs",
|
|
apiKey: "key",
|
|
voiceId: nil
|
|
)
|
|
let blankKeyPlan = TalkModeRuntime.playbackPlan(
|
|
provider: "elevenlabs",
|
|
apiKey: "",
|
|
voiceId: "voice"
|
|
)
|
|
let mlxPlan = TalkModeRuntime.playbackPlan(provider: "mlx", apiKey: nil, voiceId: nil)
|
|
let systemPlan = TalkModeRuntime.playbackPlan(provider: "system", apiKey: nil, voiceId: nil)
|
|
|
|
#expect(elevenLabsPlan == .elevenLabsThenSystemVoice(apiKey: "key", voiceId: "voice"))
|
|
#expect(missingKeyPlan == .systemVoiceOnly)
|
|
#expect(missingVoicePlan == .systemVoiceOnly)
|
|
#expect(blankKeyPlan == .systemVoiceOnly)
|
|
#expect(mlxPlan == .mlxThenSystemVoice)
|
|
#expect(systemPlan == .systemVoiceOnly)
|
|
}
|
|
}
|