File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,23 +70,29 @@ struct OpenAIView: View {
7070
7171 HStack {
7272 if let model = ChatGPTModel ( rawValue: settings. chatGPTModel) {
73+ let binding = Binding (
74+ get: { String ( settings. chatGPTMaxToken) } ,
75+ set: {
76+ if let selectionMaxToken = Int ( $0) {
77+ settings. chatGPTMaxToken = model. maxToken < selectionMaxToken ? model. maxToken : selectionMaxToken
78+ } else {
79+ settings. chatGPTMaxToken = 0
80+ }
81+ }
82+ )
7383 Stepper (
7484 value: $settings. chatGPTMaxToken,
7585 in: 0 ... model. maxToken,
7686 step: 1
7787 ) {
7888 Text ( " Max Token " )
7989 }
90+ TextField ( text: binding) {
91+ EmptyView ( )
92+ }
93+ . labelsHidden ( )
94+ . textFieldStyle ( . roundedBorder)
8095 }
81- Text ( settings. chatGPTMaxToken. description)
82- . font ( . body)
83- . monospacedDigit ( )
84- . padding ( . vertical, 2 )
85- . padding ( . horizontal, 6 )
86- . background (
87- RoundedRectangle ( cornerRadius: 4 , style: . continuous)
88- . fill ( Color . white. opacity ( 0.2 ) )
89- )
9096 }
9197 }
9298 }
You can’t perform that action at this time.
0 commit comments