From 0575d12c44d170252d72f643dfbe629a5f21adce Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Mon, 14 Aug 2023 21:04:40 +0800 Subject: [PATCH 1/3] Allow disable function calling in advanced settings --- Core/Sources/HostApp/DebugView.swift | 12 ++++++++---- Tool/Sources/OpenAIService/CompletionStreamAPI.swift | 9 +++++++-- Tool/Sources/Preferences/Keys.swift | 4 ++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Core/Sources/HostApp/DebugView.swift b/Core/Sources/HostApp/DebugView.swift index 59afa477..c49221de 100644 --- a/Core/Sources/HostApp/DebugView.swift +++ b/Core/Sources/HostApp/DebugView.swift @@ -11,6 +11,7 @@ final class DebugSettings: ObservableObject { @AppStorage(\.alwaysAcceptSuggestionWithAccessibilityAPI) var alwaysAcceptSuggestionWithAccessibilityAPI @AppStorage(\.enableXcodeInspectorDebugMenu) var enableXcodeInspectorDebugMenu + @AppStorage(\.disableFunctionCalling) var disableFunctionCalling init() {} } @@ -21,13 +22,13 @@ struct DebugSettingsView: View { ScrollView { Form { Toggle(isOn: $settings.animationACrashSuggestion) { - Text("Enable Animation A") + Text("Enable animation A") } Toggle(isOn: $settings.animationBCrashSuggestion) { - Text("Enable Animation B") + Text("Enable animation B") } Toggle(isOn: $settings.animationCCrashSuggestion) { - Text("Enable Widget Breathing Animation") + Text("Enable widget breathing animation") } Toggle(isOn: $settings.preCacheOnFileOpen) { Text("Cache editor information on file open") @@ -39,11 +40,14 @@ struct DebugSettingsView: View { Text("Trigger command with AccessibilityAPI") } Toggle(isOn: $settings.alwaysAcceptSuggestionWithAccessibilityAPI) { - Text("Always accept suggestion with AccessibilityAPI") + Text("Always accept suggestion with Accessibility API") } Toggle(isOn: $settings.enableXcodeInspectorDebugMenu) { Text("Enable Xcode inspector debug menu") } + Toggle(isOn: $settings.disableFunctionCalling) { + Text("Disable function calling for chat feature") + } } .padding() } diff --git a/Tool/Sources/OpenAIService/CompletionStreamAPI.swift b/Tool/Sources/OpenAIService/CompletionStreamAPI.swift index 3be74435..6b39734b 100644 --- a/Tool/Sources/OpenAIService/CompletionStreamAPI.swift +++ b/Tool/Sources/OpenAIService/CompletionStreamAPI.swift @@ -117,8 +117,13 @@ struct CompletionRequestBody: Encodable, Equatable { self.frequency_penalty = frequency_penalty self.logit_bias = logit_bias self.user = user - self.function_call = function_call - self.functions = functions.isEmpty ? nil : functions + if UserDefaults.shared.value(for: \.disableFunctionCalling) { + self.function_call = nil + self.functions = nil + } else { + self.function_call = function_call + self.functions = functions.isEmpty ? nil : functions + } } } diff --git a/Tool/Sources/Preferences/Keys.swift b/Tool/Sources/Preferences/Keys.swift index e16070c3..218bf5fe 100644 --- a/Tool/Sources/Preferences/Keys.swift +++ b/Tool/Sources/Preferences/Keys.swift @@ -401,5 +401,9 @@ public extension UserDefaultPreferenceKeys { var enableXcodeInspectorDebugMenu: FeatureFlag { .init(defaultValue: false, key: "FeatureFlag-EnableXcodeInspectorDebugMenu") } + + var disableFunctionCalling: FeatureFlag { + .init(defaultValue: false, key: "FeatureFlag-DisableFunctionCalling") + } } From 659c6e81944bc35118f1aa3c35455ac65206cbe8 Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Mon, 14 Aug 2023 21:22:09 +0800 Subject: [PATCH 2/3] Bump version to 0.21.2 --- Version.xcconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Version.xcconfig b/Version.xcconfig index ae69d64e..2d1eafad 100644 --- a/Version.xcconfig +++ b/Version.xcconfig @@ -1,2 +1,2 @@ -APP_VERSION = 0.21.1 -APP_BUILD = 221 +APP_VERSION = 0.21.2 +APP_BUILD = 222 From bacb2ea1f8b850b99e5dc7100635de9b2c8f8cf3 Mon Sep 17 00:00:00 2001 From: Shx Guo Date: Mon, 14 Aug 2023 21:22:16 +0800 Subject: [PATCH 3/3] Update appcast.xml --- appcast.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/appcast.xml b/appcast.xml index 37a7e2d0..df2e9022 100644 --- a/appcast.xml +++ b/appcast.xml @@ -3,6 +3,18 @@ Copilot for Xcode + + 0.21.2 + Mon, 14 Aug 2023 21:20:30 +0800 + 222 + 0.21.2 + 12.0 + + https://github.com/intitni/CopilotForXcode/releases/tag/0.21.2 + + + + 0.21.1 Sun, 13 Aug 2023 17:02:38 +0800