mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-24 15:38:12 +02:00
Jauge de contexte, espace disque sur partage agrégé, panneau Fichiers
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>
This commit is contained in:
1 parent
895ff92ed8
commit
b405adea6c
5118 files changed
+1264007
-23
No files matched your search
+106
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* @import {Nodes as HastNodes} from 'hast'
|
||||
* @import {Nodes as MdastNodes} from 'mdast'
|
||||
* @import {Options} from './state.js'
|
||||
*/
|
||||
|
||||
import {ok as assert} from 'devlop'
|
||||
import {footer} from './footer.js'
|
||||
import {createState} from './state.js'
|
||||
|
||||
/**
|
||||
* Transform mdast to hast.
|
||||
*
|
||||
* ##### Notes
|
||||
*
|
||||
* ###### HTML
|
||||
*
|
||||
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
|
||||
* as semistandard `raw` nodes.
|
||||
* Most utilities ignore `raw` nodes but two notable ones don’t:
|
||||
*
|
||||
* * `hast-util-to-html` also has an option `allowDangerousHtml` which will
|
||||
* output the raw HTML.
|
||||
* This is typically discouraged as noted by the option name but is useful
|
||||
* if you completely trust authors
|
||||
* * `hast-util-raw` can handle the raw embedded HTML strings by parsing them
|
||||
* into standard hast nodes (`element`, `text`, etc).
|
||||
* This is a heavy task as it needs a full HTML parser, but it is the only
|
||||
* way to support untrusted content
|
||||
*
|
||||
* ###### Footnotes
|
||||
*
|
||||
* Many options supported here relate to footnotes.
|
||||
* Footnotes are not specified by CommonMark, which we follow by default.
|
||||
* They are supported by GitHub, so footnotes can be enabled in markdown with
|
||||
* `mdast-util-gfm`.
|
||||
*
|
||||
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
|
||||
* that explains footnotes, which is hidden for sighted users but shown to
|
||||
* assistive technology.
|
||||
* When your page is not in English, you must define translated values.
|
||||
*
|
||||
* Back references use ARIA attributes, but the section label itself uses a
|
||||
* heading that is hidden with an `sr-only` class.
|
||||
* To show it to sighted users, define different attributes in
|
||||
* `footnoteLabelProperties`.
|
||||
*
|
||||
* ###### Clobbering
|
||||
*
|
||||
* Footnotes introduces a problem, as it links footnote calls to footnote
|
||||
* definitions on the page through `id` attributes generated from user content,
|
||||
* which results in DOM clobbering.
|
||||
*
|
||||
* DOM clobbering is this:
|
||||
*
|
||||
* ```html
|
||||
* <p id=x></p>
|
||||
* <script>alert(x) // `x` now refers to the DOM `p#x` element</script>
|
||||
* ```
|
||||
*
|
||||
* Elements by their ID are made available by browsers on the `window` object,
|
||||
* which is a security risk.
|
||||
* Using a prefix solves this problem.
|
||||
*
|
||||
* More information on how to handle clobbering and the prefix is explained in
|
||||
* Example: headings (DOM clobbering) in `rehype-sanitize`.
|
||||
*
|
||||
* ###### Unknown nodes
|
||||
*
|
||||
* Unknown nodes are nodes with a type that isn’t in `handlers` or `passThrough`.
|
||||
* The default behavior for unknown nodes is:
|
||||
*
|
||||
* * when the node has a `value` (and doesn’t have `data.hName`,
|
||||
* `data.hProperties`, or `data.hChildren`, see later), create a hast `text`
|
||||
* node
|
||||
* * otherwise, create a `<div>` element (which could be changed with
|
||||
* `data.hName`), with its children mapped from mdast to hast as well
|
||||
*
|
||||
* This behavior can be changed by passing an `unknownHandler`.
|
||||
*
|
||||
* @param {MdastNodes} tree
|
||||
* mdast tree.
|
||||
* @param {Options | null | undefined} [options]
|
||||
* Configuration (optional).
|
||||
* @returns {HastNodes}
|
||||
* hast tree.
|
||||
*/
|
||||
export function toHast(tree, options) {
|
||||
const state = createState(tree, options)
|
||||
const node = state.one(tree, undefined)
|
||||
const foot = footer(state)
|
||||
/** @type {HastNodes} */
|
||||
const result = Array.isArray(node)
|
||||
? {type: 'root', children: node}
|
||||
: node || {type: 'root', children: []}
|
||||
|
||||
if (foot) {
|
||||
// If there’s a footer, there were definitions, meaning block
|
||||
// content.
|
||||
// So `result` is a parent node.
|
||||
assert('children' in result)
|
||||
result.children.push({type: 'text', value: '\n'}, foot)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in new issue
Block a user