1
+ import { Button } from "@/components/ui/button" ;
1
2
import { Checkbox } from "@/components/ui/checkbox" ;
2
3
import Combobox from "@/components/ui/combobox" ;
3
4
import { Input } from "@/components/ui/input" ;
@@ -38,8 +39,8 @@ export default function SettingsChat() {
38
39
formState : { errors }
39
40
} = methods ;
40
41
41
- const providerNameAndValue = getProvidersNameAndValue ( ) ;
42
42
const [ models , setModels ] = useState < string [ ] > ( [ ] ) ;
43
+ const providerNameAndValue = getProvidersNameAndValue ( ) ;
43
44
const selectedProvider = watch ( "provider" ) ;
44
45
45
46
useEffect ( ( ) => {
@@ -70,11 +71,12 @@ export default function SettingsChat() {
70
71
if ( ! selectedProvider ) return ;
71
72
// Clear current model list
72
73
setModels ( [ ] ) ;
73
- console . log ( "selected provider:" , selectedProvider ) ;
74
74
// Fetch & set new model list based on the selected provider
75
75
const res = await getProvider ( selectedProvider ) . getModels ( ) ;
76
76
if ( res . kind === "err" ) {
77
- toast ( `An error occured while fetching models list.` ) ;
77
+ toast . error (
78
+ < span className = "whitespace-pre-wrap" > { `An error occured while fetching the model list for ${ selectedProvider } .\nDid you enter an API key?` } </ span >
79
+ ) ;
78
80
return ;
79
81
}
80
82
setModels ( res . value ) ;
@@ -92,12 +94,12 @@ export default function SettingsChat() {
92
94
} ;
93
95
94
96
return (
95
- < div className = "flex h-full w-full flex-col items-center justify-center scroll-secondary space-y-5 overflow-hidden " >
97
+ < div className = "flex h-full w-full flex-col items-center justify-center space-y-5" >
96
98
< h1 className = "text-2xl text-tx-primary font-bold tracking-wide" > Chat Settings</ h1 >
97
99
< FormProvider { ...methods } >
98
- < form className = "overflow-hidden " >
100
+ < form className = "flex flex-col items-center space-y-5 " >
99
101
{ /* Card Wrapper*/ }
100
- < div className = " h-[30rem ] w-[32rem] rounded-2xl border-y border-l border-line bg-container-primary py-3" >
102
+ < div className = "h-[32rem ] w-[32rem] rounded-2xl border-y border-l border-line bg-container-primary py-3" >
101
103
< div className = "scroll-secondary flex h-full w-full flex-col space-y-8 overflow-auto px-8 py-6" >
102
104
{ /* Provider & Model Section */ }
103
105
< div className = "space-y-3" >
@@ -253,15 +255,10 @@ export default function SettingsChat() {
253
255
</ div >
254
256
</ div >
255
257
</ div >
258
+ < Button className = "" onClick = { handleSubmit ( onSubmit ) } >
259
+ Save
260
+ </ Button >
256
261
</ form >
257
-
258
- < button
259
- className = "flex items-center space-x-2 rounded-xl border border-line bg-action-primary hover:brightness-90 px-4 py-2 font-medium
260
- text-tx-primary"
261
- onClick = { handleSubmit ( onSubmit ) }
262
- >
263
- Save
264
- </ button >
265
262
</ FormProvider >
266
263
</ div >
267
264
) ;
0 commit comments