MCPcopy
hub / github.com/srcbookdev/srcbook / formatModelName

Function formatModelName

packages/web/src/routes/settings.tsx:501–516  ·  view source on GitHub ↗
(modelId: string)

Source from the content-addressed store, hash-verified

499
500 // Format model ID for display - show just the model name, not the full provider/model path
501 function formatModelName(modelId: string): string {
502 // Validate input to ensure we never return undefined
503 if (typeof modelId !== 'string' || modelId.length === 0) {
504 return '';
505 }
506
507 // Split by / and take the last part if it exists
508 const parts = modelId.split('/');
509 if (parts.length > 1) {
510 // @ts-expect-error - We know this is valid based on the length check
511 return parts[parts.length - 1];
512 }
513
514 // Return the original value
515 return modelId;
516 }
517
518 // Get model display name with helpful context
519 const getModelDisplayName = (model: OpenRouterModel): string => {

Callers 1

getModelDisplayNameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected