@@ -9,40 +9,48 @@ struct BaseURLPicker: View {
99 var body : some View {
1010 WithViewStore ( store) { viewStore in
1111 Group {
12- TextField ( " Base URL " , text: viewStore. $baseURL, prompt: prompt)
13- . overlay ( alignment: . trailing) {
14- Picker (
15- " " ,
16- selection: viewStore. $baseURL,
17- content: {
18- if !viewStore. state. availableBaseURLs
19- . contains ( viewStore. state. baseURL) ,
20- !viewStore. state. baseURL. isEmpty
21- {
22- Text ( " Custom Value " ) . tag ( viewStore. state. baseURL)
23- }
24-
25- Text ( " Empty (Default Value) " ) . tag ( " " )
26-
27- ForEach ( viewStore. state. availableBaseURLs, id: \. self) { baseURL in
28- Text ( baseURL) . tag ( baseURL)
29- }
30- }
31- )
32- . frame ( width: 20 )
33- }
3412 if showIsFullURL {
35- Toggle (
36- " Is Base URL with Full Path " ,
37- isOn: viewStore. $isFullURL
13+ Picker (
14+ selection: viewStore. $isFullURL,
15+ content: {
16+ Text ( " Base URL " ) . tag ( false )
17+ Text ( " Full URL " ) . tag ( true )
18+ } ,
19+ label: { Text ( " URL " ) }
20+ )
21+ . pickerStyle ( . segmented)
22+ }
23+ HStack {
24+ TextField (
25+ showIsFullURL ? " " : " Base URL " ,
26+ text: viewStore. $baseURL,
27+ prompt: prompt
3828 )
39-
40- Text (
41- " Add compatibility API's distinct endpoint structure. For example Perplexity.ai API's URL is https://api.perplexity.ai/chat/completions "
29+ if viewStore. isFullURL == false {
30+ Text ( " /v1/chat/completions " )
31+ }
32+ }
33+ . padding ( . trailing)
34+ . overlay ( alignment: . trailing) {
35+ Picker (
36+ " " ,
37+ selection: viewStore. $baseURL,
38+ content: {
39+ if !viewStore. state. availableBaseURLs
40+ . contains ( viewStore. state. baseURL) ,
41+ !viewStore. state. baseURL. isEmpty
42+ {
43+ Text ( " Custom Value " ) . tag ( viewStore. state. baseURL)
44+ }
45+
46+ Text ( " Empty (Default Value) " ) . tag ( " " )
47+
48+ ForEach ( viewStore. state. availableBaseURLs, id: \. self) { baseURL in
49+ Text ( baseURL) . tag ( baseURL)
50+ }
51+ }
4252 )
43- . foregroundColor ( . secondary)
44- . font ( . callout)
45- . dynamicHeightTextInFormWorkaround ( )
53+ . frame ( width: 20 )
4654 }
4755 }
4856 . onAppear {
0 commit comments