Settings: clamp logo SVGs to 18px chip + endpoint dropdown gets logo

Provider SVGs in providers.js declare only viewBox (no width/height),
so when injected into the 18×18 logo chips they fell back to the
browser default of 300×150 and blew out the row.

- CSS: SVGs inside settings logo chips (`span[id$="-logo"]`,
  the 18px wrappers in fallback rows) now stretch to 100%/100% of
  their container.
- Added matching `-logo` chip next to the Endpoint dropdowns in
  Default Chat Model and Utility Model cards.
- New `_syncEndpointLogo` helper mirrors the selected endpoint
  option's text label through providerLogo() (the select value is
  a UUID and wouldn't match anything otherwise), and
  `_fillEndpointSelect` calls it on each render.
This commit is contained in:
pewdiepie-archdaemon
2026-06-13 23:00:16 +09:00
parent 8053d6a50a
commit bb66914b1e
3 changed files with 33 additions and 0 deletions
+20
View File
@@ -239,6 +239,7 @@ function _fillEndpointSelect(selectEl, endpoints, selected, keepBlank) {
} else if (blankText !== null) {
selectEl.value = '';
}
_syncEndpointLogo(selectEl);
}
// Mirror the selected model's provider logo into a sibling <span id="<selectId>-logo">.
@@ -256,6 +257,25 @@ function _syncModelLogo(selectEl) {
}
}
// Same idea but for endpoint dropdowns where the <option value="…">
// is an opaque endpoint UUID — fall back to the option's text label
// so providerLogo() can pattern-match (Anthropic, OpenAI, Ollama, …).
function _syncEndpointLogo(selectEl) {
if (!selectEl) return;
const logoEl = document.getElementById(selectEl.id + '-logo');
if (!logoEl) return;
const apply = () => {
const opt = selectEl.options[selectEl.selectedIndex];
const label = (opt && opt.textContent) || selectEl.value || '';
logoEl.innerHTML = providerLogo(label) || '';
};
apply();
if (!selectEl.dataset.epLogoSync) {
selectEl.dataset.epLogoSync = '1';
selectEl.addEventListener('change', apply);
}
}
function _fillModelSelect(selectEl, models, selected, keepBlank) {
if (!selectEl) return;
const previous = selected !== undefined ? selected : selectEl.value;