Skip to content

Commit efd5c7b

Browse files
committed
Merge tag 'allow-disabling-function-calling' into develop
2 parents fe04f9d + 55db924 commit efd5c7b

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

Core/Sources/HostApp/DebugView.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ final class DebugSettings: ObservableObject {
1111
@AppStorage(\.alwaysAcceptSuggestionWithAccessibilityAPI)
1212
var alwaysAcceptSuggestionWithAccessibilityAPI
1313
@AppStorage(\.enableXcodeInspectorDebugMenu) var enableXcodeInspectorDebugMenu
14+
@AppStorage(\.disableFunctionCalling) var disableFunctionCalling
1415
init() {}
1516
}
1617

@@ -21,13 +22,13 @@ struct DebugSettingsView: View {
2122
ScrollView {
2223
Form {
2324
Toggle(isOn: $settings.animationACrashSuggestion) {
24-
Text("Enable Animation A")
25+
Text("Enable animation A")
2526
}
2627
Toggle(isOn: $settings.animationBCrashSuggestion) {
27-
Text("Enable Animation B")
28+
Text("Enable animation B")
2829
}
2930
Toggle(isOn: $settings.animationCCrashSuggestion) {
30-
Text("Enable Widget Breathing Animation")
31+
Text("Enable widget breathing animation")
3132
}
3233
Toggle(isOn: $settings.preCacheOnFileOpen) {
3334
Text("Cache editor information on file open")
@@ -39,11 +40,14 @@ struct DebugSettingsView: View {
3940
Text("Trigger command with AccessibilityAPI")
4041
}
4142
Toggle(isOn: $settings.alwaysAcceptSuggestionWithAccessibilityAPI) {
42-
Text("Always accept suggestion with AccessibilityAPI")
43+
Text("Always accept suggestion with Accessibility API")
4344
}
4445
Toggle(isOn: $settings.enableXcodeInspectorDebugMenu) {
4546
Text("Enable Xcode inspector debug menu")
4647
}
48+
Toggle(isOn: $settings.disableFunctionCalling) {
49+
Text("Disable function calling for chat feature")
50+
}
4751
}
4852
.padding()
4953
}

Tool/Sources/OpenAIService/CompletionStreamAPI.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,13 @@ struct CompletionRequestBody: Encodable, Equatable {
117117
self.frequency_penalty = frequency_penalty
118118
self.logit_bias = logit_bias
119119
self.user = user
120-
self.function_call = function_call
121-
self.functions = functions.isEmpty ? nil : functions
120+
if UserDefaults.shared.value(for: \.disableFunctionCalling) {
121+
self.function_call = nil
122+
self.functions = nil
123+
} else {
124+
self.function_call = function_call
125+
self.functions = functions.isEmpty ? nil : functions
126+
}
122127
}
123128
}
124129

Tool/Sources/Preferences/Keys.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,5 +405,9 @@ public extension UserDefaultPreferenceKeys {
405405
var enableXcodeInspectorDebugMenu: FeatureFlag {
406406
.init(defaultValue: false, key: "FeatureFlag-EnableXcodeInspectorDebugMenu")
407407
}
408+
409+
var disableFunctionCalling: FeatureFlag {
410+
.init(defaultValue: false, key: "FeatureFlag-DisableFunctionCalling")
411+
}
408412
}
409413

0 commit comments

Comments
 (0)