fix: align ios lint and android build
This commit is contained in:
@@ -36,7 +36,6 @@ class MainViewModel(app: Application) : AndroidViewModel(app) {
|
|||||||
val wakeWords: StateFlow<List<String>> = runtime.wakeWords
|
val wakeWords: StateFlow<List<String>> = runtime.wakeWords
|
||||||
val voiceWakeMode: StateFlow<VoiceWakeMode> = runtime.voiceWakeMode
|
val voiceWakeMode: StateFlow<VoiceWakeMode> = runtime.voiceWakeMode
|
||||||
val voiceWakeStatusText: StateFlow<String> = runtime.voiceWakeStatusText
|
val voiceWakeStatusText: StateFlow<String> = runtime.voiceWakeStatusText
|
||||||
val voiceWakeStatusText: StateFlow<String> = runtime.voiceWakeStatusText
|
|
||||||
val voiceWakeIsListening: StateFlow<Boolean> = runtime.voiceWakeIsListening
|
val voiceWakeIsListening: StateFlow<Boolean> = runtime.voiceWakeIsListening
|
||||||
val talkEnabled: StateFlow<Boolean> = runtime.talkEnabled
|
val talkEnabled: StateFlow<Boolean> = runtime.talkEnabled
|
||||||
val talkStatusText: StateFlow<String> = runtime.talkStatusText
|
val talkStatusText: StateFlow<String> = runtime.talkStatusText
|
||||||
|
|||||||
@@ -115,30 +115,30 @@ fun RootScreen(viewModel: MainViewModel) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cameraHud != null) {
|
cameraHud?.let { hud ->
|
||||||
return@remember when (cameraHud.kind) {
|
return@remember when (hud.kind) {
|
||||||
CameraHudKind.Photo ->
|
CameraHudKind.Photo ->
|
||||||
StatusActivity(
|
StatusActivity(
|
||||||
title = cameraHud.message,
|
title = hud.message,
|
||||||
icon = Icons.Default.PhotoCamera,
|
icon = Icons.Default.PhotoCamera,
|
||||||
contentDescription = "Taking photo",
|
contentDescription = "Taking photo",
|
||||||
)
|
)
|
||||||
CameraHudKind.Recording ->
|
CameraHudKind.Recording ->
|
||||||
StatusActivity(
|
StatusActivity(
|
||||||
title = cameraHud.message,
|
title = hud.message,
|
||||||
icon = Icons.Default.FiberManualRecord,
|
icon = Icons.Default.FiberManualRecord,
|
||||||
contentDescription = "Recording",
|
contentDescription = "Recording",
|
||||||
tint = androidx.compose.ui.graphics.Color.Red,
|
tint = androidx.compose.ui.graphics.Color.Red,
|
||||||
)
|
)
|
||||||
CameraHudKind.Success ->
|
CameraHudKind.Success ->
|
||||||
StatusActivity(
|
StatusActivity(
|
||||||
title = cameraHud.message,
|
title = hud.message,
|
||||||
icon = Icons.Default.CheckCircle,
|
icon = Icons.Default.CheckCircle,
|
||||||
contentDescription = "Capture finished",
|
contentDescription = "Capture finished",
|
||||||
)
|
)
|
||||||
CameraHudKind.Error ->
|
CameraHudKind.Error ->
|
||||||
StatusActivity(
|
StatusActivity(
|
||||||
title = cameraHud.message,
|
title = hud.message,
|
||||||
icon = Icons.Default.Error,
|
icon = Icons.Default.Error,
|
||||||
contentDescription = "Capture failed",
|
contentDescription = "Capture failed",
|
||||||
tint = androidx.compose.ui.graphics.Color.Red,
|
tint = androidx.compose.ui.graphics.Color.Red,
|
||||||
|
|||||||
@@ -31,12 +31,12 @@ struct StatusPill: View {
|
|||||||
struct Activity: Equatable {
|
struct Activity: Equatable {
|
||||||
var title: String
|
var title: String
|
||||||
var systemImage: String
|
var systemImage: String
|
||||||
var tint: Color? = nil
|
var tint: Color?
|
||||||
}
|
}
|
||||||
|
|
||||||
var bridge: BridgeState
|
var bridge: BridgeState
|
||||||
var voiceWakeEnabled: Bool
|
var voiceWakeEnabled: Bool
|
||||||
var activity: Activity? = nil
|
var activity: Activity?
|
||||||
var brighten: Bool = false
|
var brighten: Bool = false
|
||||||
var onTap: () -> Void
|
var onTap: () -> Void
|
||||||
|
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ final class TalkModeManager: NSObject {
|
|||||||
"sessionKey": "main",
|
"sessionKey": "main",
|
||||||
"message": message,
|
"message": message,
|
||||||
"thinking": "low",
|
"thinking": "low",
|
||||||
"timeoutMs": 30_000,
|
"timeoutMs": 30000,
|
||||||
"idempotencyKey": UUID().uuidString,
|
"idempotencyKey": UUID().uuidString,
|
||||||
]
|
]
|
||||||
let data = try JSONSerialization.data(withJSONObject: payload)
|
let data = try JSONSerialization.data(withJSONObject: payload)
|
||||||
@@ -260,7 +260,10 @@ final class TalkModeManager: NSObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func fetchLatestAssistantText(bridge: BridgeSession) async throws -> String? {
|
private func fetchLatestAssistantText(bridge: BridgeSession) async throws -> String? {
|
||||||
let res = try await bridge.request(method: "chat.history", paramsJSON: "{\"sessionKey\":\"main\"}", timeoutSeconds: 15)
|
let res = try await bridge.request(
|
||||||
|
method: "chat.history",
|
||||||
|
paramsJSON: "{\"sessionKey\":\"main\"}",
|
||||||
|
timeoutSeconds: 15)
|
||||||
guard let json = try JSONSerialization.jsonObject(with: res) as? [String: Any] else { return nil }
|
guard let json = try JSONSerialization.jsonObject(with: res) as? [String: Any] else { return nil }
|
||||||
guard let messages = json["messages"] as? [[String: Any]] else { return nil }
|
guard let messages = json["messages"] as? [[String: Any]] else { return nil }
|
||||||
for msg in messages.reversed() {
|
for msg in messages.reversed() {
|
||||||
@@ -499,7 +502,7 @@ private enum TalkModeRuntime {
|
|||||||
|
|
||||||
static func validatedSeed(_ value: Int?) -> UInt32? {
|
static func validatedSeed(_ value: Int?) -> UInt32? {
|
||||||
guard let value else { return nil }
|
guard let value else { return nil }
|
||||||
if value < 0 || value > 4294967295 { return nil }
|
if value < 0 || value > 4_294_967_295 { return nil }
|
||||||
return UInt32(value)
|
return UInt32(value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,4 +54,6 @@ Sources/Voice/VoiceWakePreferences.swift
|
|||||||
../shared/ClawdisKit/Sources/ClawdisKit/ScreenCommands.swift
|
../shared/ClawdisKit/Sources/ClawdisKit/ScreenCommands.swift
|
||||||
../shared/ClawdisKit/Sources/ClawdisKit/StoragePaths.swift
|
../shared/ClawdisKit/Sources/ClawdisKit/StoragePaths.swift
|
||||||
../shared/ClawdisKit/Sources/ClawdisKit/SystemCommands.swift
|
../shared/ClawdisKit/Sources/ClawdisKit/SystemCommands.swift
|
||||||
|
../shared/ClawdisKit/Sources/ClawdisKit/TalkDirective.swift
|
||||||
../../Swabble/Sources/SwabbleKit/WakeWordGate.swift
|
../../Swabble/Sources/SwabbleKit/WakeWordGate.swift
|
||||||
|
Sources/Voice/TalkModeManager.swift
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ public enum TalkDirectiveParser {
|
|||||||
var lines = normalized.split(separator: "\n", omittingEmptySubsequences: false)
|
var lines = normalized.split(separator: "\n", omittingEmptySubsequences: false)
|
||||||
guard !lines.isEmpty else { return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: []) }
|
guard !lines.isEmpty else { return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: []) }
|
||||||
|
|
||||||
guard let firstNonEmpty = lines.firstIndex(where: { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty })
|
guard let firstNonEmpty =
|
||||||
|
lines.firstIndex(where: { !$0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty })
|
||||||
else {
|
else {
|
||||||
return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: [])
|
return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: [])
|
||||||
}
|
}
|
||||||
@@ -83,8 +84,8 @@ public enum TalkDirectiveParser {
|
|||||||
return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: [])
|
return TalkDirectiveParseResult(directive: nil, stripped: text, unknownKeys: [])
|
||||||
}
|
}
|
||||||
|
|
||||||
let speakerBoost = boolValue(json, keys: ["speaker_boost", "speakerBoost"])
|
let speakerBoost = self.boolValue(json, keys: ["speaker_boost", "speakerBoost"])
|
||||||
?? boolValue(json, keys: ["no_speaker_boost", "noSpeakerBoost"]).map { !$0 }
|
?? self.boolValue(json, keys: ["no_speaker_boost", "noSpeakerBoost"]).map { !$0 }
|
||||||
|
|
||||||
let directive = TalkDirective(
|
let directive = TalkDirective(
|
||||||
voiceId: stringValue(json, keys: ["voice", "voice_id", "voiceId"]),
|
voiceId: stringValue(json, keys: ["voice", "voice_id", "voiceId"]),
|
||||||
|
|||||||
Reference in New Issue
Block a user