feat(models): define capability schema and readers (#2739)

* feat(models): define capability schema and readers

* fix(models): harden Google catalog probing

Restrict native catalog probing to the Gemini host, keep provider keys out of request URLs, filter non-chat model resources, and preserve the manual refresh default in the built-in Google add flow.
This commit is contained in:
RaresKeY
2026-07-18 10:40:58 +02:00
committed by GitHub
parent f87107e16f
commit 4f04c347cc
17 changed files with 3861 additions and 4 deletions
+9 -1
View File
@@ -934,6 +934,13 @@ function initEndpointForm() {
function _apiEndpointKind() {
return (kindSel && kindSel.value) ? kindSel.value : 'api';
}
function _modelRefreshModeForApiEndpoint(url, endpointKind) {
if (endpointKind === 'proxy') return 'manual';
try {
if ((new URL(url)).hostname.toLowerCase() === 'generativelanguage.googleapis.com') return '';
} catch (_) {}
return 'auto';
}
function _normalizeBaseUrl(raw) {
let u = raw.trim();
// Fix common protocol typos
@@ -1081,7 +1088,8 @@ function initEndpointForm() {
fd.append('base_url', url);
const endpointKind = _apiEndpointKind();
fd.append('endpoint_kind', endpointKind);
fd.append('model_refresh_mode', endpointKind === 'proxy' ? 'manual' : 'auto');
const refreshMode = _modelRefreshModeForApiEndpoint(url, endpointKind);
if (refreshMode) fd.append('model_refresh_mode', refreshMode);
fd.append('model_refresh_timeout', '30');
if (apiKey) fd.append('api_key', apiKey);
if (provider.value && provider.selectedOptions && provider.selectedOptions[0]) {