File tree Expand file tree Collapse file tree
app/[locale]/dashboard/[entityType]/[entitySlug]/aimodels/edit/[id]/versions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -463,12 +463,24 @@ export default function VersionsPage() {
463463
464464 const endpointRequiredProviders = [ 'CUSTOM' , 'LLAMA_OLLAMA' , 'LLAMA_CUSTOM' ] ;
465465 const isEndpointRequired = endpointRequiredProviders . includes ( providerFormData . provider ) ;
466+
466467 if ( isEndpointRequired && ! providerFormData . apiEndpointUrl ?. trim ( ) ) {
467468 toast ( 'Endpoint URL is required for the selected provider.' ) ;
468469 return ;
469470 }
470471
471- // Parse apiRequestTemplate string to JSON if provided
472+ if ( providerFormData . apiEndpointUrl ?. trim ( ) ) {
473+ try {
474+ const url = new URL ( providerFormData . apiEndpointUrl ) ;
475+ if ( ! [ 'http:' , 'https:' ] . includes ( url . protocol ) ) {
476+ toast ( 'Endpoint URL must use HTTP or HTTPS protocol.' ) ;
477+ return ;
478+ }
479+ } catch {
480+ toast ( 'Please enter a valid endpoint URL (e.g., https://api.example.com/v1/chat)' ) ;
481+ return ;
482+ }
483+ }
472484 let parsedRequestTemplate = null ;
473485 if ( providerFormData . apiRequestTemplate ) {
474486 try {
You can’t perform that action at this time.
0 commit comments