Venice's API doesn't support certain OpenAI-compatible parameters that Clawdbot sends by default: - `store`: Venice returns HTTP 400 with no body when this is present - `developer` role: Not supported by Venice's API This adds VENICE_COMPAT settings (supportsStore: false, supportsDeveloperRole: false) to all Venice model definitions, both from the static catalog and dynamically discovered models. Fixes issues reported in PR #1666 where users experienced silent failures (HTTP 400, no body) when using Venice models. Co-authored-by: jonisjongithub <jonisjongithub@users.noreply.github.com> Co-authored-by: Clawdbot <bot@clawd.bot>
91 lines
3.0 KiB
Swift
91 lines
3.0 KiB
Swift
import Foundation
|
|
import SwabbleKit
|
|
import Testing
|
|
@testable import Clawdbot
|
|
|
|
@Suite struct VoiceWakeManagerExtractCommandTests {
|
|
@Test func extractCommandReturnsNilWhenNoTriggerFound() {
|
|
let transcript = "hello world"
|
|
let segments = makeSegments(
|
|
transcript: transcript,
|
|
words: [("hello", 0.0, 0.1), ("world", 0.2, 0.1)])
|
|
#expect(VoiceWakeManager.extractCommand(from: transcript, segments: segments, triggers: ["clawd"]) == nil)
|
|
}
|
|
|
|
@Test func extractCommandTrimsTokensAndResult() {
|
|
let transcript = "hey clawd do thing"
|
|
let segments = makeSegments(
|
|
transcript: transcript,
|
|
words: [
|
|
("hey", 0.0, 0.1),
|
|
("clawd", 0.2, 0.1),
|
|
("do", 0.9, 0.1),
|
|
("thing", 1.1, 0.1),
|
|
])
|
|
let cmd = VoiceWakeManager.extractCommand(
|
|
from: transcript,
|
|
segments: segments,
|
|
triggers: [" clawd "],
|
|
minPostTriggerGap: 0.3)
|
|
#expect(cmd == "do thing")
|
|
}
|
|
|
|
@Test func extractCommandReturnsNilWhenGapTooShort() {
|
|
let transcript = "hey clawd do thing"
|
|
let segments = makeSegments(
|
|
transcript: transcript,
|
|
words: [
|
|
("hey", 0.0, 0.1),
|
|
("clawd", 0.2, 0.1),
|
|
("do", 0.35, 0.1),
|
|
("thing", 0.5, 0.1),
|
|
])
|
|
let cmd = VoiceWakeManager.extractCommand(
|
|
from: transcript,
|
|
segments: segments,
|
|
triggers: ["clawd"],
|
|
minPostTriggerGap: 0.3)
|
|
#expect(cmd == nil)
|
|
}
|
|
|
|
@Test func extractCommandReturnsNilWhenNothingAfterTrigger() {
|
|
let transcript = "hey clawd"
|
|
let segments = makeSegments(
|
|
transcript: transcript,
|
|
words: [("hey", 0.0, 0.1), ("clawd", 0.2, 0.1)])
|
|
#expect(VoiceWakeManager.extractCommand(from: transcript, segments: segments, triggers: ["clawd"]) == nil)
|
|
}
|
|
|
|
@Test func extractCommandIgnoresEmptyTriggers() {
|
|
let transcript = "hey clawd do thing"
|
|
let segments = makeSegments(
|
|
transcript: transcript,
|
|
words: [
|
|
("hey", 0.0, 0.1),
|
|
("clawd", 0.2, 0.1),
|
|
("do", 0.9, 0.1),
|
|
("thing", 1.1, 0.1),
|
|
])
|
|
let cmd = VoiceWakeManager.extractCommand(
|
|
from: transcript,
|
|
segments: segments,
|
|
triggers: ["", " ", "clawd"],
|
|
minPostTriggerGap: 0.3)
|
|
#expect(cmd == "do thing")
|
|
}
|
|
}
|
|
|
|
private func makeSegments(
|
|
transcript: String,
|
|
words: [(String, TimeInterval, TimeInterval)])
|
|
-> [WakeWordSegment] {
|
|
var searchStart = transcript.startIndex
|
|
var output: [WakeWordSegment] = []
|
|
for (word, start, duration) in words {
|
|
let range = transcript.range(of: word, range: searchStart..<transcript.endIndex)
|
|
output.append(WakeWordSegment(text: word, start: start, duration: duration, range: range))
|
|
if let range { searchStart = range.upperBound }
|
|
}
|
|
return output
|
|
}
|