Self-hosted AI workspace.
Python
Add hover tooltips for clipped model names (#1982) (#1985)
lekt8f5bbd4282f6a
diff --git a/static/js/modelPicker.js b/static/js/modelPicker.jsindex 3c57a80e4..a0e7095c6 100644--- a/static/js/modelPicker.js+++ b/static/js/modelPicker.js@@ -328,6 +328,9 @@ function _initModelPickerDropdown() {const nameSpan = document.createElement('span');nameSpan.className = 'mp-model-name';nameSpan.textContent = m.display;+ // Long model names are clipped with ellipsis — expose the full name on+ // hover so the suffix/variant tag is still discoverable (#1982).+ nameSpan.title = m.display;row.appendChild(nameSpan);if (m.stale) {const badge = document.createElement('span');@@ -735,6 +738,9 @@ export function updateModelPicker() {}const displayName = modelId ? modelId.split('/').pop() : 'Select model';+ // The header indicator clips long names with ellipsis; show the full model+ // identifier on hover (#1982). No tooltip on the "Select model" placeholder.+ label.title = modelId || '';const logo = modelId ? providerLogo(modelId) : null;if (logo) {label.innerHTML = '<span class="model-picker-logo">' + logo + '</span> ' + displayName;diff --git a/tests/test_model_name_tooltip.py b/tests/test_model_name_tooltip.pynew file mode 100644index 000000000..e1f1bdf7b--- /dev/null+++ b/tests/test_model_name_tooltip.py@@ -0,0 +1,26 @@+"""Regression for issue #1982 — long model names are clipped with ellipsis in+two surfaces (the model-picker dropdown items and the chat-header model+indicator) with no tooltip, so the suffix/variant tag is undiscoverable.++The fix adds a `title` (native hover tooltip) carrying the full name to both+render sites in static/js/modelPicker.js. The module pulls in browser globals so+it can't be imported under node; this guards the two title assignments at source.+"""+import re+from pathlib import Path++SRC = (Path(__file__).resolve().parent.parent / "static/js/modelPicker.js").read_text(encoding="utf-8")+++def test_dropdown_item_has_title_tooltip():+ # The dropdown item name span must carry a title with the full display name.+ assert re.search(r"nameSpan\.title\s*=\s*m\.display", SRC), \+ "dropdown model-name span needs a title tooltip (#1982)"+++def test_header_indicator_has_title_tooltip():+ # updateModelPicker must set the header label's title to the full model id+ # (empty for the 'Select model' placeholder).+ body = SRC[SRC.index("export function updateModelPicker()"):]+ assert re.search(r"label\.title\s*=\s*modelId\b", body), \+ "header model indicator needs a title tooltip (#1982)"