()
| 990 | } |
| 991 | |
| 992 | function syncRoutingControls() { |
| 993 | const provider = normalizeProviderValue(providerInput?.value ?? "gemini"); |
| 994 | const imageProviderSource = normalizeImageProviderValue(imageProviderInput?.value ?? "same"); |
| 995 | const effectiveImageProvider = getEffectiveImageProvider(); |
| 996 | |
| 997 | syncModelDefaults(); |
| 998 | |
| 999 | if (svgModelGroup) { |
| 1000 | svgModelGroup.hidden = false; |
| 1001 | } |
| 1002 | if (imageModelGroup) { |
| 1003 | imageModelGroup.hidden = false; |
| 1004 | } |
| 1005 | if (baseUrlGroup) { |
| 1006 | baseUrlGroup.hidden = provider !== "custom"; |
| 1007 | } |
| 1008 | if (imageSizeGroup) { |
| 1009 | imageSizeGroup.hidden = effectiveImageProvider !== "gemini"; |
| 1010 | } |
| 1011 | if (imageApiKeyGroup) { |
| 1012 | imageApiKeyGroup.hidden = imageProviderSource === "same"; |
| 1013 | } |
| 1014 | if (imageBaseUrlGroup) { |
| 1015 | imageBaseUrlGroup.hidden = imageProviderSource !== "custom"; |
| 1016 | } |
| 1017 | if (baseUrlInput && !baseUrlInput.value.trim()) { |
| 1018 | baseUrlInput.value = DEFAULT_CUSTOM_BASE_URL; |
| 1019 | } |
| 1020 | if ( |
| 1021 | imageProviderSource === "custom" && |
| 1022 | imageBaseUrlInput && |
| 1023 | !imageBaseUrlInput.value.trim() |
| 1024 | ) { |
| 1025 | imageBaseUrlInput.value = getResolvedPrimaryBaseUrl(); |
| 1026 | } |
| 1027 | if (imageApiKeyHint) { |
| 1028 | imageApiKeyHint.textContent = |
| 1029 | imageProviderSource === "same" |
| 1030 | ? t("input.image_api_key_hint_linked") |
| 1031 | : t("input.image_api_key_hint_override", { |
| 1032 | provider: getImageProviderLabel(imageProviderSource), |
| 1033 | }); |
| 1034 | } |
| 1035 | if (imageBaseUrlHint) { |
| 1036 | imageBaseUrlHint.textContent = |
| 1037 | imageProviderSource === "custom" |
| 1038 | ? t("input.image_base_url_hint_custom") |
| 1039 | : t("input.image_base_url_hint_default"); |
| 1040 | } |
| 1041 | |
| 1042 | updateRouteSummary(); |
| 1043 | saveInputState(); |
| 1044 | } |
| 1045 | |
| 1046 | function syncSamApiKeyVisibility() { |
| 1047 | const shouldShow = |
no test coverage detected