π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(ensu): refine model defaults and mobile UX
Prateek Sunal2ae39b1a1ebb
diff --git a/mobile/native/android/apps/ensu/app-ui/build.gradle.kts b/mobile/native/android/apps/ensu/app-ui/build.gradle.ktsindex 7afa4b9bbf..a10cd0f020 100644--- a/mobile/native/android/apps/ensu/app-ui/build.gradle.kts+++ b/mobile/native/android/apps/ensu/app-ui/build.gradle.kts@@ -51,8 +51,8 @@ android {applicationId = "io.ente.ensu"minSdk = 24targetSdk = 35- versionCode = 26- versionName = "0.1.9"+ versionCode = 28+ versionName = "0.1.10"buildConfigField("String", "API_ENDPOINT", "\"$apiEndpointOverride\"")}diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatMessages.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatMessages.ktindex 5f9da2c4bb..0d1f8d68c9 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatMessages.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/chat/ChatMessages.kt@@ -632,18 +632,16 @@ private fun AssistantMessageBubble(showMenu = showMenu,pressOffset = pressOffset,onDismiss = { showMenu = false },- actions = buildList {- add(MessageAction("Copy", HugeIcons.Copy01Icon) {+ actions = listOf(+ MessageAction("Copy", HugeIcons.Copy01Icon) {haptic.perform(HapticFeedbackType.TextHandleMove)clipboard.setText(AnnotatedString(stripHiddenMessageParts(message.text)))- })- if (!message.isSynthetic) {- add(MessageAction("Retry", HugeIcons.RepeatIcon) {- haptic.perform(HapticFeedbackType.TextHandleMove)- onRetry()- })+ },+ MessageAction("Retry", HugeIcons.RepeatIcon) {+ haptic.perform(HapticFeedbackType.TextHandleMove)+ onRetry()}- }+ ))}diff --git a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/modelsettings/ModelSettingsScreen.kt b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/modelsettings/ModelSettingsScreen.ktindex 0b32392018..76c7ffd6f6 100644--- a/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/modelsettings/ModelSettingsScreen.kt+++ b/mobile/native/android/apps/ensu/app-ui/src/main/java/io/ente/ensu/modelsettings/ModelSettingsScreen.kt@@ -1,5 +1,6 @@package io.ente.ensu.modelsettings+import android.widget.Toastimport androidx.compose.animation.AnimatedVisibilityimport androidx.compose.foundation.layout.Columnimport androidx.compose.foundation.layout.Row@@ -28,6 +29,7 @@ import androidx.compose.runtime.mutableStateOfimport androidx.compose.runtime.rememberimport androidx.compose.runtime.setValueimport androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalContextimport androidx.compose.ui.text.input.KeyboardTypeimport androidx.compose.ui.unit.dpimport io.ente.ensu.designsystem.EnsuColor@@ -44,6 +46,7 @@ fun ModelSettingsScreen(onSave: (ModelSettingsState) -> Unit,onReset: () -> Unit) {+ val context = LocalContext.currentval modelChoices = remember {listOf(ModelChoice(@@ -266,6 +269,7 @@ fun ModelSettingsScreen()}onSave(savedState)+ Toast.makeText(context, "Model settings saved", Toast.LENGTH_SHORT).show()},modifier = Modifier.fillMaxWidth(),enabled = canSave,@@ -284,6 +288,7 @@ fun ModelSettingsScreen(contextLength = ""maxTokens = ""temperature = ""+ Toast.makeText(context, "Model settings reset", Toast.LENGTH_SHORT).show()}) {Text(text = "Reset to defaults", style = EnsuTypography.body, color = EnsuColor.action())}diff --git a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.ktindex e93a2f0eba..ed2598c9b7 100644--- a/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt+++ b/mobile/native/android/apps/ensu/domain/src/main/kotlin/io/ente/ensu/domain/store/ChatStoreActions.kt@@ -285,10 +285,17 @@ internal class ChatStoreActions(stopGeneration()}val sessionId = state.value.chat.currentSessionId ?: return- val message = messageStore[sessionId]?.firstOrNull { it.id == messageId } ?: return- if (message.author != MessageAuthor.Assistant) return- val parentId = message.parentId ?: return- val parent = messageStore[sessionId]?.firstOrNull { it.id == parentId } ?: return++ // For synthetic interrupted placeholders, find the parent user message directly+ val parent = if (messageId.startsWith("interrupted-placeholder-")) {+ val parentUserId = messageId.removePrefix("interrupted-placeholder-")+ messageStore[sessionId]?.firstOrNull { it.id == parentUserId }+ } else {+ val message = messageStore[sessionId]?.firstOrNull { it.id == messageId } ?: return+ if (message.author != MessageAuthor.Assistant) return+ val parentId = message.parentId ?: return+ messageStore[sessionId]?.firstOrNull { it.id == parentId }+ } ?: returnif (attachmentActions.missingAttachments(sessionId).isNotEmpty()) {attachmentActions.ensureAttachmentsAvailable(sessionId)@@ -937,23 +944,29 @@ internal class ChatStoreActions(message.copy(branchCount = max(1, siblings.size))}- val finalMessages = if (- displayMessages.size >= 2- && displayMessages.last().author == MessageAuthor.User- && !state.value.chat.isGenerating- ) {- val lastUser = displayMessages.last()- displayMessages + ChatMessage(- id = "interrupted-placeholder-${lastUser.id}",- sessionId = sessionId,- parentId = lastUser.id,- author = MessageAuthor.Assistant,- text = "Response was interrupted",- timestampMillis = lastUser.timestampMillis,- isInterrupted = true,- isSynthetic = true- )- } else displayMessages+ val isGenerating = state.value.chat.isGenerating+ val finalMessages = buildList {+ for (i in displayMessages.indices) {+ val msg = displayMessages[i]+ add(msg)+ if (msg.author == MessageAuthor.User) {+ val next = displayMessages.getOrNull(i + 1)+ val isLastAndGenerating = i == displayMessages.lastIndex && isGenerating+ if (next?.author != MessageAuthor.Assistant && !isLastAndGenerating) {+ add(ChatMessage(+ id = "interrupted-placeholder-${msg.id}",+ sessionId = sessionId,+ parentId = msg.id,+ author = MessageAuthor.Assistant,+ text = "Response was interrupted",+ timestampMillis = msg.timestampMillis,+ isInterrupted = true,+ isSynthetic = true+ ))+ }+ }+ }+ }return finalMessages to branchSelectionIndices}diff --git a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxprojindex 7b77612f51..c83241be4e 100644--- a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj+++ b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj@@ -534,7 +534,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 24;+ CURRENT_PROJECT_VERSION = 26;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -550,7 +550,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 0.1.9;+ MARKETING_VERSION = 0.1.10;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -595,7 +595,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 24;+ CURRENT_PROJECT_VERSION = 26;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -611,7 +611,7 @@"$(inherited)","@executable_path/Frameworks",);- MARKETING_VERSION = 0.1.9;+ MARKETING_VERSION = 0.1.10;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";@@ -656,7 +656,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 9;+ CURRENT_PROJECT_VERSION = 10;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -669,7 +669,7 @@"@executable_path/../Frameworks",);MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 0.1.9;+ MARKETING_VERSION = 0.1.10;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = Ensu;HEADER_SEARCH_PATHS = (@@ -716,7 +716,7 @@ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;CODE_SIGN_IDENTITY = "Apple Development";CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 9;+ CURRENT_PROJECT_VERSION = 10;DEVELOPMENT_TEAM = 6Z68YJY9Q2;ENABLE_PREVIEWS = YES;ENABLE_USER_SCRIPT_SANDBOXING = NO;@@ -729,7 +729,7 @@"@executable_path/../Frameworks",);MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 0.1.9;+ MARKETING_VERSION = 0.1.10;PRODUCT_BUNDLE_IDENTIFIER = io.ente.ensu;PRODUCT_NAME = Ensu;HEADER_SEARCH_PATHS = (diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swiftindex 863a59b864..43f94789db 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatView.swift@@ -219,6 +219,9 @@ struct ChatView: View {.transition(.move(edge: .bottom).combined(with: .opacity))}}+ #if os(iOS)+ .ignoresSafeArea(.keyboard)+ #endif}@ViewBuilder@@ -335,6 +338,7 @@ struct ChatView: View {},isFocused: $isInputFocused)+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom).onPreferenceChange(InputBarHeightKey.self) { newValue inviewState.inputBarHeight = newValue}@@ -352,6 +356,7 @@ struct ChatView: View {viewState.didDismissKeyboard = false}}+ .padding(.bottom, keyboard.isVisible ? keyboard.height : 0).zIndex(1)}@@ -371,27 +376,6 @@ struct ChatView: View {.zIndex(2)}- #if os(iOS)- if keyboard.isVisible {- Button {- viewState.didDismissKeyboard = true- isInputFocused = false- hideKeyboard()- } label: {- Image(systemName: "chevron.down")- .font(.system(size: 14, weight: .semibold))- .foregroundStyle(EnsuColor.textPrimary)- .frame(width: 32, height: 32)- .background(.ultraThinMaterial)- .clipShape(Circle())- .shadow(color: .black.opacity(0.15), radius: 4, y: 2)- }- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottomTrailing)- .padding(.trailing, EnsuSpacing.pageHorizontal)- .padding(.bottom, viewState.inputBarHeight + EnsuSpacing.sm)- .zIndex(3)- }- #endif}.animation(.easeInOut(duration: 0.32), value: viewState.sessionTransitionId)}diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swiftindex c3b872681d..b893707e50 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/ChatViewModel.swift@@ -1396,10 +1396,19 @@ final class ChatViewModel: ObservableObject {stopGenerating()}guard let sessionId = currentSessionId else { return }- guard let parent = messageStore[sessionId]?.first(where: { $0.id == message.id })?.parentId,- let userNode = messageStore[sessionId]?.first(where: { $0.id == parent }) else {- return++ let userNode: MessageNode?+ if message.isSynthetic {+ guard let syntheticIndex = messages.firstIndex(where: { $0.id == message.id }),+ syntheticIndex > 0 else { return }+ let parentMessage = messages[syntheticIndex - 1]+ guard parentMessage.role == .user else { return }+ userNode = messageStore[sessionId]?.first(where: { $0.id == parentMessage.id })+ } else {+ guard let parentId = messageStore[sessionId]?.first(where: { $0.id == message.id })?.parentId else { return }+ userNode = messageStore[sessionId]?.first(where: { $0.id == parentId })}+ guard let userNode else { return }Task { @MainActor inlet missing = await self.missingAttachments(for: sessionId)if !missing.isEmpty {@@ -2196,19 +2205,25 @@ final class ChatViewModel: ObservableObject {)}- if messages.count >= 2,- let lastMessage = messages.last,- lastMessage.role == .user,- !isGenerating {- messages.append(ChatMessage(- id: UUID(),- role: .assistant,- text: "Response was interrupted",- timestamp: lastMessage.timestamp,- isInterrupted: true,- isSynthetic: true- ))+ var augmented: [ChatMessage] = []+ for (i, msg) in messages.enumerated() {+ augmented.append(msg)+ if msg.role == .user {+ let next = i + 1 < messages.count ? messages[i + 1] : nil+ let isLastAndGenerating = i == messages.count - 1 && isGenerating+ if next?.role != .assistant && !isLastAndGenerating {+ augmented.append(ChatMessage(+ id: UUID(),+ role: .assistant,+ text: "Response was interrupted",+ timestamp: msg.timestamp,+ isInterrupted: true,+ isSynthetic: true+ ))+ }+ }}+ messages = augmented}private func buildSelectedPath(for sessionId: UUID, childrenMap: [UUID: [MessageNode]]) -> [MessageNode] {diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swiftindex 73b9cc67fd..14fc694240 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageInputView.swift@@ -189,6 +189,27 @@ struct MessageInputView: View {.background(.ultraThinMaterial).clipShape(RoundedRectangle(cornerRadius: EnsuCornerRadius.input + 4, style: .continuous)).shadow(color: Color.black.opacity(0.12), radius: 10, x: 0, y: 6)+ .overlay(alignment: .topTrailing) {+ #if os(iOS)+ if isFocused {+ Button {+ hapticTap()+ isFocused = false+ hideKeyboard()+ onDismissKeyboard()+ } label: {+ Image(systemName: "chevron.down")+ .font(.system(size: 14, weight: .semibold))+ .foregroundStyle(EnsuColor.textPrimary)+ .frame(width: 32, height: 32)+ .background(.ultraThinMaterial)+ .clipShape(Circle())+ .shadow(color: .black.opacity(0.15), radius: 4, y: 2)+ }+ .offset(y: -(32 + EnsuSpacing.sm))+ }+ #endif+ }.padding(.horizontal, EnsuSpacing.pageHorizontal).padding(.bottom, bottomPadding)}@@ -305,4 +326,3 @@ struct MessageInputView: View {}}#endif-diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swiftindex f9cba5826f..d8ee42b84d 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageList/MessageListComponents.swift@@ -188,11 +188,9 @@ struct AssistantMessageBubbleView: View {hapticTap()onCopy()}- if !message.isSynthetic {- Button("Retry") {- hapticMedium()- onRetry()- }+ Button("Retry") {+ hapticMedium()+ onRetry()}}#endifdiff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swiftindex 4ae2ebf36b..040365d270 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/MessageListView.swift@@ -131,12 +131,6 @@ struct MessageListView: View {}}- if newValue.inputBarHeight != previous.inputBarHeight {- if autoScrollEnabled && !isUserDragging {- scrollToBottom(scrollProxy, force: true, animated: false)- }- }-if newValue.isGenerating != previous.isGenerating {if newValue.isGenerating {autoScrollEnabled = truediff --git a/mobile/native/darwin/Apps/ensu/ensu/Info-macOS.plist b/mobile/native/darwin/Apps/ensu/ensu/Info-macOS.plistindex 5f76d44cb6..299e12a5dc 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Info-macOS.plist+++ b/mobile/native/darwin/Apps/ensu/ensu/Info-macOS.plist@@ -21,10 +21,10 @@<string>APPL</string><key>CFBundleShortVersionString</key>- <string>0.1.9</string>+ <string>0.1.10</string><key>CFBundleVersion</key>- <string>9</string>+ <string>10</string><key>LSApplicationCategoryType</key><string>public.app-category.photography</string>diff --git a/mobile/native/darwin/Apps/ensu/ensu/Info.plist b/mobile/native/darwin/Apps/ensu/ensu/Info.plistindex 66d60cfaef..d3cedb63d9 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Info.plist+++ b/mobile/native/darwin/Apps/ensu/ensu/Info.plist@@ -21,10 +21,10 @@<string>APPL</string><key>CFBundleShortVersionString</key>- <string>0.1.9</string>+ <string>0.1.10</string><key>CFBundleVersion</key>- <string>24</string>+ <string>25</string><key>UILaunchStoryboardName</key><string>LaunchScreen</string>diff --git a/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swiftindex 2f2b487c18..3e7d316698 100644--- a/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/ModelSettings/ModelSettingsView.swift@@ -20,18 +20,27 @@ struct ModelSettingsView: View {@State private var temperatureError: String?@State private var isSaving = false@State private var showAdvancedLimits = false+ @State private var toastMessage: String?+ @State private var toastTask: Task<Void, Never>?private let modelChoices: [ModelChoice] = {let defaults = EnsuRustDefaults.shared+ #if os(iOS)+ let defaultModel = defaults.mobileDefaultModel+ let presets = defaults.mobileModelPresets+ #else+ let defaultModel = defaults.desktopDefaultModel+ let presets = defaults.desktopModelPresets+ #endifreturn [ModelChoice(id: Self.defaultOptionId,- name: defaults.desktopDefaultModel.title,- url: defaults.desktopDefaultModel.url,- mmproj: defaults.desktopDefaultModel.mmprojUrl,+ name: defaultModel.title,+ url: defaultModel.url,+ mmproj: defaultModel.mmprojUrl,isDefault: true)- ] + defaults.desktopModelPresets.map { preset in+ ] + presets.map { preset inModelChoice(id: preset.id,name: preset.title,@@ -95,6 +104,13 @@ struct ModelSettingsView: View {temperature = settings.temperatureshowAdvancedLimits = !settings.contextLength.isEmpty || !settings.maxTokens.isEmpty || !settings.temperature.isEmpty}+ .overlay(alignment: .bottom) {+ if let toastMessage {+ ToastView(message: toastMessage)+ .padding(.bottom, EnsuSpacing.xl)+ .transition(.move(edge: .bottom).combined(with: .opacity))+ }+ }#if os(macOS).safeAreaInset(edge: .top) {if embeddedInNavigation {@@ -346,6 +362,7 @@ struct ModelSettingsView: View {)}isSaving = false+ showToast("Model settings saved")}}@@ -357,6 +374,22 @@ struct ModelSettingsView: View {contextLength = ""maxTokens = ""temperature = ""+ showToast("Model settings reset")+ }++ private func showToast(_ message: String) {+ toastTask?.cancel()+ withAnimation(.easeOut(duration: 0.2)) {+ toastMessage = message+ }+ toastTask = Task { @MainActor in+ try? await Task.sleep(nanoseconds: 1_500_000_000)+ guard !Task.isCancelled else { return }+ withAnimation(.easeIn(duration: 0.2)) {+ toastMessage = nil+ }+ toastTask = nil+ }}private func validate() -> Bool {diff --git a/mobile/native/darwin/Apps/ensu/ensu/Services/ModelSettingsStore.swift b/mobile/native/darwin/Apps/ensu/ensu/Services/ModelSettingsStore.swiftindex d6d635704b..9b13fdd2b0 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Services/ModelSettingsStore.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Services/ModelSettingsStore.swift@@ -59,18 +59,19 @@ final class ModelSettingsStore: ObservableObject {func currentTarget() -> InferenceModelTarget {let useCustom = useCustomModel && !modelUrl.isEmptylet defaults = EnsuRustDefaults.shared- let url = useCustom ? modelUrl : defaults.desktopDefaultModel.url- let mmproj = useCustom ? (mmprojUrl.isEmpty ? nil : mmprojUrl) : defaults.desktopDefaultModel.mmprojUrl+ let defaultModel = Self.platformDefaultModel+ let url = useCustom ? modelUrl : defaultModel.url+ let mmproj = useCustom ? (mmprojUrl.isEmpty ? nil : mmprojUrl) : defaultModel.mmprojUrllet context = Int(contextLength)let maxOutput = Int(maxTokens).flatMap { $0 > 0 ? $0 : nil }let id = useCustom ? "custom:\(url)" : "default"return InferenceModelTarget(id: id, url: url, mmprojUrl: mmproj, contextLength: context, maxTokens: maxOutput)}- static var defaultModelName: String { EnsuRustDefaults.shared.desktopDefaultModel.title }- static var defaultModelUrl: String { EnsuRustDefaults.shared.desktopDefaultModel.url }- static var defaultMmprojUrl: String? { EnsuRustDefaults.shared.desktopDefaultModel.mmprojUrl }- static var defaultSystemPromptBody: String { EnsuRustDefaults.shared.desktopSystemPromptBody }+ static var defaultModelName: String { platformDefaultModel.title }+ static var defaultModelUrl: String { platformDefaultModel.url }+ static var defaultMmprojUrl: String? { platformDefaultModel.mmprojUrl }+ static var defaultSystemPromptBody: String { platformSystemPromptBody }static func currentSystemPromptBody() -> String {let stored = UserDefaults.standard.string(forKey: Keys.systemPromptBody) ?? ""@@ -79,7 +80,23 @@ final class ModelSettingsStore: ObservableObject {static func resolveSystemPromptBody(_ value: String) -> String {let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines)- return trimmed.isEmpty ? EnsuRustDefaults.shared.desktopSystemPromptBody : trimmed+ return trimmed.isEmpty ? platformSystemPromptBody : trimmed+ }++ private static var platformDefaultModel: EnsuRustModelPreset {+ #if os(iOS)+ EnsuRustDefaults.shared.mobileDefaultModel+ #else+ EnsuRustDefaults.shared.desktopDefaultModel+ #endif+ }++ private static var platformSystemPromptBody: String {+ #if os(iOS)+ EnsuRustDefaults.shared.mobileSystemPromptBody+ #else+ EnsuRustDefaults.shared.desktopSystemPromptBody+ #endif}private func persist() {diff --git a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swiftindex eaa1780c8d..e774a3b409 100644--- a/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift+++ b/mobile/native/darwin/Apps/ensu/ensu/Settings/SettingsView.swift@@ -17,6 +17,8 @@ struct SettingsView: View {@State private var buildVersionTapCount = 0@State private var lastBuildVersionTapAt: Date?@State private var isAdvancedUnlocked = EnsuAdvancedSettings.isUnlocked+ @State private var toastMessage: String?+ @State private var toastTask: Task<Void, Never>?var body: some View {NavigationStack {@@ -125,6 +127,13 @@ struct SettingsView: View {} message: {Text("Signing out will remove your online chats from this device. Offline chats stay available.")}+ .overlay(alignment: .bottom) {+ if let toastMessage {+ ToastView(message: toastMessage)+ .padding(.bottom, EnsuSpacing.xl)+ .transition(.move(edge: .bottom).combined(with: .opacity))+ }+ }}}@@ -287,6 +296,22 @@ struct SettingsView: View {EnsuAdvancedSettings.unlock()isAdvancedUnlocked = truebuildVersionTapCount = 0+ showToast("Advanced settings unlocked")+ }++ private func showToast(_ message: String) {+ toastTask?.cancel()+ withAnimation(.easeOut(duration: 0.2)) {+ toastMessage = message+ }+ toastTask = Task { @MainActor in+ try? await Task.sleep(nanoseconds: 1_500_000_000)+ guard !Task.isCancelled else { return }+ withAnimation(.easeIn(duration: 0.2)) {+ toastMessage = nil+ }+ toastTask = nil+ }}private func openExternalLink(_ urlString: String) {diff --git a/mobile/native/darwin/Packages/Rust/rust/src/api.rs b/mobile/native/darwin/Packages/Rust/rust/src/api.rsindex 0e6dd77fca..9e3eb8a9a3 100644--- a/mobile/native/darwin/Packages/Rust/rust/src/api.rs+++ b/mobile/native/darwin/Packages/Rust/rust/src/api.rs@@ -40,6 +40,26 @@ pub struct ModelInfo {pub metadata_json: Option<String>,}+#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]+pub struct EnsuModelPreset {+ pub id: String,+ pub title: String,+ pub url: String,+ pub mmproj_url: Option<String>,+}++#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]+pub struct EnsuDefaults {+ pub mobile_system_prompt_body: String,+ pub desktop_system_prompt_body: String,+ pub system_prompt_date_placeholder: String,+ pub session_summary_system_prompt: String,+ pub mobile_default_model: EnsuModelPreset,+ pub mobile_model_presets: Vec<EnsuModelPreset>,+ pub desktop_default_model: EnsuModelPreset,+ pub desktop_model_presets: Vec<EnsuModelPreset>,+}+#[derive(Debug, Clone, Serialize, Deserialize, uniffi::Record)]pub struct ChatMessage {pub role: String,@@ -149,6 +169,32 @@ impl From<core::ModelInfo> for ModelInfo {}}+impl From<core::EnsuModelPreset> for EnsuModelPreset {+ fn from(value: core::EnsuModelPreset) -> Self {+ Self {+ id: value.id,+ title: value.title,+ url: value.url,+ mmproj_url: value.mmproj_url,+ }+ }+}++impl From<core::EnsuDefaults> for EnsuDefaults {+ fn from(value: core::EnsuDefaults) -> Self {+ Self {+ mobile_system_prompt_body: value.mobile_system_prompt_body,+ desktop_system_prompt_body: value.desktop_system_prompt_body,+ system_prompt_date_placeholder: value.system_prompt_date_placeholder,+ session_summary_system_prompt: value.session_summary_system_prompt,+ mobile_default_model: value.mobile_default_model.into(),+ mobile_model_presets: value.mobile_model_presets.into_iter().map(Into::into).collect(),+ desktop_default_model: value.desktop_default_model.into(),+ desktop_model_presets: value.desktop_model_presets.into_iter().map(Into::into).collect(),+ }+ }+}+impl From<ChatMessage> for core::ChatMessage {fn from(value: ChatMessage) -> Self {Self {@@ -283,6 +329,11 @@ pub fn get_model_info(model: Arc<ModelHandle>) -> Result<ModelInfo, InferenceErr.map_err(InferenceError::from)}+#[uniffi::export]+pub fn get_ensu_defaults() -> EnsuDefaults {+ core::ensu_defaults().into()+}+#[uniffi::export]pub fn apply_chat_template(model: Arc<ModelHandle>,diff --git a/rust/apps/ensu/src-tauri/Cargo.toml b/rust/apps/ensu/src-tauri/Cargo.tomlindex 625231ad52..ea68b17d31 100644--- a/rust/apps/ensu/src-tauri/Cargo.toml+++ b/rust/apps/ensu/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "ensu-tauri"-version = "0.1.9"+version = "0.1.10"description = "Ensu Desktop (Tauri)"edition = "2021"diff --git a/rust/ensu/inference/src/defaults.rs b/rust/ensu/inference/src/defaults.rsindex 3eef9926d7..43a51178d4 100644--- a/rust/ensu/inference/src/defaults.rs+++ b/rust/ensu/inference/src/defaults.rs@@ -58,9 +58,33 @@ fn qwen_0_8b() -> EnsuModelPreset {}}+fn qwen_2b_q8() -> EnsuModelPreset {+ EnsuModelPreset {+ id: "qwen-2b-q8".to_string(),+ title: "Qwen 3.5 2B (Q8_0)".to_string(),+ url: "https://huggingface.co/unsloth/Qwen3.5-2B-GGUF/resolve/main/Qwen3.5-2B-Q8_0.gguf?download=true".to_string(),+ mmproj_url: Some(+ "https://huggingface.co/unsloth/Qwen3.5-2B-GGUF/resolve/main/mmproj-F16.gguf"+ .to_string(),+ ),+ }+}++fn qwen_4b_q4km() -> EnsuModelPreset {+ EnsuModelPreset {+ id: "qwen-4b-q4km".to_string(),+ title: "Qwen 3.5 4B (Q4_K_M)".to_string(),+ url: "https://huggingface.co/unsloth/Qwen3.5-4B-GGUF/resolve/main/Qwen3.5-4B-Q4_K_M.gguf?download=true".to_string(),+ mmproj_url: Some(+ "https://huggingface.co/unsloth/Qwen3.5-4B-GGUF/resolve/main/mmproj-F16.gguf"+ .to_string(),+ ),+ }+}+pub fn ensu_defaults() -> EnsuDefaults {let mobile_default_model = lfm_vl_1_6b();- let desktop_default_model = lfm_vl_1_6b();+ let desktop_default_model = qwen_4b_q4km();EnsuDefaults {mobile_system_prompt_body: MOBILE_SYSTEM_PROMPT_BODY.to_string(),@@ -68,8 +92,8 @@ pub fn ensu_defaults() -> EnsuDefaults {system_prompt_date_placeholder: SYSTEM_PROMPT_DATE_PLACEHOLDER.to_string(),session_summary_system_prompt: SESSION_SUMMARY_SYSTEM_PROMPT.to_string(),mobile_default_model,- mobile_model_presets: vec![lfm_1_2b(), qwen_0_8b()],+ mobile_model_presets: vec![lfm_1_2b(), qwen_0_8b(), qwen_2b_q8()],desktop_default_model,- desktop_model_presets: vec![lfm_1_2b(), qwen_0_8b()],+ desktop_model_presets: vec![lfm_vl_1_6b(), lfm_1_2b(), qwen_0_8b(), qwen_2b_q8()],}}diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsxindex a862680ad2..ef7fd3625b 100644--- a/web/apps/ensu/src/pages/chat.tsx+++ b/web/apps/ensu/src/pages/chat.tsx@@ -1882,6 +1882,30 @@ const Page: React.FC = () => {const displayMessages = useMemo(() => {const base = messageState.path ?? [];+ // Insert synthetic "Response was interrupted" placeholders for orphaned user messages+ const augmented: ChatMessage[] = [];+ for (let i = 0; i < base.length; i++) {+ const msg = base[i];+ augmented.push(msg);+ if (msg.sender === "self") {+ const next = base[i + 1];+ const isLastAndGenerating =+ i === base.length - 1 && isGenerating;+ if (+ next?.sender !== "assistant" &&+ !isLastAndGenerating+ ) {+ augmented.push({+ messageUuid: `interrupted-placeholder-${msg.messageUuid}`,+ sessionUuid: msg.sessionUuid,+ parentMessageUuid: msg.messageUuid,+ sender: "assistant",+ text: "Response was interrupted",+ createdAt: msg.createdAt,+ });+ }+ }+ }if (streamingParentId) {const streamingMessage: ChatMessage = {messageUuid: STREAMING_SELECTION_KEY,@@ -1891,10 +1915,10 @@ const Page: React.FC = () => {text: streamingText,createdAt: streamingCreatedAtRef.current ?? Date.now() * 1000,};- return [...base, streamingMessage];+ return [...augmented, streamingMessage];}- return base;- }, [messageState.path, streamingParentId, streamingText, currentSessionId]);+ return augmented;+ }, [messageState.path, streamingParentId, streamingText, currentSessionId, isGenerating]);const branchSwitchers = messageState.switchers;diff --git a/web/apps/ensu/src/services/llm/provider.ts b/web/apps/ensu/src/services/llm/provider.tsindex dae4f04611..48e5b52143 100644--- a/web/apps/ensu/src/services/llm/provider.ts+++ b/web/apps/ensu/src/services/llm/provider.ts@@ -27,18 +27,9 @@ export const DEFAULT_MODEL: ModelInfo = {sizeHuman: "~664 MB",};-const TAURI_DEFAULT_MODEL: ModelInfo = {- id: "qwen-3.5-2b-q8_0",- name: "Qwen 3.5 2B (Q8_0)",- url: "https://huggingface.co/unsloth/Qwen3.5-2B-GGUF/resolve/main/Qwen3.5-2B-Q8_0.gguf?download=true",- mmprojUrl:- "https://huggingface.co/unsloth/Qwen3.5-2B-GGUF/resolve/main/mmproj-F16.gguf",- sizeBytes: 2_012_012_800,- mmprojSizeBytes: 668_227_264,- sizeHuman: "2.68 GB",-};+const TAURI_DEFAULT_MODEL: ModelInfo = DEFAULT_MODEL;-const HIGH_RAM_MAC_MODEL: ModelInfo = {+const DESKTOP_DEFAULT_MODEL: ModelInfo = {id: "qwen-3.5-4b-q4km",name: "Qwen 3.5 4B (Q4_K_M)",url: "https://huggingface.co/unsloth/Qwen3.5-4B-GGUF/resolve/main/Qwen3.5-4B-Q4_K_M.gguf?download=true",@@ -364,7 +355,9 @@ export class LlmProvider {private async resolveDefaultModelForDevice() {this.defaultModel =- this.backend.kind === "tauri" ? TAURI_DEFAULT_MODEL : DEFAULT_MODEL;+ this.backend.kind === "tauri"+ ? TAURI_DEFAULT_MODEL+ : DEFAULT_MODEL;if (this.backend.kind !== "tauri") {return;@@ -386,7 +379,7 @@ export class LlmProvider {platform === "mac";if (isMacPlatform && totalMemoryBytes >= MIN_HIGH_RAM_MAC_BYTES) {- this.defaultModel = HIGH_RAM_MAC_MODEL;+ this.defaultModel = DESKTOP_DEFAULT_MODEL;}log.info("LLM default model resolved", {