Skip to content
Open

wip #159

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
8 changes: 8 additions & 0 deletions TypeaheadAI.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
2B0B300A2ACD6E6B00338B76 /* UserIntentsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30092ACD6E6B00338B76 /* UserIntentsView.swift */; };
2B0B300E2ACEB0E000338B76 /* GenericTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B300D2ACEB0E000338B76 /* GenericTableView.swift */; };
2B0B30102ACF8C8000338B76 /* SpecialOpenActor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B300F2ACF8C8000338B76 /* SpecialOpenActor.swift */; };
2B0B30152ADC978300338B76 /* QuickActionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30142ADC978300338B76 /* QuickActionsView.swift */; };
2B0B30172ADCA09F00338B76 /* CustomWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */; };
2B27450A2AB01CF400F37D3E /* SpecialSaveActor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B2745092AB01CF400F37D3E /* SpecialSaveActor.swift */; };
2B27450E2AB0380C00F37D3E /* AppContextManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B27450D2AB0380C00F37D3E /* AppContextManager.swift */; };
2B2745102AB03A3D00F37D3E /* CanSimulateCopy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2B27450F2AB03A3D00F37D3E /* CanSimulateCopy.swift */; };
Expand Down Expand Up @@ -89,6 +91,8 @@
2B0B30092ACD6E6B00338B76 /* UserIntentsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserIntentsView.swift; sourceTree = "<group>"; };
2B0B300D2ACEB0E000338B76 /* GenericTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GenericTableView.swift; sourceTree = "<group>"; };
2B0B300F2ACF8C8000338B76 /* SpecialOpenActor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialOpenActor.swift; sourceTree = "<group>"; };
2B0B30142ADC978300338B76 /* QuickActionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QuickActionsView.swift; sourceTree = "<group>"; };
2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomWindowController.swift; sourceTree = "<group>"; };
2B2745092AB01CF400F37D3E /* SpecialSaveActor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpecialSaveActor.swift; sourceTree = "<group>"; };
2B27450D2AB0380C00F37D3E /* AppContextManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppContextManager.swift; sourceTree = "<group>"; };
2B27450F2AB03A3D00F37D3E /* CanSimulateCopy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanSimulateCopy.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -302,6 +306,7 @@
2BA7F0B02A9ABCA5003D38BA /* MenuPromptView.swift */,
2BA7F0B22A9ABCBF003D38BA /* MenuView.swift */,
2B0B30072ACCDA1100338B76 /* VisualEffect.swift */,
2B0B30162ADCA09F00338B76 /* CustomWindowController.swift */,
);
path = Views;
sourceTree = "<group>";
Expand All @@ -315,6 +320,7 @@
2B33D87C2AAC3330001193A2 /* ProfileView.swift */,
2BC5271B2ABD9C8200173E12 /* HistoryListView.swift */,
2B520D842AC82EA100310426 /* AccountView.swift */,
2B0B30142ADC978300338B76 /* QuickActionsView.swift */,
);
path = Settings;
sourceTree = "<group>";
Expand Down Expand Up @@ -506,6 +512,7 @@
2B0B30102ACF8C8000338B76 /* SpecialOpenActor.swift in Sources */,
2BA7F0822A9ABBA8003D38BA /* Persistence.swift in Sources */,
2B473E892AA85BDD0042913D /* LlamaModelManager.swift in Sources */,
2B0B30152ADC978300338B76 /* QuickActionsView.swift in Sources */,
2BA7F0B32A9ABCBF003D38BA /* MenuView.swift in Sources */,
2B92BDBB2AA3D10800E65CFA /* ModalManager.swift in Sources */,
2BCF843A2A9DE6DA00359841 /* GeneralSettingsView.swift in Sources */,
Expand All @@ -515,6 +522,7 @@
2B4BDB8B2ACC281E00E55D78 /* IntentManager.swift in Sources */,
2BF929872AB16C4C00FC105B /* ResponseParsingTask.swift in Sources */,
2B2EF1502AC40C8F00EF2BD4 /* ChatBubble.swift in Sources */,
2B0B30172ADCA09F00338B76 /* CustomWindowController.swift in Sources */,
2BC5271C2ABD9C8200173E12 /* HistoryListView.swift in Sources */,
2B37922F2AB8371A008D812F /* SpecialPasteActor.swift in Sources */,
2B0B300A2ACD6E6B00338B76 /* UserIntentsView.swift in Sources */,
Expand Down
30 changes: 30 additions & 0 deletions TypeaheadAI/Views/CustomWindowController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// CustomWindowController.swift
// TypeaheadAI
//
// Created by Jeff Hara on 10/15/23.
//

