mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-16 03:39:29 +02:00
Trois défauts sans rapport entre eux, tous visibles à l'écran. Jauge de contexte bloquée à « 0 / N (0 %) » : le comptage exact vient de usage.prompt_tokens (include_usage), qu'un llama-server récent a cessé de renvoyer. On note désormais si l'usage est arrivé ; sinon la fin de tour publie l'estimation qui pilote déjà la compaction — approximative, mais jamais absente. Et la souscription envoie la valeur courante juste après le rattrapage : une page rechargée affichait zéro sur une discussion pourtant pleine, faute d'événement ctx_used dans la fenêtre rejouée. Espace disque : « il ne reste que 11,9 Go » sur un partage Unraid qui en a des centaines. /mnt/user est servi par shfs, un FUSE qui agrège plusieurs disques — statfs y renvoie l'espace d'un seul, et ce chiffre REFUSAIT l'installation du modèle. Les systèmes de fichiers qui approximent (FUSE, overlay, NFS, CIFS, Ceph, Gluster) sont reconnus par leur magie : leur chiffre reste affiché, précédé d'un « ~ », mais ne bloque plus rien. Panneau Fichiers : le panneau entier défilait, emportant vers le haut l'en-tête, le fil d'Ariane et le pied (occupation disque, bouton .zip) dès qu'il y avait quelques fichiers. Seule la liste défile maintenant ; le pied reste en bas et l'état vide se centre. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
130 lines
3.7 KiB
JavaScript
130 lines
3.7 KiB
JavaScript
/**
|
||
* @import {HtmlExtension} from 'micromark-util-types'
|
||
*/
|
||
|
||
const alignment = {
|
||
none: '',
|
||
left: ' align="left"',
|
||
right: ' align="right"',
|
||
center: ' align="center"'
|
||
};
|
||
|
||
// To do: micromark@5: use `infer` here, when all events are exposed.
|
||
|
||
/**
|
||
* Create an HTML extension for `micromark` to support GitHub tables when
|
||
* serializing to HTML.
|
||
*
|
||
* @returns {HtmlExtension}
|
||
* Extension for `micromark` that can be passed in `htmlExtensions` to
|
||
* support GitHub tables when serializing to HTML.
|
||
*/
|
||
export function gfmTableHtml() {
|
||
return {
|
||
enter: {
|
||
table(token) {
|
||
const tableAlign = token._align;
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<table>');
|
||
this.setData('tableAlign', tableAlign);
|
||
},
|
||
tableBody() {
|
||
this.tag('<tbody>');
|
||
},
|
||
tableData() {
|
||
const tableAlign = this.getData('tableAlign');
|
||
const tableColumn = this.getData('tableColumn');
|
||
const align = alignment[tableAlign[tableColumn]];
|
||
if (align === undefined) {
|
||
// Capture results to ignore them.
|
||
this.buffer();
|
||
} else {
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<td' + align + '>');
|
||
}
|
||
},
|
||
tableHead() {
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<thead>');
|
||
},
|
||
tableHeader() {
|
||
const tableAlign = this.getData('tableAlign');
|
||
const tableColumn = this.getData('tableColumn');
|
||
const align = alignment[tableAlign[tableColumn]];
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<th' + align + '>');
|
||
},
|
||
tableRow() {
|
||
this.setData('tableColumn', 0);
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<tr>');
|
||
}
|
||
},
|
||
exit: {
|
||
// Overwrite the default code text data handler to unescape escaped pipes when
|
||
// they are in tables.
|
||
codeTextData(token) {
|
||
let value = this.sliceSerialize(token);
|
||
if (this.getData('tableAlign')) {
|
||
value = value.replace(/\\([\\|])/g, replace);
|
||
}
|
||
this.raw(this.encode(value));
|
||
},
|
||
table() {
|
||
this.setData('tableAlign');
|
||
// Note: we don’t set `slurpAllLineEndings` anymore, in delimiter rows,
|
||
// but we do need to reset it to match a funky newline GH generates for
|
||
// list items combined with tables.
|
||
this.setData('slurpAllLineEndings');
|
||
this.lineEndingIfNeeded();
|
||
this.tag('</table>');
|
||
},
|
||
tableBody() {
|
||
this.lineEndingIfNeeded();
|
||
this.tag('</tbody>');
|
||
},
|
||
tableData() {
|
||
const tableAlign = this.getData('tableAlign');
|
||
const tableColumn = this.getData('tableColumn');
|
||
if (tableColumn in tableAlign) {
|
||
this.tag('</td>');
|
||
this.setData('tableColumn', tableColumn + 1);
|
||
} else {
|
||
// Stop capturing.
|
||
this.resume();
|
||
}
|
||
},
|
||
tableHead() {
|
||
this.lineEndingIfNeeded();
|
||
this.tag('</thead>');
|
||
},
|
||
tableHeader() {
|
||
const tableColumn = this.getData('tableColumn');
|
||
this.tag('</th>');
|
||
this.setData('tableColumn', tableColumn + 1);
|
||
},
|
||
tableRow() {
|
||
const tableAlign = this.getData('tableAlign');
|
||
let tableColumn = this.getData('tableColumn');
|
||
while (tableColumn < tableAlign.length) {
|
||
this.lineEndingIfNeeded();
|
||
this.tag('<td' + alignment[tableAlign[tableColumn]] + '></td>');
|
||
tableColumn++;
|
||
}
|
||
this.setData('tableColumn', tableColumn);
|
||
this.lineEndingIfNeeded();
|
||
this.tag('</tr>');
|
||
}
|
||
}
|
||
};
|
||
}
|
||
|
||
/**
|
||
* @param {string} $0
|
||
* @param {string} $1
|
||
* @returns {string}
|
||
*/
|
||
function replace($0, $1) {
|
||
// Pipes work, backslashes don’t (but can’t escape pipes).
|
||
return $1 === '|' ? $1 : $0;
|
||
} |