mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
lib/data/zen.json is @zenlm/models read through lib/upstream at prebuild (scripts/zen.mjs); no page or client chunk imports the package. The Flash command finds its files by quantization, so no loader name ships. Co-authored-by: Hanzo Dev <[email protected]>
59 lines
2.1 KiB
TypeScript
59 lines
2.1 KiB
TypeScript
/**
|
|
* The names a Zen checkpoint is built from, which no page and no shipped file
|
|
* prints.
|
|
*
|
|
* Zen is named as Zen. What a checkpoint descends from stays with the weights
|
|
* (each repository's own card and licence), never in this site's copy, data or
|
|
* scripts sent to a browser. `scripts/zen.mjs` reads @zenlm/models through
|
|
* `bare` at build and writes `lib/data/zen.json`, the only Zen catalogue a page
|
|
* imports; `e2e/gates/names.spec.ts` reads every Zen page in the export and
|
|
* fails on any name here. This module is read by the build and the gates only.
|
|
*/
|
|
export const UPSTREAM = [
|
|
'Qwen',
|
|
'Flash-Next',
|
|
'Tongyi',
|
|
'DeepSeek',
|
|
'MiniMax',
|
|
'Wan-AI',
|
|
'Wan2',
|
|
'granite',
|
|
'Nemotron',
|
|
'Bonsai',
|
|
'unsloth',
|
|
'TRELLIS',
|
|
'JeffreyXiang',
|
|
'YuE',
|
|
'm-a-p',
|
|
] as const
|
|
|
|
/** Any of them, as a whole word or a prefix of one (`Qwen3.6`, `Wan2.2`). */
|
|
export const NAMED = new RegExp(`\\b(?:${UPSTREAM.map((n) => n.replace(/[.-]/g, '\\$&')).join('|')})`, 'i')
|
|
|
|
/** A sentence about where weights come from: repackaged, re-hosted, fine-tuned from, a lineage, related weights. */
|
|
const LINEAGE = /repackag|re-?host|fine-?tun\w* (?:of|from)|lineage|related open weights/i
|
|
|
|
/**
|
|
* A description with every sentence about lineage dropped, and from the rest
|
|
* every clause that names an upstream checkpoint: what the model is, said as
|
|
* Zen. `Speech-recognition model, ~1.7B, 24-layer audio encoder feeding a
|
|
* Qwen3 decoder; 30 languages.` reads `Speech-recognition model, ~1.7B; 30
|
|
* languages.`
|
|
*/
|
|
export function bare(text: string): string {
|
|
const sentences = text.split(/(?<=[.;])\s+/)
|
|
const kept = sentences
|
|
.filter((s) => !LINEAGE.test(s))
|
|
.map((s) => {
|
|
if (!NAMED.test(s)) return s
|
|
const end = /[.;]$/.exec(s)?.[0] ?? ''
|
|
const clauses = s.replace(/[.;]$/, '').split(/,\s+/).filter((c) => !NAMED.test(c))
|
|
return clauses.length ? clauses.join(', ') + end : ''
|
|
})
|
|
.filter(Boolean)
|
|
return kept.join(' ').replace(/;$/, '.').trim()
|
|
}
|
|
|
|
/** A feature line a page may print: none that speaks of lineage or names an upstream checkpoint. */
|
|
export const said = (feature: string) => !LINEAGE.test(feature) && !NAMED.test(feature)
|