Разбор LLM-извлечения
@@ -175,6 +188,7 @@ const dl=v=>DL[v]||v||'—', cl=v=>CL[v]||String(v||'—').replace(/\./g,' · ')
const $ = s => document.querySelector(s);
const esc = s => String(s ?? '').replace(/[<>&"]/g, c => ({'<':'<','>':'>','&':'&','"':'"'}[c]));
const api = async p => { const r = await fetch(p); return r.json(); };
+let MATRIX = null;
const post = async (p, b) => (await fetch(p,{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(b)})).json();
function setView(v){
@@ -186,6 +200,7 @@ function setView(v){
if(v==='materials') loadMaterials();
if(v==='quality') loadCoverage();
if(v==='heat') loadHeat();
+ if(v==='matrix') loadMatrix();
if(v==='inbox') loadInbox();
if(v==='archive') loadArchive();
if(v==='room') loadRoomOptions();
@@ -240,6 +255,39 @@ async function drawHeat(){
if(!pickup&&!fov) notes.push('Недостаточно подтверждённых specs — карта условная.');
$('#heatnote').innerHTML=notes.map(esc).join(' · ');
}
+async function loadMatrix(){
+ const box = $('#matrixbox');
+ if(!MATRIX){
+ box.innerHTML = '
загрузка…';
+ MATRIX = await api('/api/matrix');
+ }
+ renderMatrix();
+}
+function renderMatrix(){
+ if(!MATRIX) return;
+ const f = ($('#mq')?.value || '').toLowerCase().trim();
+ const accs = (MATRIX.accessories || []).filter(a => a.toLowerCase().includes(f));
+ const rows = (MATRIX.rows || []).filter(r => r.host.toLowerCase().includes(f));
+ const rowsBy = {};
+ rows.forEach(r => rowsBy[r.host] = r);
+ let h = '
| Хост | in | out | ';
+ accs.forEach(a => h += `${esc(a).slice(0,28)} | `);
+ h += '
';
+ rows.forEach(r => {
+ h += `| ${esc(r.host)} | ${esc((r.ports?.in || []).join(', '))} | ${esc((r.ports?.out || []).join(', '))} | `;
+ const cells = r.cells || {};
+ accs.forEach(a => {
+ const k = a.toLowerCase().replace(/[^a-z0-9]/g, '');
+ const v = cells[k];
+ h += `${v ? (v > 1 ? v : '✓') : '·'} | `;
+ });
+ h += '
';
+ });
+ h += '
';
+ $('#matrixbox').innerHTML = h;
+ $('#matrixcount').textContent = `${rows.length} хостов × ${accs.length} аксессуаров`;
+}
+
async function loadInbox(){
$('#inboxbox').innerHTML='
загрузка…';
const r=await api('/api/staging'); const xs=r.items||[]; const es=r.edges||[];