π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Resolve the configured voice activity model path directly
Manav Rathi5473976be6e3
diff --git a/android/apps/ensu/app/src/main/java/io/ente/ensu/EnsuApplication.kt b/android/apps/ensu/app/src/main/java/io/ente/ensu/EnsuApplication.ktindex 3b3ae80560..acb8b34063 100644--- a/android/apps/ensu/app/src/main/java/io/ente/ensu/EnsuApplication.kt+++ b/android/apps/ensu/app/src/main/java/io/ente/ensu/EnsuApplication.kt@@ -6,7 +6,6 @@ import io.ente.ensu.bindings.RustLogSinkimport io.ente.ensu.bindings.Transcriberimport io.ente.ensu.bindings.initRustLoggingimport io.ente.ensu.bindings.transcriptionModelAsset-import io.ente.ensu.bindings.voiceActivityModelAssetimport io.ente.ensu.assets.AssetStoreimport io.ente.ensu.knowledge.KnowledgeProviderimport io.ente.ensu.logging.FileLogRepository@@ -19,10 +18,9 @@ class EnsuApplication : Application() {val transcriber by lazy {val store = assetStoreval transcription = transcriptionModelAsset()- val voiceActivity = voiceActivityModelAsset()Transcriber(store.assetDir(transcription).absolutePath,- store.voiceActivityModelPath(voiceActivity).absolutePath+ store.voiceActivityModelPath().absolutePath)}diff --git a/android/apps/ensu/app/src/main/java/io/ente/ensu/assets/AssetStore.kt b/android/apps/ensu/app/src/main/java/io/ente/ensu/assets/AssetStore.ktindex 3a5fa66028..23820a078b 100644--- a/android/apps/ensu/app/src/main/java/io/ente/ensu/assets/AssetStore.kt+++ b/android/apps/ensu/app/src/main/java/io/ente/ensu/assets/AssetStore.kt@@ -57,7 +57,7 @@ class AssetStore(context: Context) {fun llmMmprojPath(asset: Asset): File? =core.llmMmprojPath(asset)?.let(::File)- fun voiceActivityModelPath(asset: Asset): File = File(core.voiceActivityModelPath(asset))+ fun voiceActivityModelPath(): File = File(core.voiceActivityModelPath())fun isDownloaded(asset: Asset): Boolean = core.isDownloaded(asset)diff --git a/apple/apps/ensu/Ensu/Chat/ChatViewModel.swift b/apple/apps/ensu/Ensu/Chat/ChatViewModel.swiftindex 5e64cc6409..c6e66b09c6 100644--- a/apple/apps/ensu/Ensu/Chat/ChatViewModel.swift+++ b/apple/apps/ensu/Ensu/Chat/ChatViewModel.swift@@ -120,10 +120,9 @@ final class ChatViewModel: ObservableObject {// Must initialize after the asset store migrates the persisted selection.self.modelSettings = ModelSettingsStore.sharedlet transcription = transcriptionModelAsset()- let voiceActivity = voiceActivityModelAsset()let transcriber = Transcriber(modelDir: assetStore.assetDir(transcription).path,- vadModelPath: assetStore.voiceActivityModelPath(voiceActivity).path+ vadModelPath: assetStore.voiceActivityModelPath().path)let provider = LlmProvider(assetStore: assetStore, transcriber: transcriber, knowledgeEmbedding: config.knowledgeEmbedding)let notesStore = NotesStore(provider: provider)diff --git a/apple/apps/ensu/Ensu/Services/AssetStore.swift b/apple/apps/ensu/Ensu/Services/AssetStore.swiftindex e604a77eaa..41dce1d58f 100644--- a/apple/apps/ensu/Ensu/Services/AssetStore.swift+++ b/apple/apps/ensu/Ensu/Services/AssetStore.swift@@ -56,8 +56,8 @@ final class AssetStore: @unchecked Sendable {core.llmMmprojPath(asset: asset).map { URL(fileURLWithPath: $0) }}- func voiceActivityModelPath(_ asset: Asset) -> URL {- URL(fileURLWithPath: core.voiceActivityModelPath(asset: asset))+ func voiceActivityModelPath() -> URL {+ URL(fileURLWithPath: core.voiceActivityModelPath())}func isDownloaded(_ asset: Asset) -> Bool {diff --git a/rust/bindings/uniffi/ensu/src/assets.rs b/rust/bindings/uniffi/ensu/src/assets.rsindex e9908946a6..a1cc61ae36 100644--- a/rust/bindings/uniffi/ensu/src/assets.rs+++ b/rust/bindings/uniffi/ensu/src/assets.rs@@ -175,8 +175,8 @@ impl AssetStoreCore {.map(|path| path.display().to_string())}- pub fn voice_activity_model_path(&self, asset: Arc<Asset>) -> String {- ente_ensu::model::voice_activity_model_path(&self.inner, &asset.inner)+ pub fn voice_activity_model_path(&self) -> String {+ ente_ensu::model::voice_activity_model_path(&self.inner).display().to_string()}diff --git a/rust/crates/ensu/src/model/migrations.rs b/rust/crates/ensu/src/model/migrations.rsindex e834754bda..46640183b2 100644--- a/rust/crates/ensu/src/model/migrations.rs+++ b/rust/crates/ensu/src/model/migrations.rs@@ -154,7 +154,7 @@ fn migrate_transcription(store: &AssetStore, legacy_dir: &Path) {}let vad = model::voice_activity_model_asset();- let vad_destination = model::voice_activity_model_path(store, &vad);+ let vad_destination = model::voice_activity_model_path(store);if defaults.voice_activity_model.id == LEGACY_VAD_ID && !store.is_downloaded(&vad) {let source = legacy_dir.join(LEGACY_VAD_FILE);if is_non_empty_file(&source) {diff --git a/rust/crates/ensu/src/model/mod.rs b/rust/crates/ensu/src/model/mod.rsindex 0f56a21052..e2ae165755 100644--- a/rust/crates/ensu/src/model/mod.rs+++ b/rust/crates/ensu/src/model/mod.rs@@ -116,10 +116,10 @@ pub fn llm_mmproj_path(store: &AssetStore, asset: &Asset) -> Option<PathBuf> {store.file_path(asset, LLM_MMPROJ_FILE)}-pub fn voice_activity_model_path(store: &AssetStore, asset: &Asset) -> PathBuf {+pub fn voice_activity_model_path(store: &AssetStore) -> PathBuf {store- .file_path(asset, VOICE_ACTIVITY_MODEL_FILE)- .expect("voice activity model file")+ .asset_dir(&voice_activity_model_asset())+ .join(VOICE_ACTIVITY_MODEL_FILE)}pub(crate) fn model_key(id: &str) -> Vec<String> {