From cff78d3080495418024afb7147af77c80afad3ee Mon Sep 17 00:00:00 2001 From: Augustinas Malinauskas Date: Sun, 14 Apr 2024 14:48:08 +0100 Subject: [PATCH 1/2] Update README.md ngrok command updated to specify host header --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b7f3894..b904c3a 100644 --- a/README.md +++ b/README.md @@ -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. From 102858b4ae3bf2cd1d1e97805de70e3e5d543113 Mon Sep 17 00:00:00 2001 From: Wildan Zulfikar Date: Sat, 27 Apr 2024 10:57:45 +0300 Subject: [PATCH 2/2] Add menu item to open Settings (#79) * Add menu item to open settings --- Enchanted.xcodeproj/project.pbxproj | 8 +++-- Enchanted/Application/EnchantedApp.swift | 2 ++ Enchanted/UI/Shared/Sidebar/SidebarView.swift | 1 + Enchanted/UI/macOS/Menus.swift | 35 +++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 Enchanted/UI/macOS/Menus.swift diff --git a/Enchanted.xcodeproj/project.pbxproj b/Enchanted.xcodeproj/project.pbxproj index cbb46c7..493455b 100644 --- a/Enchanted.xcodeproj/project.pbxproj +++ b/Enchanted.xcodeproj/project.pbxproj @@ -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 */; }; @@ -94,6 +95,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 3396E0752BD877D500213816 /* Menus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Menus.swift; sourceTree = ""; }; FF0146CA2B3DA1DF00A2A9F6 /* Settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; FF0146CC2B3DADCA00A2A9F6 /* HapticsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HapticsService.swift; sourceTree = ""; }; FF10022F2B2482BA0011A4DC /* ChatMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessageView.swift; sourceTree = ""; }; @@ -324,6 +326,7 @@ FF66A51E2B77788D00FAAC1E /* macOS */ = { isa = PBXGroup; children = ( + 3396E0752BD877D500213816 /* Menus.swift */, FF9300D52B778F1A000859F4 /* Chat */, FF6D821A2B9141F0001183A8 /* CompletionsEditor */, FF464B172B810966008E5130 /* Components */, @@ -660,6 +663,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 */, @@ -798,7 +802,7 @@ CODE_SIGN_ENTITLEMENTS = Enchanted/Enchanted.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Enchanted/Preview Content\""; DEVELOPMENT_TEAM = JDDZ55DT74; @@ -847,7 +851,7 @@ CODE_SIGN_ENTITLEMENTS = Enchanted/Enchanted.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 22; + CURRENT_PROJECT_VERSION = 23; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Enchanted/Preview Content\""; DEVELOPMENT_TEAM = JDDZ55DT74; diff --git a/Enchanted/Application/EnchantedApp.swift b/Enchanted/Application/EnchantedApp.swift index ce4666c..8eedbb5 100644 --- a/Enchanted/Application/EnchantedApp.swift +++ b/Enchanted/Application/EnchantedApp.swift @@ -34,6 +34,8 @@ struct EnchantedApp: App { NSWindow.allowsAutomaticWindowTabbing = false } #endif + }.commands { + Menus() } #if os(macOS) Window("Keyboard Shortcuts", id: "keyboard-shortcuts") { diff --git a/Enchanted/UI/Shared/Sidebar/SidebarView.swift b/Enchanted/UI/Shared/Sidebar/SidebarView.swift index 3be4ac4..dbb8fd7 100644 --- a/Enchanted/UI/Shared/Sidebar/SidebarView.swift +++ b/Enchanted/UI/Shared/Sidebar/SidebarView.swift @@ -48,6 +48,7 @@ struct SidebarView: View { } .padding() + .focusedSceneValue(\.showSettings, $showSettings) .sheet(isPresented: $showSettings) { Settings() } diff --git a/Enchanted/UI/macOS/Menus.swift b/Enchanted/UI/macOS/Menus.swift new file mode 100644 index 0000000..fbbaec5 --- /dev/null +++ b/Enchanted/UI/macOS/Menus.swift @@ -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 +} + +extension FocusedValues { + var showSettings: Binding? { + 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