Show the serving provider in the model-info card (#2185)
* Show the serving provider in the model-info card The model-info popup (click the model name on a message) shows the model and pricing, with a logo inferred from the model NAME. But the same model can be served by different endpoints — e.g. claude-haiku via OpenRouter vs GitHub Copilot vs Anthropic direct — which the name-based logo can't distinguish. Add a 'Provider' line derived from the session's endpoint URL: - new providerLabel(endpointUrl) in static/js/providers.js maps the host to a friendly name (GitHub Copilot, OpenRouter, Anthropic, OpenAI, Google, AWS Bedrock, DeepSeek, Mistral, Groq, Together, Fireworks, Perplexity, xAI), 'Local' for loopback/LAN, else the bare host. - static/js/chatRenderer.js renders it under Model in the card, from window.sessionModule.getCurrentEndpointUrl(). * Anchor provider-label patterns to the hostname providerLabel matched its patterns against the full endpoint URL with unanchored substrings, so a host like max.airlines.com matched /x\.ai/ and was mislabeled "xAI". Anchor each pattern to the end of the hostname ((^|.)domain$) and test against the parsed host instead of the raw URL.
This commit is contained in:
committed by
GitHub
parent
8bfd79fe8e
commit
147d1fbde6
@@ -4,7 +4,7 @@
|
||||
import uiModule from './ui.js';
|
||||
import markdownModule from './markdown.js';
|
||||
import { addAITTSButton } from './tts-ai.js';
|
||||
import { providerLogo } from './providers.js';
|
||||
import { providerLogo, providerLabel } from './providers.js';
|
||||
import settingsModule from './settings.js';
|
||||
import spinnerModule from './spinner.js';
|
||||
import { bindMenuDismiss } from './escMenuStack.js';
|
||||
@@ -577,6 +577,12 @@ export function applyModelColor(roleEl, modelName) {
|
||||
if (logoHtml) html += '<span class="role-provider-logo" style="opacity:0.7">' + logoHtml + '</span>';
|
||||
html += short + '</div>';
|
||||
html += '<div><span class="ctx-label">Model</span> ' + modelName.split('/').pop() + '</div>';
|
||||
// Provider = the serving endpoint, distinct from the model vendor/logo
|
||||
// (e.g. the same model via OpenRouter vs Copilot vs Anthropic direct).
|
||||
const _epUrl = (window.sessionModule && window.sessionModule.getCurrentEndpointUrl)
|
||||
? window.sessionModule.getCurrentEndpointUrl() : null;
|
||||
const _provLabel = providerLabel(_epUrl);
|
||||
if (_provLabel) html += '<div><span class="ctx-label">Provider</span> ' + uiModule.esc(_provLabel) + '</div>';
|
||||
// Show static context initially, then fetch real from server
|
||||
const _realCtx = window._realContextLengths && window._realContextLengths[modelName];
|
||||
if (_realCtx) {
|
||||
|
||||
Reference in New Issue
Block a user