mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-14 10:48:35 +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>
90 lines
2.6 KiB
JavaScript
90 lines
2.6 KiB
JavaScript
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _genmapping = require('@jridgewell/gen-mapping');
|
|
|
|
|
|
|
|
var _charcodes = require('./parser/util/charcodes');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
* Generate a source map indicating that each line maps directly to the original line,
|
|
* with the tokens in their new positions.
|
|
*/
|
|
function computeSourceMap(
|
|
{code: generatedCode, mappings: rawMappings},
|
|
filePath,
|
|
options,
|
|
source,
|
|
tokens,
|
|
) {
|
|
const sourceColumns = computeSourceColumns(source, tokens);
|
|
const map = new (0, _genmapping.GenMapping)({file: options.compiledFilename});
|
|
let tokenIndex = 0;
|
|
// currentMapping is the output source index for the current input token being
|
|
// considered.
|
|
let currentMapping = rawMappings[0];
|
|
while (currentMapping === undefined && tokenIndex < rawMappings.length - 1) {
|
|
tokenIndex++;
|
|
currentMapping = rawMappings[tokenIndex];
|
|
}
|
|
let line = 0;
|
|
let lineStart = 0;
|
|
if (currentMapping !== lineStart) {
|
|
_genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);
|
|
}
|
|
for (let i = 0; i < generatedCode.length; i++) {
|
|
if (i === currentMapping) {
|
|
const genColumn = currentMapping - lineStart;
|
|
const sourceColumn = sourceColumns[tokenIndex];
|
|
_genmapping.maybeAddSegment.call(void 0, map, line, genColumn, filePath, line, sourceColumn);
|
|
while (
|
|
(currentMapping === i || currentMapping === undefined) &&
|
|
tokenIndex < rawMappings.length - 1
|
|
) {
|
|
tokenIndex++;
|
|
currentMapping = rawMappings[tokenIndex];
|
|
}
|
|
}
|
|
if (generatedCode.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
|
|
line++;
|
|
lineStart = i + 1;
|
|
if (currentMapping !== lineStart) {
|
|
_genmapping.maybeAddSegment.call(void 0, map, line, 0, filePath, line, 0);
|
|
}
|
|
}
|
|
}
|
|
const {sourceRoot, sourcesContent, ...sourceMap} = _genmapping.toEncodedMap.call(void 0, map);
|
|
return sourceMap ;
|
|
} exports.default = computeSourceMap;
|
|
|
|
/**
|
|
* Create an array mapping each token index to the 0-based column of the start
|
|
* position of the token.
|
|
*/
|
|
function computeSourceColumns(code, tokens) {
|
|
const sourceColumns = new Array(tokens.length);
|
|
let tokenIndex = 0;
|
|
let currentMapping = tokens[tokenIndex].start;
|
|
let lineStart = 0;
|
|
for (let i = 0; i < code.length; i++) {
|
|
if (i === currentMapping) {
|
|
sourceColumns[tokenIndex] = currentMapping - lineStart;
|
|
tokenIndex++;
|
|
currentMapping = tokens[tokenIndex].start;
|
|
}
|
|
if (code.charCodeAt(i) === _charcodes.charCodes.lineFeed) {
|
|
lineStart = i + 1;
|
|
}
|
|
}
|
|
return sourceColumns;
|
|
}
|