diff --git a/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/QueryService+ConfigurableService/OpenAIService+ConfigurableService.swift b/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/QueryService+ConfigurableService/OpenAIService+ConfigurableService.swift index f4e8e2c2c..7bb9e8a2c 100644 --- a/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/QueryService+ConfigurableService/OpenAIService+ConfigurableService.swift +++ b/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/QueryService+ConfigurableService/OpenAIService+ConfigurableService.swift @@ -49,13 +49,13 @@ private struct OpenAIServiceConfigurationView: View { placeholder: "service.configuration.openai.endpoint.placeholder" ) - // model - TextField( - "service.configuration.custom_openai.supported_models.title", + // models + TextEditorCell( + title: "service.configuration.custom_openai.supported_models.title", text: viewModel.$availableModels ?? "", - prompt: Text("service.configuration.custom_openai.model.placeholder") + placeholder: "service.configuration.custom_openai.model.placeholder" ) - .padding(10.0) + Picker( "service.configuration.openai.model.title", selection: viewModel.$model diff --git a/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/TextEditorCell.swift b/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/TextEditorCell.swift index 5137ba8e0..96073bc82 100644 --- a/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/TextEditorCell.swift +++ b/Easydict/Swift/View/SettingView/Tabs/ServiceConfigurationView/TextEditorCell.swift @@ -20,9 +20,11 @@ struct TextEditorCell: View { var body: some View { HStack(alignment: .center, spacing: 20) { Text(title) + TextEditorWithPlaceholder(text: $text, placeholder: placeholder, alignment: .topTrailing) .padding(.horizontal, 3) - .padding(.vertical, 5) + .padding(.top, 5) + .padding(.bottom, 7) .font(.body) .lineSpacing(5) .scrollContentBackground(.hidden) // Refer https://stackoverflow.com/a/62848618/8378840 @@ -50,16 +52,14 @@ struct TextEditorWithPlaceholder: View { var alignment: Alignment = .leading var body: some View { - HStack { - ZStack(alignment: alignment) { - if let placeholder = placeholder, text.isEmpty { - Text(placeholder) - .foregroundColor(Color(NSColor.placeholderTextColor)) - .padding(3) - } - - TextEditor(text: $text) + ZStack(alignment: alignment) { + if let placeholder = placeholder, text.isEmpty { + Text(placeholder) + .foregroundColor(Color(NSColor.placeholderTextColor)) + .padding(3) } + + TextEditor(text: $text) } } }