import './launch.css'; import {CONTEXTS,kvBytes,formatBytes,gpuMemoryBytes} from './core.js'; const $=q=>document.querySelector(q); const icon=name=>``; const choices=[['f32','EXACT'],['f16','HALF'],['q8_0','8-BIT'],['q4_0','4-BIT']]; export function mountLaunch(){ const root=document.createElement('section');root.id='launch-screen'; root.innerHTML=`
${icon('rocket')}MINICPM5 2B100% LOCAL

2.52BDENSE AGENTIC MODEL

Intelligence,
launched locally.

MiniCPM5 runs entirely on your GPU. Think, build websites, and create documents, spreadsheets and PDFs — privately.

KV CACHE PRECISION
${choices.map(([value,label])=>``).join('')}

2.52B
PARAMETERS
128K
MAX CONTEXT
8-bit
OFFICIAL WEIGHTS
`; $('#app').prepend(root); $('#ml-art').append($('#launch-scene')); $('#ml-actions').prepend($('.launch-control')); $('#ml-storage').append($('#save-model').parentElement); $('#ml-progress').append($('#loading-panel')); $('#ml-error').append($('#load-error')); } export function refreshLaunch(settings,locked=false){ $('#launch-context').value=String(CONTEXTS.indexOf(settings.context));$('#launch-context').disabled=locked; $('#launch-context-value').textContent=settings.context.toLocaleString()+' tokens'; const bytes=kvBytes(settings.context,settings.cacheK,settings.cacheV); $('#launch-memory-note').textContent=`${formatBytes(bytes)} of KV cache · ${formatBytes(gpuMemoryBytes(settings))} estimated GPU memory.`; $('#launch-dspark').value=settings.dspark;$('#launch-dspark').disabled=locked;$('#launch-dspark-note').textContent=settings.dspark==='off'?'Dedicated WebGPU decoding · 2.68 GB download.':'3.33 GB download, including a 648 MB draft. Every token verified by MiniCPM5.'; for(const b of document.querySelectorAll('[data-launch-setting]')){b.setAttribute('aria-pressed',String(settings[b.dataset.launchSetting]===b.dataset.value));b.disabled=locked;} } export function setLaunchPhase(phase){const loading=phase!=='idle';$('#ml-copy').hidden=loading;$('#ml-loader').hidden=!loading;document.body.classList.toggle('launch-loading',loading);} export function wireLaunch({getSettings,updateSettings,engine,openSettings,showDevice}){ $('#launch-context').oninput=event=>{if(!engine.loading)updateSettings({context:CONTEXTS[Number(event.target.value)]});}; for(const b of document.querySelectorAll('[data-launch-setting]'))b.onclick=()=>{if(!engine.loading)updateSettings({cacheK:b.dataset.value,cacheV:b.dataset.value});}; $('#launch-dspark').onchange=event=>{if(!engine.loading)updateSettings({dspark:event.target.value});}; $('#launch-advanced').onclick=openSettings;$('#launch-device').onclick=showDevice; $('#cancel-load').onclick=()=>{engine.loadController?.abort();$('#cancel-load').disabled=true;$('#cancel-load').textContent='CANCELING…';}; refreshLaunch(getSettings()); }