fivetech commited on
Commit
6acb2bb
·
verified ·
1 Parent(s): d0899ce

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +34 -7
index.html CHANGED
@@ -1112,6 +1112,16 @@ const CRITERIA = [
1112
  ['INCERTIDUMBRE', 'Reconoce incertidumbre'],
1113
  ['CONCLUSION', 'Calidad de conclusi\u00f3n'],
1114
  ];
 
 
 
 
 
 
 
 
 
 
1115
  async function runEvaluation() {
1116
  const note = analysisNote('Evaluador analizando intervenciones\u2026');
1117
  const view = transcriptText(4500);
@@ -1142,7 +1152,14 @@ async function runEvaluation() {
1142
  const comment = (/COMENTARIO:\s*([^\n]+)/.exec(blk) || [])[1] || '';
1143
  const present = Object.values(scores).filter(v => v !== null);
1144
  const total = present.length ? Math.round((present.reduce((a, b) => a + b, 0) / present.length) * 10) : null;
1145
- blocks.push({ name, scores, comment: comment.trim(), total });
 
 
 
 
 
 
 
1146
  }
1147
  const grab = k => {
1148
  const mm = new RegExp(k + ':\\s*([\\s\\S]*?)(?=\\n(?:RELACIONES|CONTRADICCIONES|FALACIAS|SIN_JUSTIFICAR):|$)').exec(r.answer);
@@ -1155,8 +1172,9 @@ async function runEvaluation() {
1155
  falacias: grab('FALACIAS'),
1156
  sinJustificar: grab('SIN_JUSTIFICAR'),
1157
  };
1158
- doneNote(note, `Evaluaci\u00f3n completada (${blocks.length} agentes).`);
1159
- return { blocks, relations, extra, raw: r.answer };
 
1160
  }
1161
 
1162
  /* ================= An\u00e1lisis: mapa de argumentos ================= */
@@ -1265,8 +1283,16 @@ function renderAnalysis() {
1265
  html += '</div>';
1266
  // --- Puntuaciones ---
1267
  if (e && e.blocks.length) {
1268
- html += `<h3 style="margin-top:16px;color:var(--accent);font-size:13px;letter-spacing:1px">EVALUACI\u00d3N DEL DEBATE (orientativa)</h3><div class="score-grid">`;
1269
- [...e.blocks].sort((a, b) => (b.total ?? 0) - (a.total ?? 0)).forEach(b => {
 
 
 
 
 
 
 
 
1270
  const a = agents.find(x => x.name.toLowerCase() === b.name.toLowerCase());
1271
  html += `<div class="scard"><div class="stop">` +
1272
  `<div class="avatar" style="background:${avatarBg(a?.color || '#2dd4bf')}">${esc(a?.emoji || '\u{1F916}')}</div>` +
@@ -1282,6 +1308,7 @@ function renderAnalysis() {
1282
  html += '</div></div>';
1283
  });
1284
  html += '</div>';
 
1285
  if (e.relations) {
1286
  html += `<h3 style="margin-top:14px;color:var(--accent);font-size:13px;letter-spacing:1px">MAPA DE RELACIONES</h3><div class="relchips">`;
1287
  e.relations.split(';').map(x => x.trim()).filter(Boolean).forEach(rel => {
@@ -1355,10 +1382,10 @@ function saveToMemory(consensus) {
1355
  lsSet(K.memory, mem.slice(0, 12));
1356
  }
1357
  function updateRanking(evaluation) {
1358
- if (!evaluation || !evaluation.blocks) return;
1359
  const rank = lsGet(K.ranking, {});
1360
  evaluation.blocks.forEach(b => {
1361
- if (b.total === null) return;
1362
  const r = rank[b.name] || { total: 0, n: 0 };
1363
  rank[b.name] = { total: r.total + b.total, n: r.n + 1 };
1364
  });
 
1112
  ['INCERTIDUMBRE', 'Reconoce incertidumbre'],
1113
  ['CONCLUSION', 'Calidad de conclusi\u00f3n'],
1114
  ];
1115
+
1116
+ // Un bloque de puntuaciones solo es usable si el modelo produjo valores plausibles:
1117
+ // descarta ecos de la rúbrica ("0, 10, 0, 10"), bloques casi vacíos y ceros totales.
1118
+ function blockUsable(b) {
1119
+ if (!b || b.invalid === true) return false;
1120
+ const present = Object.values(b.scores || {}).filter(v => v !== null && v !== undefined);
1121
+ if (present.length < 3) return false;
1122
+ if (present.every(v => v === 0)) return false;
1123
+ return true;
1124
+ }
1125
  async function runEvaluation() {
1126
  const note = analysisNote('Evaluador analizando intervenciones\u2026');
1127
  const view = transcriptText(4500);
 
1152
  const comment = (/COMENTARIO:\s*([^\n]+)/.exec(blk) || [])[1] || '';
1153
  const present = Object.values(scores).filter(v => v !== null);
1154
  const total = present.length ? Math.round((present.reduce((a, b) => a + b, 0) / present.length) * 10) : null;
1155
+ // Eco de la rúbrica: la línea trae varios números ("0, 10, 0, 10") en vez de uno
1156
+ let multi = 0;
1157
+ CRITERIA.forEach(([key]) => {
1158
+ const lm = new RegExp(key + ':\\s*([^\\n]*)').exec(blk);
1159
+ if (lm && (lm[1].match(/\d+/g) || []).length > 1) multi++;
1160
+ });
1161
+ const invalid = multi >= 2;
1162
+ blocks.push({ name, scores, comment: comment.trim(), total, invalid });
1163
  }
1164
  const grab = k => {
1165
  const mm = new RegExp(k + ':\\s*([\\s\\S]*?)(?=\\n(?:RELACIONES|CONTRADICCIONES|FALACIAS|SIN_JUSTIFICAR):|$)').exec(r.answer);
 
1172
  falacias: grab('FALACIAS'),
1173
  sinJustificar: grab('SIN_JUSTIFICAR'),
1174
  };
1175
+ const usable = blocks.filter(blockUsable);
1176
+ doneNote(note, usable.length ? `Evaluaci\u00f3n completada (${usable.length} agentes).` : 'Evaluaci\u00f3n no disponible: salida del modelo no utilizable.');
1177
+ return { blocks, relations, extra, raw: r.answer, unavailable: usable.length === 0 };
1178
  }
1179
 
1180
  /* ================= An\u00e1lisis: mapa de argumentos ================= */
 
1283
  html += '</div>';
1284
  // --- Puntuaciones ---
1285
  if (e && e.blocks.length) {
1286
+ const usableBlocks = e.blocks.filter(blockUsable);
1287
+ if (!usableBlocks.length) {
1288
+ html += `<h3 style="margin-top:16px;color:var(--accent);font-size:13px;letter-spacing:1px">EVALUACI\u00d3N DEL DEBATE</h3>` +
1289
+ `<div class="panel" style="background:var(--panel2)"><div class="muted" style="color:var(--text)">Evaluaci\u00f3n no disponible: el modelo no produjo puntuaciones utilizables (salida degenerada o incompleta). Se omiten tarjetas y ranking para no presentar ceros como medici\u00f3n. Prueba con un modelo m\u00e1s capaz en Ajustes.</div></div>`;
1290
+ } else {
1291
+ const omitted = e.blocks.length - usableBlocks.length;
1292
+ html += `<h3 style="margin-top:16px;color:var(--accent);font-size:13px;letter-spacing:1px">EVALUACI\u00d3N DEL DEBATE (orientativa)</h3>` +
1293
+ (omitted ? `<div class="muted" style="margin-bottom:6px">${omitted} agente(s) sin puntuaci\u00f3n utilizable; se omiten sus tarjetas.</div>` : '') +
1294
+ `<div class="score-grid">`;
1295
+ usableBlocks.sort((a, b) => (b.total ?? 0) - (a.total ?? 0)).forEach(b => {
1296
  const a = agents.find(x => x.name.toLowerCase() === b.name.toLowerCase());
1297
  html += `<div class="scard"><div class="stop">` +
1298
  `<div class="avatar" style="background:${avatarBg(a?.color || '#2dd4bf')}">${esc(a?.emoji || '\u{1F916}')}</div>` +
 
1308
  html += '</div></div>';
1309
  });
1310
  html += '</div>';
1311
+ }
1312
  if (e.relations) {
1313
  html += `<h3 style="margin-top:14px;color:var(--accent);font-size:13px;letter-spacing:1px">MAPA DE RELACIONES</h3><div class="relchips">`;
1314
  e.relations.split(';').map(x => x.trim()).filter(Boolean).forEach(rel => {
 
1382
  lsSet(K.memory, mem.slice(0, 12));
1383
  }
1384
  function updateRanking(evaluation) {
1385
+ if (!evaluation || !evaluation.blocks || evaluation.unavailable) return;
1386
  const rank = lsGet(K.ranking, {});
1387
  evaluation.blocks.forEach(b => {
1388
+ if (b.total === null || !blockUsable(b)) return;
1389
  const r = rank[b.name] || { total: 0, n: 0 };
1390
  rank[b.name] = { total: r.total + b.total, n: r.n + 1 };
1391
  });