agent-zero/plugins/_context_window/webui/config.html
Alessandro 935fb5cdcc Add context window display controls and price currency selection
Add plugin settings to toggle the full context breakdown and each provider
usage row. Match price typography to the cache and token summary rows.

Keep USD amounts unchanged without exchange-rate requests. Convert non-USD
prices using validated Frankfurter rates cached for 24 hours, with dated
tooltips and an explicit USD fallback when a rate is unavailable. Preserve
stored provider usage and back off failed lookups for five minutes.

Validation: 20 context-window plugin tests pass. Verified settings persistence,
EUR price rendering, USD fallback, and exchange-rate lookup against the live
Docker runtime at localhost:32081.
2026-10-07 23:31:54 +02:00

53 lines
2.4 KiB
HTML

<html>
<head><title>Context Window</title></head>
<body>
<div x-data>
<template x-if="config">
<div>
<div class="section-title">Context Window</div>
<div class="section-description">
Choose what appears in the context window popover. Provider rows appear only when their data is available.
</div>
<template x-for="field in [
{ key: 'show_breakdown', label: 'Breakdown', description: 'Messages, System tools, Skills, MCP tools, System prompt, Extras, and Free space.' },
{ key: 'show_price', label: 'Price', description: 'The reported cost of the latest model call.' },
{ key: 'show_cache_hit', label: 'Cache hit', description: 'The percentage of input tokens served from cache.' },
{ key: 'show_tokens', label: 'Tokens In/Out', description: 'The input and output token counts of the latest model call.' }
]" :key="field.key">
<div class="field">
<div class="field-label">
<div class="field-title" x-text="field.label"></div>
<div class="field-description" x-text="field.description"></div>
</div>
<div class="field-control">
<label class="toggle">
<input type="checkbox" x-model="config[field.key]" :aria-label="field.label"
x-init="if (config[field.key] == null) config[field.key] = true">
<span class="toggler"></span>
</label>
</div>
</div>
</template>
<div class="field">
<div class="field-label">
<div class="field-title">Price currency</div>
<div class="field-description">
USD uses the reported amount directly. Other currencies use daily exchange rates; if unavailable, the price stays in USD.
</div>
</div>
<div class="field-control">
<select x-model="config.price_currency" aria-label="Price currency"
x-init="if (!config.price_currency) config.price_currency = 'USD'">
<template x-for="currency in ['USD', ...Intl.supportedValuesOf('currency').filter(code => code !== 'USD')]" :key="currency">
<option :value="currency" :selected="currency === config.price_currency" x-text="currency"></option>
</template>
</select>
</div>
</div>
</div>
</template>
</div>
</body>
</html>