Create LLM context memory calculator with:

- Accurate memory calculation using ggml quantization formulas
- Support for f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1 quantizations
- Asymmetric context support (separate K/V cache quantization)
- Full attention interval support
- Parallel sequences multiplier
- Bilingual interface (Russian/English)
- Retro-style design with tooltips

Signed-off-by: Arseniy Romenskiy <romenskiy@altlinux.org> - Co-authored-by: Qwen3.5-35B-A3B-Claude-4.6-Opus-Reasoning-Distilled <qwen@example.com>
This commit is contained in:
romenskiy2012 2026-04-11 23:54:55 +03:00 committed by Arseniy Romenskiy
commit c471e1d0a9
4 changed files with 1007 additions and 0 deletions

326
css/styles.css Normal file
View file

@ -0,0 +1,326 @@
/*
* LLM Context Memory Calculator - Retro Style CSS
* White background, sharp borders, high contrast
*/
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: system-ui, -apple-system, sans-serif;
background-color: #FFFFFF;
color: #000000;
line-height: 1.6;
padding: 20px;
}
.container {
max-width: 600px;
margin: 0 auto;
border: 3px solid #000000;
padding: 20px;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
h1 {
font-family: 'Courier New', monospace;
font-size: 28px;
font-weight: bold;
color: #0000FF;
border-bottom: 2px solid #0000FF;
padding-bottom: 10px;
flex-grow: 1;
}
.lang-btn {
background-color: #000000;
color: #FFFFFF;
border: 2px solid #000000;
padding: 5px 10px;
font-family: 'Courier New', monospace;
font-size: 14px;
font-weight: bold;
cursor: pointer;
}
.lang-btn:hover {
background-color: #333333;
}
.form-group {
margin-bottom: 15px;
position: relative;
}
label {
display: block;
font-weight: bold;
margin-bottom: 5px;
font-size: 14px;
}
input[type="number"],
select {
width: 100%;
padding: 8px;
border: 2px solid #000000;
background-color: #FFFFFF;
color: #000000;
font-family: 'Courier New', monospace;
font-size: 16px;
border-radius: 0;
}
input[type="number"]:focus,
select:focus {
outline: none;
border-color: #0000FF;
box-shadow: 0 0 5px rgba(0, 0, 255, 0.5);
}
input[type="number"]::placeholder {
color: #666666;
}
.checkbox-group {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.checkbox-group input[type="checkbox"] {
width: auto;
margin-right: 10px;
cursor: pointer;
}
.checkbox-group label {
margin-bottom: 0;
cursor: pointer;
}
.asymmetric-controls {
display: none;
border: 2px solid #000000;
padding: 15px;
margin-top: 10px;
background-color: #F5F5F5;
}
.asymmetric-controls.visible {
display: block;
}
.asymmetric-controls .form-group {
margin-bottom: 10px;
}
button {
width: 100%;
padding: 12px;
background-color: #000000;
color: #FFFFFF;
border: none;
font-family: 'Courier New', monospace;
font-size: 16px;
font-weight: bold;
cursor: pointer;
transition: background-color 0.2s;
}
button:hover {
background-color: #333333;
}
.results {
margin-top: 20px;
border: 2px solid #000000;
padding: 15px;
}
.results h2 {
font-family: 'Courier New', monospace;
font-size: 18px;
margin-bottom: 10px;
color: #000000;
border-bottom: 1px solid #000000;
padding-bottom: 5px;
}
.result-item {
display: flex;
justify-content: space-between;
padding: 5px 0;
font-family: 'Courier New', monospace;
font-size: 14px;
}
.result-item::before {
content: '├─';
margin-right: 5px;
color: #000000;
}
.result-item:last-child::before {
content: '└─';
}
.result-item .label {
color: #333333;
}
.result-item .value {
font-weight: bold;
}
.result-item.total::before {
content: '└─';
color: #0000FF;
}
.result-item.total .value {
color: #0000FF;
}
.example {
margin-top: 20px;
padding: 10px;
border: 1px solid #CCCCCC;
background-color: #FAFAFA;
}
.example p {
font-family: 'Courier New', monospace;
font-size: 12px;
color: #666666;
}
.error-message {
background-color: #FFEEEE;
border: 2px solid #FF0000;
color: #FF0000;
padding: 10px;
margin-top: 10px;
font-family: 'Courier New', monospace;
font-size: 14px;
}
.error-message ul {
margin-left: 20px;
}
.error-message li {
margin-bottom: 5px;
}
/* Tooltip Styles */
.tooltip-icon {
display: inline-block;
width: 16px;
height: 16px;
background-color: #000000;
color: #FFFFFF;
text-align: center;
line-height: 16px;
font-family: 'Courier New', monospace;
font-size: 12px;
font-weight: bold;
margin-left: 5px;
cursor: help;
vertical-align: middle;
position: relative;
}
.tooltip-icon::before {
content: "?";
}
/* Hide both languages by default */
.tooltip-icon[data-tooltip-ru],
.tooltip-icon[data-tooltip-en] {
display: none;
}
/* Show Russian when html lang is ru */
html[lang="ru"] .tooltip-icon[data-tooltip-ru] {
display: inline-block;
}
/* Show English when html lang is en */
html[lang="en"] .tooltip-icon[data-tooltip-en] {
display: inline-block;
}
.tooltip-icon:hover {
background-color: #0000FF;
}
/* Tooltip popup for Russian */
html[lang="ru"] .tooltip-icon:hover::after {
content: attr(data-tooltip-ru);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
background-color: #000000;
color: #FFFFFF;
padding: 12px 16px;
font-size: 11px;
white-space: pre-wrap;
width: 375px;
z-index: 1000;
line-height: 1.4;
text-align: left;
}
/* Tooltip popup for English */
html[lang="en"] .tooltip-icon:hover::after {
content: attr(data-tooltip-en);
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
background-color: #000000;
color: #FFFFFF;
padding: 12px 16px;
font-size: 11px;
white-space: pre-wrap;
width: 375px;
z-index: 1000;
line-height: 1.4;
text-align: left;
}
@media (max-width: 600px) {
.container {
padding: 15px;
}
h1 {
font-size: 22px;
}
input[type="number"],
select {
font-size: 14px;
}
.header {
flex-direction: column;
align-items: flex-start;
gap: 10px;
}
.lang-btn {
align-self: flex-end;
}
}