import AppKit
import Foundation
import Cocoa
import SwiftUI

class CustomViewController: NSViewController {

override func viewDidLoad() {
super.viewDidLoad()
}
}

struct CustomViewControllerRepresentable: NSViewControllerRepresentable {
typealias NSViewControllerType = CustomViewController

func makeNSViewController(context: Context) -> CustomViewController {
return CustomViewController()
}

func updateNSViewController(_ nsViewController: CustomViewController, context: Context) {
// Update any properties or configurations of the NSViewController here if needed
}
}
45 changes: 45 additions & 0 deletions TypeaheadAI/Views/Settings/QuickActionsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// QuickActionsView.swift
// TypeaheadAI
//
// Created by Jeff Hara on 10/15/23.
//

import SwiftUI

struct QuickActionsView: View {
@ObservedObject var promptManager: PromptManager
@Environment(\.managedObjectContext) private var viewContext

var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}

#Preview {
// Create an in-memory Core Data store
let container = NSPersistentContainer(name: "TypeaheadAI")
container.persistentStoreDescriptions.first?.url = URL(fileURLWithPath: "/dev/null")
container.loadPersistentStores { _, error in
if let error = error as NSError? {
fatalError("Unresolved error \(error), \(error.userInfo)")
}
}

let context = container.viewContext
let promptManager = PromptManager(context: context)

// Create some sample prompts
let samplePrompts = ["this is a sample prompt", "this is an active prompt"]
for prompt in samplePrompts {
let newPrompt = PromptEntry(context: context)
newPrompt.prompt = prompt
promptManager.addPrompt(prompt)
}

return QuickActionsView(
promptManager: promptManager
)
.environment(\.managedObjectContext, context)
.frame(width: 600, height: 400)
}
5 changes: 5 additions & 0 deletions TypeaheadAI/Views/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import SwiftUI
enum Tab: String, CaseIterable, Identifiable {
case general = "General"
case profile = "Profile"
case quickActions = "Quick Actions"
case history = "History"
case incognito = "Incognito Mode"
case account = "Account Settings"
Expand All @@ -30,9 +31,11 @@ struct SettingsView: View {
}
.listStyle(SidebarListStyle())
.frame(minWidth: 200)
.background(VisualEffect().ignoresSafeArea())

viewForTab(settingsTab)
}
.background(VisualEffect().ignoresSafeArea())
}

private func viewForTab(_ tab: String) -> some View {
Expand All @@ -45,6 +48,8 @@ struct SettingsView: View {
return AnyView(ProfileView())
case .general:
return AnyView(GeneralSettingsView(promptManager: promptManager))
case .quickActions:
return AnyView(QuickActionsView(promptManager: promptManager))
case .history:
return AnyView(HistoryListView())
case .incognito:
Expand Down
9 changes: 8 additions & 1 deletion TypeaheadAI/Views/VisualEffect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import Foundation
import SwiftUI

struct VisualEffect: NSViewRepresentable {
func makeNSView(context: Self.Context) -> NSView { return NSVisualEffectView() }
func makeNSView(context: Self.Context) -> NSView {
let view = NSVisualEffectView()
view.blendingMode = .behindWindow
view.state = .active
view.material = .hudWindow
return view
}

func updateNSView(_ nsView: NSView, context: Context) { }
}