fix(forms): populate base URL for all non-official provider categories

The base URL field was not populating when editing providers with
categories like cn_official or aggregator. The issue was caused by
inconsistent conditional logic: the input field was shown for all
non-official categories, but the value extraction only worked for
third_party and custom categories.

Changed the category check from allowlist (third_party, custom) to
denylist (official) to match the UI display logic. Now ANTHROPIC_BASE_URL
correctly populates for all provider categories except official.
This commit is contained in:
Jason
2025-11-08 21:25:41 +08:00
parent 34b8aa1008
commit fb02881684

View File

@@ -33,7 +33,8 @@ export function useBaseUrlState({
// 从配置同步到 stateClaude // 从配置同步到 stateClaude
useEffect(() => { useEffect(() => {
if (appType !== "claude") return; if (appType !== "claude") return;
if (category !== "third_party" && category !== "custom") return; // 只有 official 类别不显示 Base URL 输入框,其他类别都需要回填
if (category === "official") return;
if (isUpdatingRef.current) return; if (isUpdatingRef.current) return;
try { try {
@@ -50,7 +51,8 @@ export function useBaseUrlState({
// 从配置同步到 stateCodex // 从配置同步到 stateCodex
useEffect(() => { useEffect(() => {
if (appType !== "codex") return; if (appType !== "codex") return;
if (category !== "third_party" && category !== "custom") return; // 只有 official 类别不显示 Base URL 输入框,其他类别都需要回填
if (category === "official") return;
if (isUpdatingRef.current) return; if (isUpdatingRef.current) return;
if (!codexConfig) return; if (!codexConfig) return;