always require upstream url

This commit is contained in:
miloschwartz
2026-08-13 10:07:01 -04:00
parent c35ac493ed
commit 9a551c91e5
5 changed files with 13 additions and 67 deletions
@@ -41,7 +41,6 @@ import {
createAiProviderFormSchema,
showsUpstreamUrlField,
toAiProviderNetworkPayload,
upstreamUrlRequired,
type AiProviderFormValues
} from "@app/lib/aiProviderFormSchema";
import { aiProviderQueries } from "@app/lib/queries";
@@ -91,7 +90,6 @@ export default function AiProviderNetworkPage() {
const providerType = form.watch("type");
const routingMode = form.watch("routingMode");
const showUpstream = showsUpstreamUrlField(providerType, routingMode);
const requireUpstream = upstreamUrlRequired(providerType, routingMode);
const showRoutingMode = providerType === "custom";
const isTargetModeSelected = routingMode === "target";
const isTargetModeSaved =
@@ -218,22 +216,9 @@ export default function AiProviderNetworkPage() {
field.value ??
"url"
}
onChange={(
value
) => {
field.onChange(
value
);
if (
value ===
"target"
) {
form.setValue(
"upstreamUrl",
""
);
}
}}
onChange={
field.onChange
}
/>
</FormControl>
<FormMessage />
@@ -284,14 +269,10 @@ export default function AiProviderNetworkPage() {
{t(
"aiProviderUpstreamUrl"
)}
{requireUpstream
? ""
: " (optional)"}
</FormLabel>
<FormControl>
<Input
autoComplete="off"
placeholder="https://"
value={
field.value ??
""
@@ -302,13 +283,9 @@ export default function AiProviderNetworkPage() {
/>
</FormControl>
<FormDescription>
{requireUpstream
? t(
"aiProviderUpstreamUrlDescription"
)
: t(
"aiProviderUpstreamUrlOptionalDescription"
)}
{t(
"aiProviderUpstreamUrlDescription"
)}
</FormDescription>
<FormMessage />
</FormItem>
@@ -49,7 +49,6 @@ import {
emptyUpstreamForType,
showsUpstreamUrlField,
toAiProviderCreatePayload,
upstreamUrlRequired,
type AiProviderFormValues
} from "@app/lib/aiProviderFormSchema";
import { zodResolver } from "@hookform/resolvers/zod";
@@ -95,7 +94,6 @@ export default function CreateAiProviderPage() {
const authType = form.watch("authType");
const showUpstream = showsUpstreamUrlField(providerType, routingMode);
const requireUpstream = upstreamUrlRequired(providerType, routingMode);
const showRoutingMode = providerType === "custom";
const showTargets = providerType === "custom" && routingMode === "target";
const showApiKey = authTypeRequiresApiKey(authType ?? "bearer");
@@ -436,14 +434,9 @@ export default function CreateAiProviderPage() {
value
);
if (
value ===
value !==
"target"
) {
form.setValue(
"upstreamUrl",
""
);
} else {
targetsRef.current =
[];
}
@@ -498,14 +491,10 @@ export default function CreateAiProviderPage() {
{t(
"aiProviderUpstreamUrl"
)}
{requireUpstream
? ""
: " (optional)"}
</FormLabel>
<FormControl>
<Input
autoComplete="off"
placeholder="https://"
value={
field.value ??
""
@@ -516,13 +505,9 @@ export default function CreateAiProviderPage() {
/>
</FormControl>
<FormDescription>
{requireUpstream
? t(
"aiProviderUpstreamUrlDescription"
)
: t(
"aiProviderUpstreamUrlOptionalDescription"
)}
{t(
"aiProviderUpstreamUrlDescription"
)}
</FormDescription>
<FormMessage />
</FormItem>