Archived
status
This commit is contained in:
1 parent
c9c25f86eb
commit
40aaf4fea7
56 files changed
+5683
-179
No files matched your search
@@ -11,7 +11,9 @@ enum ConversationPhase: String {
|
||||
|
||||
/// Ports the web UI's `inferState` + EMA smoothing (app.js): mic/agent levels
|
||||
/// are smoothed with `prev * 0.6 + raw * 0.4`, thresholds are user > 0.035 and
|
||||
/// agent > 0.02, and speaking → thinking when both go silent.
|
||||
/// agent > 0.02. When remote audio ends, the state returns to listening
|
||||
/// (matching the current web reference at app.js:414-426) rather than becoming
|
||||
/// "thinking" forever.
|
||||
@MainActor
|
||||
final class ConversationStateModel: ObservableObject {
|
||||
@Published private(set) var phase: ConversationPhase = .idle
|
||||
@@ -58,10 +60,10 @@ final class ConversationStateModel: ObservableObject {
|
||||
} else if userSpeaking {
|
||||
next = .listening
|
||||
} else {
|
||||
switch phase {
|
||||
case .speaking: next = .thinking
|
||||
default: next = .listening
|
||||
}
|
||||
// Both silent: return to listening. The previous implementation
|
||||
// converted speaking → thinking forever, leaving the UI apparently
|
||||
// frozen after an agent response (matches current web reference).
|
||||
next = .listening
|
||||
}
|
||||
setPhase(next)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user