mirror of
https://github.com/tiennm99/ccstatusline.git
synced 2026-07-18 22:16:50 +00:00
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import type { RenderContext } from '../types/RenderContext';
|
|
import type { Settings } from '../types/Settings';
|
|
import type {
|
|
Widget,
|
|
WidgetEditorDisplay,
|
|
WidgetItem
|
|
} from '../types/Widget';
|
|
|
|
export class ModelWidget implements Widget {
|
|
getDefaultColor(): string { return 'cyan'; }
|
|
getDescription(): string { return 'Displays the Claude model name (e.g., Claude 3.5 Sonnet)'; }
|
|
getDisplayName(): string { return 'Model'; }
|
|
getEditorDisplay(item: WidgetItem): WidgetEditorDisplay {
|
|
return { displayText: this.getDisplayName() };
|
|
}
|
|
|
|
render(item: WidgetItem, context: RenderContext, settings: Settings): string | null {
|
|
if (context.isPreview) {
|
|
return item.rawValue ? 'Claude' : 'Model: Claude';
|
|
} else if (context.data?.model?.display_name) {
|
|
return item.rawValue ? context.data.model.display_name : `Model: ${context.data.model.display_name}`;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
supportsRawValue(): boolean { return true; }
|
|
supportsColors(item: WidgetItem): boolean { return true; }
|
|
} |