Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Don't block LLM inference on transcription model download

laurenspriemd488dc34a513
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatInputBar.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatInputBar.kt
index 27fc2dd34f..509778a4a4 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatInputBar.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatInputBar.kt
@@ -325,7 +325,7 @@ internal fun MessageInput(
}
val canSend = (messageText.isNotBlank() || attachments.isNotEmpty()) &&
- !voiceInputState.isWorking
+ !voiceInputState.blocksSend
IconButton(
onClick = {
diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatVoiceInput.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatVoiceInput.kt
index 0a8422ba27..db0d42686a 100644
--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatVoiceInput.kt
+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatVoiceInput.kt
@@ -56,6 +56,10 @@ internal val VoiceInputState.isWorking: Boolean
this is VoiceInputState.Downloading ||
this is VoiceInputState.Transcribing
+internal val VoiceInputState.blocksSend: Boolean
+ get() = this is VoiceInputState.Recording ||
+ this is VoiceInputState.Transcribing
+
internal fun VoiceInputState.statusText(): String? = when (this) {
VoiceInputState.Idle -> null
VoiceInputState.Recording -> "Listening..."
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
index d09b092f92..858aecb7e8 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/MessageInputView.swift
@@ -40,12 +40,12 @@ struct MessageInputView: View {
private var canSend: Bool {
let hasContent = !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || !attachments.isEmpty
- return hasContent && !isGenerating && !isDownloading && !isAttachmentDownloadBlocked && !voiceInputState.isWorking
+ return hasContent && !isGenerating && !isDownloading && !isAttachmentDownloadBlocked && !voiceInputState.blocksSend
}
private var isSendEnabled: Bool {
let hasContent = !text.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty || !attachments.isEmpty
- return hasContent && !isDownloading && !isAttachmentDownloadBlocked && !voiceInputState.isWorking
+ return hasContent && !isDownloading && !isAttachmentDownloadBlocked && !voiceInputState.blocksSend
}
var body: some View {
diff --git a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
index 461a6792b9..a8a6e4f9b9 100644
--- a/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
+++ b/mobile/native/darwin/Apps/Ensu/Ensu/Chat/VoiceTranscriptionService.swift
@@ -45,6 +45,15 @@ enum VoiceInputState: Equatable {
}
}
+ var blocksSend: Bool {
+ switch self {
+ case .recording, .transcribing:
+ return true
+ case .idle, .unsupported, .downloading, .error:
+ return false
+ }
+ }
+
var isError: Bool {
if case .error = self {
return true