From 75e5b40f4554835c36394c64e3b9fc5260d6756a Mon Sep 17 00:00:00 2001 From: Rune Olsen Date: Sun, 19 Jul 2026 16:01:04 +0200 Subject: [PATCH] Persist sidebar visibility; add language-matching rule to default prompt - ContentView now reads/writes SettingsService.sidebarVisible so the NavigationSplitView sidebar's shown/hidden state survives relaunch, matching the existing window size/position persistence. - Default system prompt gains a rule: always reply in the user's language, even for requests (e.g. translation) targeting another one. --- oAI/ViewModels/ChatViewModel.swift | 1 + oAI/Views/Main/ContentView.swift | 6 +++++- oAI/Views/Screens/SettingsView.swift | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/oAI/ViewModels/ChatViewModel.swift b/oAI/ViewModels/ChatViewModel.swift index ecc2dc8..7b3f88e 100644 --- a/oAI/ViewModels/ChatViewModel.swift +++ b/oAI/ViewModels/ChatViewModel.swift @@ -90,6 +90,7 @@ You are a helpful AI assistant. Follow these core principles: - **Be Direct**: Provide concise, relevant answers. No unnecessary preambles. - **Show Your Work**: If you use capabilities (tools, web search, etc.), demonstrate what you did. - **Complete Tasks Properly**: If you start something, finish it correctly. +- **Match the User's Language**: Always reply in the same language the user is writing in, even when the request itself involves another language (e.g. a translation or spelling request) — the target language applies to the content you produce, not to your own reply. ## FORMATTING diff --git a/oAI/Views/Main/ContentView.swift b/oAI/Views/Main/ContentView.swift index a823094..f2d740b 100644 --- a/oAI/Views/Main/ContentView.swift +++ b/oAI/Views/Main/ContentView.swift @@ -29,7 +29,8 @@ import Darwin // uname, sysctlbyname struct ContentView: View { @Environment(ChatViewModel.self) var chatViewModel private var updateService = UpdateCheckService.shared - @State private var columnVisibility: NavigationSplitViewVisibility = .all + @State private var columnVisibility: NavigationSplitViewVisibility = + SettingsService.shared.sidebarVisible ? .all : .detailOnly @State private var showIntelWarning = false var body: some View { @@ -46,6 +47,9 @@ struct ContentView: View { ) } .frame(minWidth: 860, minHeight: 560) + .onChange(of: columnVisibility) { _, newValue in + SettingsService.shared.sidebarVisible = newValue != .detailOnly + } #if os(macOS) .onAppear { NSApplication.shared.windows.forEach { $0.tabbingMode = .disallowed } diff --git a/oAI/Views/Screens/SettingsView.swift b/oAI/Views/Screens/SettingsView.swift index 809667b..5911fee 100644 --- a/oAI/Views/Screens/SettingsView.swift +++ b/oAI/Views/Screens/SettingsView.swift @@ -125,6 +125,7 @@ You are a helpful AI assistant. Follow these core principles: - **Be Direct**: Provide concise, relevant answers. No unnecessary preambles. - **Show Your Work**: If you use capabilities (tools, web search, etc.), demonstrate what you did. - **Complete Tasks Properly**: If you start something, finish it correctly. +- **Match the User's Language**: Always reply in the same language the user is writing in, even when the request itself involves another language (e.g. a translation or spelling request) — the target language applies to the content you produce, not to your own reply. ## FORMATTING