mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-14 02:38:20 +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>
69 lines
2.9 KiB
JavaScript
69 lines
2.9 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
const os = require("os");
|
|
const path = require("path");
|
|
const IS_WINDOWS_PLATFORM = os.platform() === 'win32';
|
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
/**
|
|
* All non-escaped special characters.
|
|
* Posix: ()*?[]{|}, !+@ before (, ! at the beginning, \\ before non-special characters.
|
|
* Windows: (){}[], !+@ before (, ! at the beginning.
|
|
*/
|
|
const POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
const WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
/**
|
|
* The device path (\\.\ or \\?\).
|
|
* https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#dos-device-paths
|
|
*/
|
|
const DOS_DEVICE_PATH_RE = /^\\\\([.?])/;
|
|
/**
|
|
* All backslashes except those escaping special characters.
|
|
* Windows: !()+@{}
|
|
* https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file#naming-conventions
|
|
*/
|
|
const WINDOWS_BACKSLASHES_RE = /\\(?![!()+@[\]{}])/g;
|
|
/**
|
|
* Designed to work only with simple paths: `dir\\file`.
|
|
*/
|
|
function unixify(filepath) {
|
|
return filepath.replace(/\\/g, '/');
|
|
}
|
|
exports.unixify = unixify;
|
|
function makeAbsolute(cwd, filepath) {
|
|
return path.resolve(cwd, filepath);
|
|
}
|
|
exports.makeAbsolute = makeAbsolute;
|
|
function removeLeadingDotSegment(entry) {
|
|
// We do not use `startsWith` because this is 10x slower than current implementation for some cases.
|
|
// eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
|
|
if (entry.charAt(0) === '.') {
|
|
const secondCharactery = entry.charAt(1);
|
|
if (secondCharactery === '/' || secondCharactery === '\\') {
|
|
return entry.slice(LEADING_DOT_SEGMENT_CHARACTERS_COUNT);
|
|
}
|
|
}
|
|
return entry;
|
|
}
|
|
exports.removeLeadingDotSegment = removeLeadingDotSegment;
|
|
exports.escape = IS_WINDOWS_PLATFORM ? escapeWindowsPath : escapePosixPath;
|
|
function escapeWindowsPath(pattern) {
|
|
return pattern.replace(WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
}
|
|
exports.escapeWindowsPath = escapeWindowsPath;
|
|
function escapePosixPath(pattern) {
|
|
return pattern.replace(POSIX_UNESCAPED_GLOB_SYMBOLS_RE, '\\$2');
|
|
}
|
|
exports.escapePosixPath = escapePosixPath;
|
|
exports.convertPathToPattern = IS_WINDOWS_PLATFORM ? convertWindowsPathToPattern : convertPosixPathToPattern;
|
|
function convertWindowsPathToPattern(filepath) {
|
|
return escapeWindowsPath(filepath)
|
|
.replace(DOS_DEVICE_PATH_RE, '//$1')
|
|
.replace(WINDOWS_BACKSLASHES_RE, '/');
|
|
}
|
|
exports.convertWindowsPathToPattern = convertWindowsPathToPattern;
|
|
function convertPosixPathToPattern(filepath) {
|
|
return escapePosixPath(filepath);
|
|
}
|
|
exports.convertPosixPathToPattern = convertPosixPathToPattern;
|