Spaces:
Running
Running
Update index.html
Browse files- index.html +16 -8
index.html
CHANGED
|
@@ -1091,13 +1091,15 @@ async function runConsensus() {
|
|
| 1091 |
90);
|
| 1092 |
const m = /VOTO:\s*(SI|S\u00cd|PARCIAL|NO)/i.exec(v.answer);
|
| 1093 |
const razon = (/\nRAZON:\s*(.+)/i.exec(v.answer) || [])[1] || '';
|
| 1094 |
-
votes.push({ name: a.name, vote: m ? m[1].toUpperCase().replace('\u00cd', 'I') :
|
| 1095 |
}
|
| 1096 |
-
const
|
| 1097 |
-
const
|
|
|
|
| 1098 |
let status, cls, icon;
|
| 1099 |
-
if (
|
| 1100 |
-
else if (si
|
|
|
|
| 1101 |
else { status = 'Desacuerdo fundamentado'; cls = 'disagree'; icon = '\u{1F534}'; }
|
| 1102 |
doneNote(note, 'Consenso evaluado: ' + status);
|
| 1103 |
return { conclusion, votes, status, cls, icon, artifact: textArtifacts(conclusion, topic) };
|
|
@@ -1287,20 +1289,26 @@ function renderAnalysis() {
|
|
| 1287 |
const e = analysis.evaluation;
|
| 1288 |
const am = analysis.argmap;
|
| 1289 |
let html = '';
|
|
|
|
|
|
|
| 1290 |
// --- Consenso ---
|
| 1291 |
-
html += `<div class="consensus-hero ${c.cls}"><div class="ci">${c.icon}</div><div>` +
|
| 1292 |
-
`<div class="cs">${esc(c.status)}</div>` +
|
| 1293 |
`<div class="muted">Conclusi\u00f3n: ${esc(c.conclusion)}</div>` +
|
| 1294 |
((c.artifact ?? textArtifacts(c.conclusion, topic)) ? `<div class="muted" style="margin-top:4px">\u26A0\uFE0F La conclusi\u00f3n muestra artefactos de generaci\u00f3n (eco o repetici\u00f3n del modelo); interpr\u00e9tala con cautela.</div>` : '') +
|
| 1295 |
`</div></div>`;
|
| 1296 |
html += `<div class="panel" style="background:var(--panel2)"><h3>\u{1F5F3}\uFE0F Votaci\u00f3n de los agentes</h3><div class="vote-list">`;
|
| 1297 |
c.votes.forEach(v => {
|
|
|
|
| 1298 |
const cls = v.vote === 'SI' ? 'si' : v.vote === 'NO' ? 'no' : 'parcial';
|
| 1299 |
html += `<div class="vrow"><span class="vv ${cls}">${v.vote}</span><span><b>${esc(v.name)}</b>${v.reason ? ' — ' + esc(v.reason) : ''}</span></div>`;
|
| 1300 |
});
|
| 1301 |
html += '</div>';
|
|
|
|
|
|
|
|
|
|
| 1302 |
if (c.cls !== 'ok') {
|
| 1303 |
-
const reasons = c.votes.filter(v => v.vote !== 'SI' && v.reason);
|
| 1304 |
if (reasons.length) html += `<div class="muted" style="margin-top:8px"><b style="color:var(--text)">Por qu\u00e9 no hay acuerdo:</b> ` +
|
| 1305 |
reasons.map(v => `${esc(v.name)}: ${esc(v.reason)}`).join(' \u00b7 ') + '</div>';
|
| 1306 |
}
|
|
|
|
| 1091 |
90);
|
| 1092 |
const m = /VOTO:\s*(SI|S\u00cd|PARCIAL|NO)/i.exec(v.answer);
|
| 1093 |
const razon = (/\nRAZON:\s*(.+)/i.exec(v.answer) || [])[1] || '';
|
| 1094 |
+
votes.push({ name: a.name, vote: m ? m[1].toUpperCase().replace('\u00cd', 'I') : null, reason: razon.trim(), parsed: !!m });
|
| 1095 |
}
|
| 1096 |
+
const pv = votes.filter(v => v.parsed);
|
| 1097 |
+
const si = pv.filter(v => v.vote === 'SI').length;
|
| 1098 |
+
const no = pv.filter(v => v.vote === 'NO').length;
|
| 1099 |
let status, cls, icon;
|
| 1100 |
+
if (!pv.length) { status = 'Consenso no disponible'; cls = ''; icon = '\u26AA'; }
|
| 1101 |
+
else if (si === pv.length) { status = 'Consenso alcanzado'; cls = 'ok'; icon = '\u{1F7E2}'; }
|
| 1102 |
+
else if (si + pv.filter(v => v.vote === 'PARCIAL').length >= Math.ceil(pv.length / 2) && no === 0) { status = 'Consenso parcial'; cls = 'partial'; icon = '\u{1F7E1}'; }
|
| 1103 |
else { status = 'Desacuerdo fundamentado'; cls = 'disagree'; icon = '\u{1F534}'; }
|
| 1104 |
doneNote(note, 'Consenso evaluado: ' + status);
|
| 1105 |
return { conclusion, votes, status, cls, icon, artifact: textArtifacts(conclusion, topic) };
|
|
|
|
| 1289 |
const e = analysis.evaluation;
|
| 1290 |
const am = analysis.argmap;
|
| 1291 |
let html = '';
|
| 1292 |
+
const voteOk = v => v.parsed !== undefined ? v.parsed : !!(v.vote && v.reason);
|
| 1293 |
+
const noUsableVotes = Array.isArray(c.votes) && c.votes.length > 0 && !c.votes.some(voteOk);
|
| 1294 |
// --- Consenso ---
|
| 1295 |
+
html += `<div class="consensus-hero ${noUsableVotes ? '' : c.cls}"><div class="ci">${noUsableVotes ? '\u26AA' : c.icon}</div><div>` +
|
| 1296 |
+
`<div class="cs">${esc(noUsableVotes ? 'Consenso no disponible' : c.status)}</div>` +
|
| 1297 |
`<div class="muted">Conclusi\u00f3n: ${esc(c.conclusion)}</div>` +
|
| 1298 |
((c.artifact ?? textArtifacts(c.conclusion, topic)) ? `<div class="muted" style="margin-top:4px">\u26A0\uFE0F La conclusi\u00f3n muestra artefactos de generaci\u00f3n (eco o repetici\u00f3n del modelo); interpr\u00e9tala con cautela.</div>` : '') +
|
| 1299 |
`</div></div>`;
|
| 1300 |
html += `<div class="panel" style="background:var(--panel2)"><h3>\u{1F5F3}\uFE0F Votaci\u00f3n de los agentes</h3><div class="vote-list">`;
|
| 1301 |
c.votes.forEach(v => {
|
| 1302 |
+
if (!voteOk(v)) { html += `<div class="vrow"><span class="vv" style="color:var(--muted)">—</span><span><b>${esc(v.name)}</b> — sin voto utilizable</span></div>`; return; }
|
| 1303 |
const cls = v.vote === 'SI' ? 'si' : v.vote === 'NO' ? 'no' : 'parcial';
|
| 1304 |
html += `<div class="vrow"><span class="vv ${cls}">${v.vote}</span><span><b>${esc(v.name)}</b>${v.reason ? ' — ' + esc(v.reason) : ''}</span></div>`;
|
| 1305 |
});
|
| 1306 |
html += '</div>';
|
| 1307 |
+
if (!c.votes.some(voteOk)) {
|
| 1308 |
+
html += `<div class="muted" style="margin-top:8px">Los agentes no emitieron votos utilizables; el estado de consenso no es fiable y se muestra como no disponible.</div>`;
|
| 1309 |
+
}
|
| 1310 |
if (c.cls !== 'ok') {
|
| 1311 |
+
const reasons = c.votes.filter(v => voteOk(v) && v.vote !== 'SI' && v.reason);
|
| 1312 |
if (reasons.length) html += `<div class="muted" style="margin-top:8px"><b style="color:var(--text)">Por qu\u00e9 no hay acuerdo:</b> ` +
|
| 1313 |
reasons.map(v => `${esc(v.name)}: ${esc(v.reason)}`).join(' \u00b7 ') + '</div>';
|
| 1314 |
}
|