fivetech commited on
Commit
15accab
·
verified ·
1 Parent(s): da500e7

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +24 -9
index.html CHANGED
@@ -216,9 +216,8 @@ footer a{color:var(--accent);text-decoration:none}
216
  <div class="row">
217
  <div><label>Modelo predefinido</label><select id="set-preset">
218
  <option value="">(personalizado)</option>
219
- <option value="bartowski/Qwen2.5-Coder-1.5B-Instruct-GGUF|Qwen2.5-Coder-1.5B-Instruct-Q4_K_M.gguf">Qwen2.5-Coder 1.5B (~1,1 GB, ligero)</option>
220
- <option value="bartowski/Qwen2.5-Coder-3B-Instruct-GGUF|Qwen2.5-Coder-3B-Instruct-Q4_K_M.gguf">Qwen2.5-Coder 3B (~2,1 GB)</option>
221
- <option value="bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF|MiMo-V2.6-Distill-Qwen-9B-Q4_K_M.gguf">MiMo-V2.6 9B (~5,8 GB, requiere mucha cuota de almacenamiento)</option>
222
  </select></div>
223
  </div>
224
  <div class="row">
@@ -251,7 +250,7 @@ footer a{color:var(--accent);text-decoration:none}
251
  <footer>
252
  <span>La conversación se procesa en tu navegador (WASM/CPU; la generación tarda unos minutos por intervención). Solo se conecta a Hugging Face para descargar el modelo (1,1 GB con el modelo ligero) y a jsDelivr para las librerías.</span>
253
  <span>Contexto experto: extractos de la documentación pública de <a href="https://fivetechsoft.github.io/FWH_docs/en/getting-started/overview.html" target="_blank" rel="noopener">FWH</a> (434 páginas, fragmentos de ~1.600 caracteres), documentación de <a href="https://github.com/harbour/core" target="_blank" rel="noopener">harbour/core</a> e hilos públicos de los <a href="https://forums.fivetechsupport.com" target="_blank" rel="noopener">foros FiveTech</a>, incluidos en este Space. El modelo puede proponer código incorrecto: valídalo siempre compilando.</span>
254
- <span>Motor: <a href="https://github.com/ngxson/wllama" target="_blank" rel="noopener">wllama</a> (MIT) &middot; inspirado en <a href="https://huggingface.co/spaces/fivetech/Multi-Agent-Debate-MiMo-WebGPU" target="_blank" rel="noopener">Multi-Agent Debate</a> &middot; modelo por defecto <a href="https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct" target="_blank" rel="noopener">Qwen2.5-Coder-1.5B</a>; MiMo-V2.6-9B disponible en Ajustes</span>
255
  </footer>
256
  </div>
257
  </div>
