Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,9 @@ class AccessibilityNotificationsManager: ObservableObject {
let selectedElement = element,
!selectedText.isEmpty
else {

selectedSource = nil
model?.pendingInput = nil
HighlightHintWindowController.shared.hide()

return
}
screenResult.userInteraction.selectedText = selectedText
Expand Down
21 changes: 21 additions & 0 deletions macos/Onit/Assets.xcassets/Icons/incog-off.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "incog-off.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions macos/Onit/Assets.xcassets/Icons/incog-on.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "incog-on.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion macos/Onit/Data/Model/Model+Chat.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ extension OnitModel {
currentPrompts = []
SystemPromptState.shared.shouldShowSystemPrompt = false
let modelContext = container.mainContext
modelContext.insert(currentChat!)

if !Defaults[.incognitoModeEnabled] { modelContext.insert(currentChat!) }

finishPromptCreation(prompt)
}
Expand Down
1 change: 1 addition & 0 deletions macos/Onit/Data/Persistence/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ extension Defaults.Keys {
static let availableRemoteModels = Key<[AIModel]>("availableRemoteModels", default: [])
static let availableCustomProviders = Key<[CustomProvider]>(
"availableCustomProvider", default: [])
static let incognitoModeEnabled = Key<Bool>("incognitoModeEnabled", default: false)

// Stores unique model identifiers in the format "provider-id" or "customProviderName-id" for custom providers
static let visibleModelIds = Key<Set<String>>("visibleModelIds", default: Set([]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct KeyboardShortcutsManager {
PostHogSDK.shared.capture(
"shortcut_launch_with_auto_context", properties: eventProperties)
model.addAutoContext()

if (model.panel == nil) {
model.launchPanel()
}
Expand Down
1 change: 1 addition & 0 deletions macos/Onit/UI/Chat/ChatView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ struct ChatView: View {

var body: some View {
VStack(alignment: .leading, spacing: 0) {
IncognitoDismissable()
SetUpDialogs()
if let systemPrompt = model.currentChat?.systemPrompt {
ChatSystemPromptView(systemPrompt: systemPrompt)
Expand Down
67 changes: 67 additions & 0 deletions macos/Onit/UI/Dismissables/IncognitoDismissable.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
//
// IncognitoDismissable.swift
// Onit
//
// Created by Loyd Kim on 4/7/25.
//

import Defaults
import SwiftUI

struct IncognitoDismissable: View {
@AppStorage("closedIncognitoDismissable") private var closedIncognitoDismissable = false
@Default(.incognitoModeEnabled) var incognitoModeEnabled

@State var closeHovered: Bool = false

var body: some View {
if incognitoModeEnabled && !closedIncognitoDismissable {
VStack(alignment: .leading, spacing: 6) {
title
text
}
.padding(14)
.background(.gray900)
.overlay(
RoundedRectangle(cornerRadius: 16)
.inset(by: 0.5)
.stroke(Color(red: 0.28, green: 0.29, blue: 0.31), lineWidth: 1)
)
.cornerRadius(16)
.padding(.vertical, 8)
.padding(.horizontal, 14)
}
}
}


/// Child Components
extension IncognitoDismissable {
var title: some View {
HStack {
Text("Incognito Mode")
.foregroundColor(.white)
.font(.system(size: 14, weight: .semibold))

Spacer()

Button {
closedIncognitoDismissable = true
} label: {
Image(.smallCross)
.renderingMode(.template)
.foregroundStyle(.white)
.frame(width: 10, height: 10)
}
.opacity(closeHovered ? 0.5 : 1)
.animation(.easeInOut(duration: 0.15), value: closeHovered)
.onHover{ isHovering in closeHovered = isHovering}
}
}

var text: some View {
Text("When on, Onit won’t store your chats in history.")
.foregroundColor(.gray100)
.font(.system(size: 13, weight: .medium))
}
}
4 changes: 4 additions & 0 deletions macos/Onit/UI/History/HistoryRowView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
// Created by Benjamin Sage on 11/4/24.
//

import Defaults
import SwiftUI

struct HistoryRowView: View {
@Default(.incognitoModeEnabled) var incognitoModeEnabled

@Environment(\.model) var model

@State private var showDelete: Bool = false
Expand All @@ -17,6 +20,7 @@ struct HistoryRowView: View {

var body: some View {
Button {
incognitoModeEnabled = false
model.setChat(chat: chat, index: index)
} label: {
HStack {
Expand Down
5 changes: 4 additions & 1 deletion macos/Onit/UI/OS/ContextPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ struct ContextPickerView: View {
model.addAutoContext()
}) {
ContextPickerItemView(
imageRes: .stars, title: "Auto-context", subtitle: "Current window activity")
imageRes: .stars,
title: "Auto-context",
subtitle: "Current window activity"
)
}
.buttonStyle(.plain)
.foregroundColor(.gray200)
Expand Down
15 changes: 15 additions & 0 deletions macos/Onit/UI/Prompt/Toolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Toolbar: View {
@Default(.localModel) var localModel
@Default(.isRegularApp) var isRegularApp
@Default(.fitActiveWindow) var fitActiveWindow
@Default(.incognitoModeEnabled) var incognitoModeEnabled

private var isAccessibilityFlagsEnabled: Bool {
featureFlagsManager.accessibility && featureFlagsManager.accessibilityAutoContext
Expand Down Expand Up @@ -59,6 +60,7 @@ struct Toolbar: View {
fitActiveWindowButton
}
localMode
incognitoMode
history
settings

Expand Down Expand Up @@ -242,6 +244,19 @@ struct Toolbar: View {
}
.tooltip(prompt: "Local Mode", shortcut: .keyboardShortcuts(.toggleLocalMode))
}

var incognitoMode: some View {
Button {
incognitoModeEnabled.toggle()
model.newChat()
} label: {
Image(incognitoModeEnabled ? .incogOn : .incogOff)
.renderingMode(.template)
.padding(4)
.foregroundColor(incognitoModeEnabled ? .blue400 : .gray200)
}
.tooltip(prompt: "Incognito mode (auto-context off)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't say "auto-context off" since incognito just means it doesn't get added to history

}

var showHistoryBinding: Binding<Bool> {
Binding(
Expand Down