Skip to content

Commit

Permalink
merge: completions
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustDev committed Apr 27, 2024
2 parents ada9bf7 + 102858b commit 0260d88
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Enchanted.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
3396E0762BD877D500213816 /* Menus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3396E0752BD877D500213816 /* Menus.swift */; };
FF0146CB2B3DA1DF00A2A9F6 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF0146CA2B3DA1DF00A2A9F6 /* Settings.swift */; };
FF0146CD2B3DADCA00A2A9F6 /* HapticsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF0146CC2B3DADCA00A2A9F6 /* HapticsService.swift */; };
FF1002302B2482BA0011A4DC /* ChatMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF10022F2B2482BA0011A4DC /* ChatMessageView.swift */; };
Expand Down Expand Up @@ -94,6 +95,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3396E0752BD877D500213816 /* Menus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menus.swift; sourceTree = "<group>"; };
FF0146CA2B3DA1DF00A2A9F6 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
FF0146CC2B3DADCA00A2A9F6 /* HapticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HapticsService.swift; sourceTree = "<group>"; };
FF10022F2B2482BA0011A4DC /* ChatMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -325,6 +327,7 @@
FF66A51E2B77788D00FAAC1E /* macOS */ = {
isa = PBXGroup;
children = (
3396E0752BD877D500213816 /* Menus.swift */,
FF9300D52B778F1A000859F4 /* Chat */,
FF6D821A2B9141F0001183A8 /* CompletionsEditor */,
FF464B172B810966008E5130 /* Components */,
Expand Down Expand Up @@ -662,6 +665,7 @@
FF10024E2B25C2A70011A4DC /* ConversationSD.swift in Sources */,
FFEC32912B24779A003E5C04 /* EnchantedApp.swift in Sources */,
FF2F03422B795E0B00349855 /* Clipboard.swift in Sources */,
3396E0762BD877D500213816 /* Menus.swift in Sources */,
FF9300DA2B781D97000859F4 /* ToolbarView_macOS.swift in Sources */,
FF1002522B2609980011A4DC /* ModelContext+Extension.swift in Sources */,
FF1002752B278C170011A4DC /* AppStore.swift in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Enchanted/Application/EnchantedApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ struct EnchantedApp: App {
NSWindow.allowsAutomaticWindowTabbing = false
}
#endif
}.commands {
Menus()
}
#if os(macOS)
Window("Keyboard Shortcuts", id: "keyboard-shortcuts") {
Expand Down
1 change: 1 addition & 0 deletions Enchanted/UI/Shared/Sidebar/SidebarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct SidebarView: View {

}
.padding()
.focusedSceneValue(\.showSettings, $showSettings)
.sheet(isPresented: $showSettings) {
Settings()
}
Expand Down
35 changes: 35 additions & 0 deletions Enchanted/UI/macOS/Menus.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Menus.swift
// Enchanted
//
// Created by Wildan Zulfikar on 24.4.2024.
//

import Foundation
import SwiftUI

#if os(macOS)
struct ShowSettingsKey: FocusedValueKey {
typealias Value = Binding<Bool>
}

extension FocusedValues {
var showSettings: Binding<Bool>? {
get { self[ShowSettingsKey.self] }
set { self[ShowSettingsKey.self] = newValue }
}
}

struct Menus: Commands {
@FocusedValue(\.showSettings) var showSettings

var body: some Commands {
CommandGroup(replacing: .appSettings) {
Button("Settings") {
showSettings?.wrappedValue = true
}
.keyboardShortcut(",", modifiers: .command)
}
}
}
#endif
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ You're done! Make a prompt.
2. Install ngrok forward your Ollama server to make it accessible publicly

```shell
ngrok http 11434
ngrok http 11434 --host-header="localhost:11434"
```

3. Copy "Forwarding" URL that will look something like `https://b377-82-132-216-51.ngrok-free.app`. Your Ollama server API is now accessible through this temporary URL.
Expand Down

0 comments on commit 0260d88

Please sign in to comment.