|
|
@@ -107,7 +107,8 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
|
|
|
|
|
|
const routeInvalid = route.length > 0 && !ROUTE_PATTERN.test(route)
|
|
|
const routeTaken = taken.includes(route)
|
|
|
- const baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(baseURL)
|
|
|
+ const normalizedBaseURL = baseURL.trim()
|
|
|
+ const baseUrlInvalid = baseURL.length > 0 && !isHttpUrl(normalizedBaseURL)
|
|
|
// Rows are checked by the same per-row validator the editor cards use, so a
|
|
|
// bad row is named by its position here too. Capacities have route-level
|
|
|
// fallbacks; what a route cannot default is at least one model.
|
|
|
@@ -118,7 +119,7 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
|
|
|
// legitimately authenticate through the provider's own ambient discovery.
|
|
|
const keyValue = keyDraft.trim()
|
|
|
const ready = route.length > 0 && !routeInvalid && !routeTaken
|
|
|
- && baseURL.length > 0 && !baseUrlInvalid && models.length > 0 && modelFailure === undefined
|
|
|
+ && normalizedBaseURL.length > 0 && !baseUrlInvalid && models.length > 0 && modelFailure === undefined
|
|
|
&& keyFailure === undefined
|
|
|
// The one blocked gate worth a line under the form. A satisfied card says
|
|
|
// nothing at all rather than printing an empty paragraph.
|
|
|
@@ -132,7 +133,7 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
|
|
|
// fall through to it and contradict the filled-in list right above.
|
|
|
|| route.length === 0 || routeInvalid || routeTaken || baseUrlInvalid
|
|
|
? undefined
|
|
|
- : baseURL.length === 0
|
|
|
+ : normalizedBaseURL.length === 0
|
|
|
? t('customNeedsBaseUrl')
|
|
|
: modelFailure !== undefined
|
|
|
? `${t('model')} ${String(modelFailure.index + 1)}: ${t(modelFailure.key)}`
|
|
|
@@ -151,7 +152,7 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
|
|
|
// chain, ADC) instead of resolving a reference nothing ever sets.
|
|
|
...storesKey ? { apiKeyEnv: keyRef } : {},
|
|
|
api: protocol,
|
|
|
- baseURL,
|
|
|
+ baseURL: normalizedBaseURL,
|
|
|
models: models.map(model => ({ ...model })),
|
|
|
}
|
|
|
// `taken` is a snapshot too, so the id check alone cannot see a route
|
|
|
@@ -279,7 +280,7 @@ export function CustomProviderCard(props: CustomProviderCardProps): ReactNode {
|
|
|
onChange={setModels}
|
|
|
probe={{
|
|
|
settingsNs: NS,
|
|
|
- baseURL,
|
|
|
+ baseURL: normalizedBaseURL,
|
|
|
api: protocol,
|
|
|
...keyValue.length === 0 ? {} : { apiKey: keyValue },
|
|
|
}}
|