Footer shouldn't explode when no model is given.

This commit is contained in:
Mario Zechner 2025-11-16 22:35:27 +01:00
parent e0c2745989
commit 112ce6e5d1

View file

@ -49,7 +49,7 @@ export class FooterComponent {
lastAssistantMessage.usage.cacheRead +
lastAssistantMessage.usage.cacheWrite
: 0;
const contextWindow = this.state.model.contextWindow;
const contextWindow = this.state.model?.contextWindow || 0;
const contextPercent = contextWindow > 0 ? ((contextTokens / contextWindow) * 100).toFixed(1) : "0.0";
// Format token counts (similar to web-ui)
@ -86,7 +86,7 @@ export class FooterComponent {
const statsLeft = statsParts.join(" ");
// Add model name on the right side
let modelName = this.state.model.id;
let modelName = this.state.model?.id || "no-model";
const statsLeftWidth = visibleWidth(statsLeft);
const modelWidth = visibleWidth(modelName);