Skip to content

Commit

Permalink
add menu items to change API key and toggle GPT-4
Browse files Browse the repository at this point in the history
  • Loading branch information
leetcode-mafia committed Apr 19, 2023
1 parent b91561d commit 60c8820
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Cheetah/CheetahApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,34 @@ struct CheetahApp: App {
}
.windowResizability(.contentSize)
.windowStyle(.hiddenTitleBar)
.commands {
CommandGroup(replacing: .appSettings) {
Button(action: {
viewModel.authToken = nil
resetAfterSettingsChanged()
}) {
Text("Change API Key…")
}
Button(action: {
if viewModel.useGPT4 == true {
viewModel.useGPT4 = false
} else {
viewModel.useGPT4 = true
}
resetAfterSettingsChanged()
}) {
Text("Use GPT-4")
if viewModel.useGPT4 == true {
Image(systemName: "checkmark")
}
}
}
}
}

func resetAfterSettingsChanged() {
viewModel.selectedDevice = nil
viewModel.analyzer = nil
}

func setCaptureDevice(_ device: CaptureDevice?) {
Expand Down
2 changes: 1 addition & 1 deletion Cheetah/Views/AuthTokenView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct AuthTokenView: View {
}
.privacySensitive()
.frame(width: 300)
Toggle("Use GPT-4 (access required)", isOn: $toggleValue)
Toggle("Use GPT-4 (API access required)", isOn: $toggleValue)
Button("Save") {
storedToken = tokenValue
useGPT4 = toggleValue
Expand Down

0 comments on commit 60c8820

Please sign in to comment.