@@ -293,8 +292,8 @@ const DEFAULT_AGENTS = [
293
 
294
  const CONFIG = {
295
  modelUrl: params.get('modelUrl') || '',
296
- repo: params.get('repo') || 'bartowski/Qwen2.5-Coder-1.5B-Instruct-GGUF',
297
- file: params.get('file') || 'Qwen2.5-Coder-1.5B-Instruct-Q4_K_M.gguf',
298
  nCtx: parseInt(params.get('ctx')) || 8192,
299
  maxTokens: parseInt(params.get('maxTokens')) || 512,
300
  temperature: parseFloat(params.get('temp')) || 0.7,
@@ -330,6 +329,13 @@ const subtitleEl = document.getElementById('subtitle');
330
  let wllama = null;
331
  let running = false;
332
  let stopRequested = false;
 
 
 
 
 
 
 
333
  let transcript = []; // {name|null(user), text}
334
  let topic = '';
335
 
@@ -635,7 +641,8 @@ function kbRetrieve(query, agentName, maxChars = 3000, k = 5) {
635
  const RULES = 'Est\u00e1s en una conversaci\u00f3n entre varios agentes. ' +
636
  'Responde SOLO con tu intervenci\u00f3n: 2-5 frases, directas, en el idioma de la conversaci\u00f3n. ' +
637
  'No repitas lo ya dicho; reacciona a la \u00faltima intervenci\u00f3n. ' +
638
- 'No escribas tu nombre ni ning\u00fan prefijo como "Nombre:". No uses listas largas.';
 
639
 
640
  function transcriptText(maxChars = 9000) {
641
  const lines = transcript.map(m => `${m.name || 'Usuario'}: ${m.text}`);
@@ -671,8 +678,14 @@ async function agentTurn(agent) {
671
  temperature: CONFIG.temperature,
672
  stream: true,
673
  });
674
- for await (const chunk of stream) {
675
- if (stopRequested) break;
 
 
 
 
 
 
676
  const delta = chunk.choices?.[0]?.delta || {};
677
  const tk = delta.content || '';
678
  const rs = delta.reasoning_content || '';
@@ -699,8 +712,10 @@ async function agentTurn(agent) {
699
  return;
700
  }
701
  el.classList.remove('streaming');
 
702
  if (stopRequested) { el.remove(); markActive(null); setStatus('Detenido'); return; }
703
  answer = answer.replace(/^\s*(?:\*\*)?[A-Za-z\u00c0-\u024f]+:\s*/, '').trim();
 
704
  if (!answer) { el.remove(); markActive(null); setStatus('Listo'); return; }
705
  body.innerHTML = (typeof marked !== 'undefined') ? marked.parse(answer) : esc(answer).replace(/\n/g, '<br>');
706
  transcript.push({ name: agent.name, text: answer });
 
216
  <div class="row">
217
  <div><label>Modelo predefinido</label><select id="set-preset">
218
  <option value="">(personalizado)</option>
219
+ <option value="bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF|MiMo-V2.6-Distill-Qwen-9B-Q4_K_M.gguf" selected>MiMo-V2.6 9B Q4_K_M (~5,8 GB; requiere bastante almacenamiento libre en el navegador)</option>
220
+ <option value="bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF|MiMo-V2.6-Distill-Qwen-9B-Q3_K_M.gguf">MiMo-V2.6 9B Q3_K_M (~4,4 GB; menos calidad, menos cuota)</option>
 
221
  </select></div>
222
  </div>
223
  <div class="row">
 
250
  <footer>
251
  <span>La conversación se procesa en tu navegador (WASM/CPU; la generación tarda unos minutos por intervención). Solo se conecta a Hugging Face para descargar el modelo (1,1 GB con el modelo ligero) y a jsDelivr para las librerías.</span>
252
  <span>Contexto experto: extractos de la documentación pública de <a href="https://fivetechsoft.github.io/FWH_docs/en/getting-started/overview.html" target="_blank" rel="noopener">FWH</a> (434 páginas, fragmentos de ~1.600 caracteres), documentación de <a href="https://github.com/harbour/core" target="_blank" rel="noopener">harbour/core</a> e hilos públicos de los <a href="https://forums.fivetechsupport.com" target="_blank" rel="noopener">foros FiveTech</a>, incluidos en este Space. El modelo puede proponer código incorrecto: valídalo siempre compilando.</span>
253
+ <span>Motor: <a href="https://github.com/ngxson/wllama" target="_blank" rel="noopener">wllama</a> (MIT) &middot; inspirado en <a href="https://huggingface.co/spaces/fivetech/Multi-Agent-Debate-MiMo-WebGPU" target="_blank" rel="noopener">Multi-Agent Debate</a> &middot; modelo: <a href="https://huggingface.co/bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF" target="_blank" rel="noopener">MiMo-V2.6-9B</a> (Q4_K_M por defecto, ~5,8 GB; Q3 en Ajustes). Su descarga es grande y puede no caber en la cuota de almacenamiento del navegador</span>
254
  </footer>
255
  </div>
256
  </div>
 
292
 
293
  const CONFIG = {
294
  modelUrl: params.get('modelUrl') || '',
295
+ repo: params.get('repo') || 'bartowski/MiMo-V2.6-Distill-Qwen-9B-GGUF',
296
+ file: params.get('file') || 'MiMo-V2.6-Distill-Qwen-9B-Q4_K_M.gguf',
297
  nCtx: parseInt(params.get('ctx')) || 8192,
298
  maxTokens: parseInt(params.get('maxTokens')) || 512,
299
  temperature: parseFloat(params.get('temp')) || 0.7,
 
329
  let wllama = null;
330
  let running = false;
331
  let stopRequested = false;
332
+ let inflight = null;
333
+ function raceStop(p) {
334
+ return new Promise((res, rej) => {
335
+ const t = setInterval(() => { if (stopRequested) { clearInterval(t); res('__stop__'); } }, 250);
336
+ p.then(r => { clearInterval(t); res(r); }, e => { clearInterval(t); rej(e); });
337
+ });
338
+ }
339
  let transcript = []; // {name|null(user), text}
340
  let topic = '';
341
 
 
641
  const RULES = 'Est\u00e1s en una conversaci\u00f3n entre varios agentes. ' +
642
  'Responde SOLO con tu intervenci\u00f3n: 2-5 frases, directas, en el idioma de la conversaci\u00f3n. ' +
643
  'No repitas lo ya dicho; reacciona a la \u00faltima intervenci\u00f3n. ' +
644
+ 'No escribas tu nombre ni ning\u00fan prefijo como "Nombre:". No uses listas largas. ' +
645
+ 'No inventes nombres de clases, m\u00e9todos, funciones ni versiones: si no est\u00e1 en el contexto o no lo sabes, dilo expresamente. Si usas el contexto, cita la fuente entre corchetes con su t\u00edtulo exacto.';
646
 
647
  function transcriptText(maxChars = 9000) {
648
  const lines = transcript.map(m => `${m.name || 'Usuario'}: ${m.text}`);
 
678
  temperature: CONFIG.temperature,
679
  stream: true,
680
  });
681
+ inflight = stream;
682
+ let pending = null;
683
+ while (true) {
684
+ pending = stream.next();
685
+ pending.catch(() => {});
686
+ const step = await raceStop(pending);
687
+ if (step === '__stop__' || !step || step.done) break;
688
+ const chunk = step.value;
689
  const delta = chunk.choices?.[0]?.delta || {};
690
  const tk = delta.content || '';
691
  const rs = delta.reasoning_content || '';
 
712
  return;
713
  }
714
  el.classList.remove('streaming');
715
+ if (inflight) { const s0 = inflight; Promise.resolve(s0.next ? s0.next() : null).catch(() => {}).finally(() => { if (inflight === s0) inflight = null; }); inflight = null; }
716
  if (stopRequested) { el.remove(); markActive(null); setStatus('Detenido'); return; }
717
  answer = answer.replace(/^\s*(?:\*\*)?[A-Za-z\u00c0-\u024f]+:\s*/, '').trim();
718
+ answer = answer.replace(/^Eres un[ae]? (experto|experta|asistente)[^.\n]*[.,]?\s*(y\s+)?/i, '').trim();
719
  if (!answer) { el.remove(); markActive(null); setStatus('Listo'); return; }
720
  body.innerHTML = (typeof marked !== 'undefined') ? marked.parse(answer) : esc(answer).replace(/\n/g, '<br>');
721
  transcript.push({ name: agent.name, text: answer });