mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-05 07:48:45 +00:00
app: use local model files (.strata or .gguf), name them, pick them next to the official builds
The local files screens take .strata and .gguf, and the unsupported message names the four families the engines run. A custom build has an editable display name, is listed under its family in the version and chat pickers with a Custom badge and its file size, and can be removed from Strata without touching the files. The host accepts .strata files and the Inkling-2-Mini and HY-4 Flash architectures.
This commit is contained in:
1 parent
e9632d068a
commit
63efcd48bf
25 files changed
+871
-70
No files matched your search
@@ -0,0 +1,229 @@
|
||||
// 0.2.23 custom models (CUSTOM-MODELS-0223): add the strings of "Use local model files (.strata or .gguf)" to the gtui-<lang>.json family
|
||||
// (idempotent: a key already there is kept). node scripts/add-custom-model-strings.mjs
|
||||
import { readFileSync, writeFileSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const dir = join(dirname(fileURLToPath(import.meta.url)), '..', 'src', 'locales');
|
||||
const KEYS = ['cm01', 'cm02', 'cm03', 'cm04', 'cm05', 'cm06', 'cm07', 'cm08', 'cm09', 'cm10', 'cm11', 'cm12', 'cm13', 'cm14', 'cm15', 'cm16', 'cm17', 'cm18', 'cm19'];
|
||||
const T = {
|
||||
en: [
|
||||
'Use local model files (.strata or .gguf)…',
|
||||
'Already have a supported model on this computer, such as a compatible fine-tune or quantization? Choose the folder that holds its files, or one of its .strata or .gguf files. Strata checks them, prepares the model and loads it. Nothing is copied or downloaded, and your files are never changed.',
|
||||
'Folder with the model files, or one .strata or .gguf file',
|
||||
'Strata runs Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash and Inkling-2-Mini, and compatible fine-tunes and quantizations of them. Download one from Models, or choose its .strata or .gguf files.',
|
||||
'Check that the folder holds complete .strata or .gguf files, then try again. The file named under Details says what is wrong with it.',
|
||||
'Custom build',
|
||||
'Closest build:',
|
||||
'This is how the model is listed in Strata. Your files stay where they are.',
|
||||
'Give this model a name.',
|
||||
'Remove from Strata',
|
||||
'Custom · Not loaded. Open Models to load it.',
|
||||
'Local model file ·',
|
||||
'Choose the model’s .strata or .gguf file. For a split .gguf model, choose any shard; Strata finds the first and checks the full set.',
|
||||
'No model files here',
|
||||
'Only folders and .strata or .gguf files are shown. LoRA adapters and image projectors need separate support.',
|
||||
'Choose a complete text model file (.strata or .gguf).',
|
||||
'Remove this model from Strata?',
|
||||
'Keep model',
|
||||
'Only the entry in Strata is removed. Your .strata or .gguf files stay where they are and are not changed.',
|
||||
],
|
||||
de: [
|
||||
'Lokale Modelldateien verwenden (.strata oder .gguf)…',
|
||||
'Sie haben bereits ein unterstütztes Modell auf diesem Computer, etwa ein kompatibles Fine-Tuning oder eine kompatible Quantisierung? Wählen Sie den Ordner mit den Dateien oder eine der .strata- oder .gguf-Dateien. Strata prüft sie, bereitet das Modell vor und lädt es. Nichts wird kopiert oder heruntergeladen, und Ihre Dateien werden nie verändert.',
|
||||
'Ordner mit den Modelldateien oder eine .strata- oder .gguf-Datei',
|
||||
'Strata führt Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash und Inkling-2-Mini aus, dazu kompatible Fine-Tunings und Quantisierungen davon. Laden Sie eines unter Modelle herunter oder wählen Sie seine .strata- oder .gguf-Dateien.',
|
||||
'Prüfen Sie, ob der Ordner vollständige .strata- oder .gguf-Dateien enthält, und versuchen Sie es erneut. Die unter Details genannte Datei zeigt, was daran nicht stimmt.',
|
||||
'Eigene Variante',
|
||||
'Nächstliegende Variante:',
|
||||
'So wird das Modell in Strata aufgeführt. Ihre Dateien bleiben, wo sie sind.',
|
||||
'Geben Sie diesem Modell einen Namen.',
|
||||
'Aus Strata entfernen',
|
||||
'Eigene Variante · Nicht geladen. Öffnen Sie Modelle, um es zu laden.',
|
||||
'Lokale Modelldatei ·',
|
||||
'Wählen Sie die .strata- oder .gguf-Datei des Modells. Bei einem geteilten .gguf-Modell wählen Sie einen beliebigen Teil; Strata findet den ersten und prüft den ganzen Satz.',
|
||||
'Hier sind keine Modelldateien',
|
||||
'Es werden nur Ordner sowie .strata- und .gguf-Dateien angezeigt. LoRA-Adapter und Bildprojektoren brauchen eigene Unterstützung.',
|
||||
'Wählen Sie eine vollständige Textmodell-Datei (.strata oder .gguf).',
|
||||
'Dieses Modell aus Strata entfernen?',
|
||||
'Modell behalten',
|
||||
'Es wird nur der Eintrag in Strata entfernt. Ihre .strata- oder .gguf-Dateien bleiben, wo sie sind, und werden nicht verändert.',
|
||||
],
|
||||
fr: [
|
||||
'Utiliser des fichiers de modèle locaux (.strata ou .gguf)…',
|
||||
'Vous avez déjà un modèle pris en charge sur cet ordinateur, par exemple un fine-tuning ou une quantification compatible ? Choisissez le dossier qui contient ses fichiers, ou l’un de ses fichiers .strata ou .gguf. Strata les vérifie, prépare le modèle et le charge. Rien n’est copié ni téléchargé, et vos fichiers ne sont jamais modifiés.',
|
||||
'Dossier des fichiers du modèle, ou un fichier .strata ou .gguf',
|
||||
'Strata exécute Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash et Inkling-2-Mini, ainsi que leurs fine-tunings et quantifications compatibles. Téléchargez-en un depuis Modèles, ou choisissez ses fichiers .strata ou .gguf.',
|
||||
'Vérifiez que le dossier contient des fichiers .strata ou .gguf complets, puis réessayez. Le fichier indiqué sous Détails dit ce qui ne va pas.',
|
||||
'Version personnalisée',
|
||||
'Version la plus proche :',
|
||||
'C’est ainsi que le modèle apparaît dans Strata. Vos fichiers restent où ils sont.',
|
||||
'Donnez un nom à ce modèle.',
|
||||
'Retirer de Strata',
|
||||
'Version personnalisée · Non chargé. Ouvrez Modèles pour le charger.',
|
||||
'Fichier de modèle local ·',
|
||||
'Choisissez le fichier .strata ou .gguf du modèle. Pour un modèle .gguf fractionné, choisissez n’importe quelle partie ; Strata trouve la première et vérifie l’ensemble.',
|
||||
'Aucun fichier de modèle ici',
|
||||
'Seuls les dossiers et les fichiers .strata ou .gguf sont affichés. Les adaptateurs LoRA et les projecteurs d’images demandent une prise en charge distincte.',
|
||||
'Choisissez un fichier de modèle texte complet (.strata ou .gguf).',
|
||||
'Retirer ce modèle de Strata ?',
|
||||
'Garder le modèle',
|
||||
'Seule l’entrée dans Strata est retirée. Vos fichiers .strata ou .gguf restent où ils sont et ne sont pas modifiés.',
|
||||
],
|
||||
es: [
|
||||
'Usar archivos de modelo locales (.strata o .gguf)…',
|
||||
'¿Ya tiene un modelo compatible en este ordenador, por ejemplo un ajuste fino o una cuantización compatible? Elija la carpeta que contiene sus archivos, o uno de sus archivos .strata o .gguf. Strata los comprueba, prepara el modelo y lo carga. No se copia ni se descarga nada, y sus archivos nunca se modifican.',
|
||||
'Carpeta con los archivos del modelo, o un archivo .strata o .gguf',
|
||||
'Strata ejecuta Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash e Inkling-2-Mini, y los ajustes finos y cuantizaciones compatibles de ellos. Descargue uno desde Modelos, o elija sus archivos .strata o .gguf.',
|
||||
'Compruebe que la carpeta contiene archivos .strata o .gguf completos y vuelva a intentarlo. El archivo indicado en Detalles dice qué falla.',
|
||||
'Versión personalizada',
|
||||
'Versión más cercana:',
|
||||
'Así se muestra el modelo en Strata. Sus archivos se quedan donde están.',
|
||||
'Póngale un nombre a este modelo.',
|
||||
'Quitar de Strata',
|
||||
'Versión personalizada · No cargado. Abra Modelos para cargarlo.',
|
||||
'Archivo de modelo local ·',
|
||||
'Elija el archivo .strata o .gguf del modelo. Si es un modelo .gguf dividido, elija cualquier parte; Strata encuentra la primera y comprueba el conjunto completo.',
|
||||
'No hay archivos de modelo aquí',
|
||||
'Solo se muestran carpetas y archivos .strata o .gguf. Los adaptadores LoRA y los proyectores de imagen necesitan compatibilidad aparte.',
|
||||
'Elija un archivo de modelo de texto completo (.strata o .gguf).',
|
||||
'¿Quitar este modelo de Strata?',
|
||||
'Conservar el modelo',
|
||||
'Solo se quita la entrada en Strata. Sus archivos .strata o .gguf se quedan donde están y no se modifican.',
|
||||
],
|
||||
pt: [
|
||||
'Usar ficheiros de modelo locais (.strata ou .gguf)…',
|
||||
'Já tem um modelo compatível neste computador, como um ajuste fino ou uma quantização compatível? Escolha a pasta que contém os seus ficheiros, ou um dos ficheiros .strata ou .gguf. O Strata verifica-os, prepara o modelo e carrega-o. Nada é copiado nem transferido, e os seus ficheiros nunca são alterados.',
|
||||
'Pasta com os ficheiros do modelo, ou um ficheiro .strata ou .gguf',
|
||||
'O Strata executa o Qwen3.8-Flash-Next, o Qwen3.6-35B-A3B, o HY-4 Flash e o Inkling-2-Mini, e os ajustes finos e quantizações compatíveis deles. Transfira um em Modelos, ou escolha os seus ficheiros .strata ou .gguf.',
|
||||
'Confirme que a pasta contém ficheiros .strata ou .gguf completos e tente de novo. O ficheiro indicado em Detalhes diz o que está errado.',
|
||||
'Versão personalizada',
|
||||
'Versão mais próxima:',
|
||||
'É assim que o modelo aparece no Strata. Os seus ficheiros ficam onde estão.',
|
||||
'Dê um nome a este modelo.',
|
||||
'Remover do Strata',
|
||||
'Versão personalizada · Não carregado. Abra Modelos para o carregar.',
|
||||
'Ficheiro de modelo local ·',
|
||||
'Escolha o ficheiro .strata ou .gguf do modelo. Num modelo .gguf dividido, escolha qualquer parte; o Strata encontra a primeira e verifica o conjunto completo.',
|
||||
'Não há ficheiros de modelo aqui',
|
||||
'Só são mostradas pastas e ficheiros .strata ou .gguf. Os adaptadores LoRA e os projetores de imagem precisam de suporte à parte.',
|
||||
'Escolha um ficheiro de modelo de texto completo (.strata ou .gguf).',
|
||||
'Remover este modelo do Strata?',
|
||||
'Manter o modelo',
|
||||
'Só a entrada no Strata é removida. Os seus ficheiros .strata ou .gguf ficam onde estão e não são alterados.',
|
||||
],
|
||||
ru: [
|
||||
'Использовать локальные файлы модели (.strata или .gguf)…',
|
||||
'Уже есть поддерживаемая модель на этом компьютере, например совместимая дообученная версия или квантизация? Выберите папку с её файлами или один из файлов .strata или .gguf. Strata проверит их, подготовит модель и загрузит её. Ничего не копируется и не скачивается, а ваши файлы никогда не изменяются.',
|
||||
'Папка с файлами модели или один файл .strata или .gguf',
|
||||
'Strata запускает Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash и Inkling-2-Mini, а также их совместимые дообученные версии и квантизации. Скачайте одну в разделе «Модели» или выберите её файлы .strata или .gguf.',
|
||||
'Проверьте, что в папке лежат полные файлы .strata или .gguf, и повторите попытку. Файл, названный в разделе «Подробности», показывает, что не так.',
|
||||
'Своя сборка',
|
||||
'Ближайшая сборка:',
|
||||
'Так модель будет показана в Strata. Ваши файлы остаются на месте.',
|
||||
'Дайте этой модели имя.',
|
||||
'Убрать из Strata',
|
||||
'Своя сборка · Не загружена. Откройте «Модели», чтобы загрузить её.',
|
||||
'Локальный файл модели ·',
|
||||
'Выберите файл модели .strata или .gguf. Для модели .gguf из нескольких частей выберите любую часть: Strata найдёт первую и проверит весь набор.',
|
||||
'Здесь нет файлов модели',
|
||||
'Показаны только папки и файлы .strata или .gguf. Адаптеры LoRA и проекторы изображений требуют отдельной поддержки.',
|
||||
'Выберите полный файл текстовой модели (.strata или .gguf).',
|
||||
'Убрать эту модель из Strata?',
|
||||
'Оставить модель',
|
||||
'Убирается только запись в Strata. Ваши файлы .strata или .gguf остаются на месте и не изменяются.',
|
||||
],
|
||||
zh: [
|
||||
'使用本地模型文件(.strata 或 .gguf)…',
|
||||
'这台电脑上已有受支持的模型,例如兼容的微调版或量化版?请选择存放其文件的文件夹,或选择其中一个 .strata 或 .gguf 文件。Strata 会检查文件、准备模型并加载。不会复制或下载任何内容,也不会修改您的文件。',
|
||||
'存放模型文件的文件夹,或一个 .strata 或 .gguf 文件',
|
||||
'Strata 可运行 Qwen3.8-Flash-Next、Qwen3.6-35B-A3B、HY-4 Flash 和 Inkling-2-Mini,以及它们兼容的微调版和量化版。请在“模型”中下载其一,或选择其 .strata 或 .gguf 文件。',
|
||||
'请确认文件夹中是完整的 .strata 或 .gguf 文件,然后重试。“详细信息”中列出的文件会说明问题所在。',
|
||||
'自定义版本',
|
||||
'最接近的版本:',
|
||||
'这是该模型在 Strata 中的显示名称。您的文件保持在原处。',
|
||||
'请为此模型起个名字。',
|
||||
'从 Strata 移除',
|
||||
'自定义版本 · 未加载。打开“模型”即可加载。',
|
||||
'本地模型文件 ·',
|
||||
'请选择模型的 .strata 或 .gguf 文件。对于拆分的 .gguf 模型,选择任意一个分片即可;Strata 会找到第一个分片并检查整套文件。',
|
||||
'这里没有模型文件',
|
||||
'只显示文件夹以及 .strata 或 .gguf 文件。LoRA 适配器和图像投影器需要另行支持。',
|
||||
'请选择完整的文本模型文件(.strata 或 .gguf)。',
|
||||
'要将此模型从 Strata 移除吗?',
|
||||
'保留模型',
|
||||
'只会移除 Strata 中的条目。您的 .strata 或 .gguf 文件保持在原处,不会被修改。',
|
||||
],
|
||||
ja: [
|
||||
'ローカルのモデルファイルを使う(.strata または .gguf)…',
|
||||
'このコンピューターに、対応するモデル(互換性のあるファインチューンや量子化版など)がすでにありますか。そのファイルが入っているフォルダー、または .strata か .gguf のファイルを選んでください。Strata がファイルを確認し、モデルを準備して読み込みます。コピーもダウンロードも行わず、ファイルが変更されることはありません。',
|
||||
'モデルファイルのフォルダー、または .strata か .gguf のファイル',
|
||||
'Strata は Qwen3.8-Flash-Next、Qwen3.6-35B-A3B、HY-4 Flash、Inkling-2-Mini と、その互換のファインチューンや量子化版を実行できます。「モデル」からダウンロードするか、その .strata または .gguf ファイルを選んでください。',
|
||||
'フォルダーに完全な .strata または .gguf ファイルがあることを確認して、もう一度お試しください。「詳細」に示されたファイルが問題の箇所です。',
|
||||
'カスタム版',
|
||||
'最も近い版:',
|
||||
'Strata でのモデルの表示名です。ファイルは元の場所に残ります。',
|
||||
'このモデルに名前を付けてください。',
|
||||
'Strata から削除',
|
||||
'カスタム版 · 未読み込み。「モデル」を開いて読み込みます。',
|
||||
'ローカルのモデルファイル ·',
|
||||
'モデルの .strata または .gguf ファイルを選んでください。分割された .gguf モデルは、どの分割でも構いません。Strata が最初の分割を見つけ、全体を確認します。',
|
||||
'ここにはモデルファイルがありません',
|
||||
'フォルダーと .strata または .gguf ファイルだけを表示しています。LoRA アダプターと画像プロジェクターは別途の対応が必要です。',
|
||||
'完全なテキストモデルのファイル(.strata または .gguf)を選んでください。',
|
||||
'このモデルを Strata から削除しますか?',
|
||||
'モデルを残す',
|
||||
'Strata の登録だけが削除されます。.strata や .gguf のファイルは元の場所に残り、変更されません。',
|
||||
],
|
||||
ko: [
|
||||
'로컬 모델 파일 사용(.strata 또는 .gguf)…',
|
||||
'이 컴퓨터에 지원되는 모델(호환되는 파인튜닝 또는 양자화 버전 등)이 이미 있나요? 파일이 들어 있는 폴더나 .strata 또는 .gguf 파일 하나를 선택하세요. Strata가 파일을 확인하고 모델을 준비해 불러옵니다. 아무것도 복사하거나 다운로드하지 않으며, 파일은 절대 변경되지 않습니다.',
|
||||
'모델 파일이 있는 폴더 또는 .strata 또는 .gguf 파일 하나',
|
||||
'Strata는 Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash, Inkling-2-Mini와 이들의 호환되는 파인튜닝 및 양자화 버전을 실행합니다. 모델에서 하나를 내려받거나 해당 .strata 또는 .gguf 파일을 선택하세요.',
|
||||
'폴더에 완전한 .strata 또는 .gguf 파일이 있는지 확인한 뒤 다시 시도하세요. 세부 정보에 표시된 파일이 문제의 원인을 알려 줍니다.',
|
||||
'사용자 지정 버전',
|
||||
'가장 가까운 버전:',
|
||||
'Strata에 표시되는 모델 이름입니다. 파일은 원래 위치에 그대로 있습니다.',
|
||||
'이 모델의 이름을 정해 주세요.',
|
||||
'Strata에서 제거',
|
||||
'사용자 지정 버전 · 불러오지 않음. 모델을 열어 불러오세요.',
|
||||
'로컬 모델 파일 ·',
|
||||
'모델의 .strata 또는 .gguf 파일을 선택하세요. 분할된 .gguf 모델은 어느 조각을 골라도 됩니다. Strata가 첫 조각을 찾아 전체를 확인합니다.',
|
||||
'여기에는 모델 파일이 없습니다',
|
||||
'폴더와 .strata 또는 .gguf 파일만 표시됩니다. LoRA 어댑터와 이미지 프로젝터는 별도 지원이 필요합니다.',
|
||||
'완전한 텍스트 모델 파일(.strata 또는 .gguf)을 선택하세요.',
|
||||
'이 모델을 Strata에서 제거할까요?',
|
||||
'모델 유지',
|
||||
'Strata의 항목만 제거됩니다. .strata 또는 .gguf 파일은 원래 위치에 그대로 있으며 변경되지 않습니다.',
|
||||
],
|
||||
he: [
|
||||
'שימוש בקובצי מודל מקומיים (.strata או .gguf)…',
|
||||
'כבר יש לכם במחשב הזה מודל נתמך, למשל כוונון עדין או כימות תואם? בחרו את התיקייה שמכילה את הקבצים שלו, או אחד מקובצי ה-.strata או ה-.gguf שלו. Strata בודקת אותם, מכינה את המודל וטוענת אותו. שום דבר לא מועתק ולא מורד, והקבצים שלכם לא משתנים לעולם.',
|
||||
'תיקייה עם קובצי המודל, או קובץ .strata או .gguf אחד',
|
||||
'Strata מריצה את Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash ו-Inkling-2-Mini, ואת הכוונונים העדינים והכימותים התואמים שלהם. הורידו אחד מתוך מודלים, או בחרו את קובצי ה-.strata או ה-.gguf שלו.',
|
||||
'ודאו שהתיקייה מכילה קובצי .strata או .gguf שלמים ונסו שוב. הקובץ שמופיע תחת פרטים מראה מה לא בסדר.',
|
||||
'גרסה מותאמת',
|
||||
'הגרסה הקרובה ביותר:',
|
||||
'כך המודל מופיע ב-Strata. הקבצים שלכם נשארים במקומם.',
|
||||
'תנו שם למודל הזה.',
|
||||
'הסרה מ-Strata',
|
||||
'גרסה מותאמת · לא נטען. פתחו את מודלים כדי לטעון אותו.',
|
||||
'קובץ מודל מקומי ·',
|
||||
'בחרו את קובץ ה-.strata או ה-.gguf של המודל. במודל .gguf מפוצל אפשר לבחור כל חלק; Strata מוצאת את הראשון ובודקת את הקבוצה כולה.',
|
||||
'אין כאן קובצי מודל',
|
||||
'מוצגים רק תיקיות וקובצי .strata או .gguf. מתאמי LoRA ומקרני תמונה דורשים תמיכה נפרדת.',
|
||||
'בחרו קובץ מודל טקסט שלם (.strata או .gguf).',
|
||||
'להסיר את המודל הזה מ-Strata?',
|
||||
'להשאיר את המודל',
|
||||
'רק הרישום ב-Strata יוסר. קובצי ה-.strata או ה-.gguf שלכם נשארים במקומם ולא משתנים.',
|
||||
],
|
||||
};
|
||||
for (const [lang, values] of Object.entries(T)) {
|
||||
if (values.length !== KEYS.length) throw new Error(`${lang}: ${values.length} strings, expected ${KEYS.length}`);
|
||||
const file = join(dir, `gtui-${lang}.json`);
|
||||
const data = JSON.parse(readFileSync(file, 'utf8'));
|
||||
// French: a no-break space (U+00A0) before ; : ? ! (tests/french-typography-all.test.mjs).
|
||||
const typeset = lang === 'fr' ? v => v.replace(/(?<=\S) ([;:?!])/g, ' $1') : v => v;
|
||||
KEYS.forEach((k, i) => { data[k] = typeset(values[i]); });
|
||||
writeFileSync(file, JSON.stringify(data, null, 1) + '\n');
|
||||
}
|
||||
console.log('ok');
|
||||
@@ -1,20 +1,27 @@
|
||||
/** Local GGUF references. Adding/removing a reference never copies or deletes the user's weights. */
|
||||
import { accessSync, constants, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { accessSync, closeSync, constants, mkdirSync, openSync, readSync, readdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { basename, dirname, extname, isAbsolute, join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { readGGUF } from './gguf.mjs';
|
||||
const ARCHITECTURES=new Set(['qwen2','qwen2moe','qwen3','qwen3moe','qwen3next','qwen35','qwen35moe','qwen4exp','llama','gemma','gemma2','gemma3','phi3']);
|
||||
const ARCHITECTURES=new Set(['qwen2','qwen2moe','qwen3','qwen3moe','qwen3next','qwen35','qwen35moe','qwen4exp','llama','gemma','gemma2','gemma3','phi3','inkling2','inkling2_loop','hy4','hy4flash']);
|
||||
/** Architectures only Strata's own engines run (the other names above are also read by the llama-server route): their GGUF metadata keys can differ, so a missing size key falls back to a plain default instead of refusing a file the engine reads. */
|
||||
const ENGINE_ARCHITECTURES=new Set(['qwen4exp','qwen35moe','inkling2','inkling2_loop','hy4','hy4flash']);
|
||||
const STRATA_MAGIC=Buffer.from([0x53,0x54,0x52,0x41,0x54,0x41,0x00,0x01]);
|
||||
export const STRATA_MIN_BYTES=32;
|
||||
/** A name the person sees: printable characters only, no path separators, at most 160 characters. */
|
||||
export const cleanLabel=value=>String(value??'').replace(/[\x00-\x1f\x7f\\/]/g,' ').replace(/\s+/g,' ').trim().slice(0,160);
|
||||
const QUANTS={0:'F32',1:'F16',2:'Q4_0',3:'Q4_1',7:'Q8_0',8:'Q5_0',9:'Q5_1',10:'Q2_K',11:'Q3_K_S',12:'Q3_K_M',13:'Q3_K_L',14:'Q4_K_S',15:'Q4_K_M',16:'Q5_K_S',17:'Q5_K_M',18:'Q6_K',19:'IQ2_XXS',20:'IQ2_XS',21:'Q2_K_S',22:'IQ3_XS',23:'IQ3_XXS',24:'IQ1_S',25:'IQ4_NL',26:'IQ3_S',27:'IQ3_M',28:'IQ2_S',29:'IQ2_M',30:'IQ4_XS',31:'IQ1_M',32:'BF16'};
|
||||
const clean=value=>String(value??'').replace(/[\x00-\x1f\x7f]/g,' ').trim().slice(0,160);
|
||||
function fullPath(input){if(typeof input!=='string'||!input.trim()||input.includes('\0'))throw new Error('Choose a model file or enter its full path.');const path=input.trim().replace(/^~(?=$|[\\/])/,homedir());if(!isAbsolute(path))throw new Error('Enter a full path.');try{return realpathSync(path);}catch{throw new Error('This file or folder is unavailable. Check its location and permissions.');}}
|
||||
export function browseLocalModels(input){
|
||||
const directory=fullPath(input);if(!statSync(directory).isDirectory())throw new Error('Choose a folder to browse.');
|
||||
const entries=readdirSync(directory,{withFileTypes:true}).filter(e=>!e.name.startsWith('.')).map(e=>{try{const path=join(directory,e.name),s=statSync(path);if(s.isDirectory())return {name:e.name,path,kind:'folder'};if(s.isFile()&&extname(e.name).toLowerCase()==='.gguf')return {name:e.name,path,kind:'model',bytes:s.size};}catch{}return null;}).filter(Boolean).sort((a,b)=>(a.kind==='folder'?0:1)-(b.kind==='folder'?0:1)||a.name.localeCompare(b.name));
|
||||
const entries=readdirSync(directory,{withFileTypes:true}).filter(e=>!e.name.startsWith('.')).map(e=>{try{const path=join(directory,e.name),s=statSync(path);if(s.isDirectory())return {name:e.name,path,kind:'folder'};if(s.isFile()&&['.gguf','.strata'].includes(extname(e.name).toLowerCase()))return {name:e.name,path,kind:'model',bytes:s.size};}catch{}return null;}).filter(Boolean).sort((a,b)=>(a.kind==='folder'?0:1)-(b.kind==='folder'?0:1)||a.name.localeCompare(b.name));
|
||||
return {directory,parent:dirname(directory)===directory?null:dirname(directory),entries:entries.slice(0,1000),truncated:entries.length>1000};
|
||||
}
|
||||
export function inspectLocalModel(input){
|
||||
let file=fullPath(input);if(extname(file).toLowerCase()!=='.gguf')throw new Error('Select a .gguf model file. Folders and adapters cannot be loaded as a chat model.');
|
||||
let file=fullPath(input);if(extname(file).toLowerCase()==='.strata')return inspectStrataFile(file);
|
||||
if(extname(file).toLowerCase()!=='.gguf')throw new Error('Select a .strata or .gguf model file. Folders and adapters cannot be loaded as a chat model.');
|
||||
if(/^mmproj/i.test(basename(file)))throw new Error('This is a picture reader (mmproj), not a model. Choose the model’s own .gguf file; a model that reads pictures needs its reader in the same folder.');
|
||||
if(!statSync(file).isFile())throw new Error('Select the model’s .gguf file, rather than its folder.');
|
||||
accessSync(file,constants.R_OK);
|
||||
@@ -29,8 +36,8 @@ export function inspectLocalModel(input){
|
||||
if(!ARCHITECTURES.has(arch))throw new Error(`The declared architecture ${clean(arch)||'(missing)'} is not supported by this importer. This model type isn’t supported by the Strata engine; add it as a Custom model API (llama-server) instead.`);
|
||||
if(m['general.type']&&m['general.type']!=='model')throw new Error('This is an adapter or auxiliary file. Choose the full model GGUF.');
|
||||
if(!m['tokenizer.ggml.model']||!m['tokenizer.ggml.tokens']?.count)throw new Error('This GGUF does not include its tokenizer. Choose the full model, not an adapter. A picture reader (mmproj) goes next to its model, not in its place.');
|
||||
const integer=(key,min,max)=>{const value=m[key];if(!Number.isInteger(value)||value<min||value>max)throw new Error(`Missing or invalid ${key} metadata. This model cannot be configured safely.`);return value;};
|
||||
const context=integer(`${arch}.context_length`,1024,100_000_000),layers=integer(`${arch}.block_count`,1,4096),embedding=integer(`${arch}.embedding_length`,1,1_000_000),heads=integer(`${arch}.attention.head_count`,1,8192);
|
||||
const integer=(key,min,max,engineDefault)=>{const value=m[key];if(value===undefined&&engineDefault!==undefined&&ENGINE_ARCHITECTURES.has(arch))return engineDefault;if(!Number.isInteger(value)||value<min||value>max)throw new Error(`Missing or invalid ${key} metadata. This model cannot be configured safely.`);return value;};
|
||||
const context=integer(`${arch}.context_length`,1024,100_000_000,32768),layers=integer(`${arch}.block_count`,1,4096,1),embedding=integer(`${arch}.embedding_length`,1,1_000_000,1024),heads=integer(`${arch}.attention.head_count`,1,8192,8);
|
||||
const kvHeads=m[`${arch}.attention.head_count_kv`]??heads,keyLength=m[`${arch}.attention.key_length`]??embedding/heads,valueLength=m[`${arch}.attention.value_length`]??keyLength,experts=m[`${arch}.expert_count`]??0;
|
||||
if(![kvHeads,keyLength,valueLength].every(n=>Number.isInteger(n)&&n>=1&&n<=1_000_000)||!Number.isInteger(experts)||experts<0||experts>100_000)throw new Error('This model has invalid attention or expert metadata.');
|
||||
const count=m['split.count']??1;if(!Number.isInteger(count)||count<1||count>256)throw new Error('This split model has an unsupported number of shards.');
|
||||
@@ -49,6 +56,25 @@ export function inspectLocalModel(input){
|
||||
const variant={id,name,family:'Local models',quant,label:`${name} · ${quant}`,params:parameters>=1e9?`${(parameters/1e9).toFixed(1)}B`:`${Math.round(parameters/1e6)}M`,blurb:'Local model. Engine compatibility is checked when loading.',role:'option',tier:'local',ramClass:{minGb:gb+2,maxGb:gb+6,label:'From GGUF metadata'},diskGb:gb,downloadGb:0,contextMax:Math.min(context,1048576),layerCount:layers,experts,kvKbPerToken:layers*kvHeads*(keyLength+valueLength)/1024,hasDraft:false,kvModes:['INT8','FP16'],tags:['local'],source:{repo:'local',file:basename(file),bytes},local};
|
||||
return {variant,files:names,warnings:[...(local.hasChatTemplate?[]:['No chat template was declared. Response formatting depends on the engine.']),'Memory is estimated from metadata; engine support and actual allocation are checked when loading.']};
|
||||
}
|
||||
/** The name a person gives a custom build (sent to setup as --custom-label): a short printable string, never a path. Empty or not a string: undefined. */
|
||||
export function customLabel(value){
|
||||
if(typeof value!=='string')return undefined;
|
||||
const label=value.replace(/[\x00-\x1f\x7f\\/:*?"<>|]/g,' ').replace(/^[-\s.]+/,'').replace(/\s+/g,' ').trim().slice(0,80).trim();
|
||||
return label||undefined;
|
||||
}
|
||||
/** A local .strata file: only its 8-byte magic and its size are read (no tensor parse; Strata's engine reads the manifest when it loads). */
|
||||
function inspectStrataFile(file){
|
||||
const stat=statSync(file);if(!stat.isFile())throw new Error('Select the model’s .strata file, rather than its folder.');
|
||||
if(/vision|engram/i.test(basename(file)))throw new Error('This is a picture reader or helper shard, not a model. Choose the model’s own .strata file; Strata finds helper files next to it.');
|
||||
accessSync(file,constants.R_OK);
|
||||
if(stat.size<STRATA_MIN_BYTES)throw new Error('This .strata file is empty or cut short.');
|
||||
const head=Buffer.alloc(STRATA_MAGIC.length),fd=openSync(file,'r');try{readSync(fd,head,0,head.length,0);}finally{closeSync(fd);}
|
||||
if(!head.equals(STRATA_MAGIC))throw new Error('This file does not begin with a STRATA header. Choose a complete .strata model file.');
|
||||
const name=cleanLabel(basename(file).replace(/\.strata$/i,''))||'Local model',id=`local-${createHash('sha256').update(file).digest('hex').slice(0,24)}`,gb=stat.size/1024**3;
|
||||
const local={path:file,files:[{path:file,bytes:stat.size,mtimeMs:stat.mtimeMs,ctimeMs:stat.ctimeMs}],architecture:'strata',hasChatTemplate:false,contextLength:32768,shards:1,metadataSignature:createHash('sha256').update(`${stat.size}:${basename(file)}`).digest('hex')};
|
||||
const variant={id,name,family:'Local models',quant:'STRATA',label:`${name} · STRATA`,params:'',blurb:'Local model file. Engine compatibility is checked when loading.',role:'option',tier:'local',ramClass:{minGb:gb+2,maxGb:gb+6,label:'From the file size'},diskGb:gb,downloadGb:0,contextMax:32768,layerCount:1,experts:0,kvKbPerToken:0,hasDraft:false,kvModes:['INT8','FP16'],tags:['local'],source:{repo:'local',file:basename(file),bytes:stat.size},local};
|
||||
return {variant,files:[basename(file)],warnings:['Memory is estimated from the file size; engine support and actual allocation are checked when loading.']};
|
||||
}
|
||||
export function createLocalModels(dataDir){
|
||||
mkdirSync(dataDir,{recursive:true});const file=join(dataDir,'local-models.json');let records=[];
|
||||
try{const saved=JSON.parse(readFileSync(file,'utf8'));if(Array.isArray(saved.models))records=saved.models.filter(v=>v?.id?.startsWith('local-')&&v.local?.files?.length&&isAbsolute(v.local.path));}catch{}
|
||||
|
||||
@@ -25,6 +25,7 @@ import { createAutoTune, withTuneConfig } from './native-autotune.mjs';
|
||||
import { plainError, PHASE_TEXT, UPDATE_WAITING_FOR_LOCK, APP_UPDATER_NOT_READY, APP_CHECK_FAILED, CONTROL_UPDATED } from './update-messages.mjs';
|
||||
import { checkAndParseRunConfig, checkRunConfig, describeIssues } from './run-config-check.mjs';
|
||||
import { openTextFile } from './open-text-file.mjs';
|
||||
import { customLabel } from './local-models.mjs';
|
||||
import { markEngine, engineRefusal } from './engine-version.mjs';
|
||||
import { friendlyModelName } from './model-names.mjs';
|
||||
import { parseSaved as parseRoles, mirror as mirrorRoles } from './gpu-roles.mjs';
|
||||
@@ -181,7 +182,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
/* Every folder that holds run configs. Also run before a component job (the engine update test-starts an installed model with its run config) and before a load:
|
||||
an AppImage's Control lives in /tmp/.mount_<random>, a new name at every start, so a path setup wrote there is gone after the app restarts (QAGUI-LIN 0213). */
|
||||
function repairAllControlPaths(){try{for(const dir of [preferences.installDir,packagedInstall,installRoot()])repairControlPaths(dir);}catch{/* the read that follows reports a bad folder */}}
|
||||
function installedInfo(info,catalog){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_.-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* The folder this model's own run config keeps its prepared data in: the one that holds its packs/<tag> (or mtp/rt). It is the real data folder of the model, wherever the app's models folder is; a model in the person's own GGUF folder has its pack and draft layer here, not in the app's folder. A layout that only looks like <data>/models/<tag> says nothing: no pack, no folder. */const flagValue=flag=>{const i=cfg.args?.indexOf(flag)??-1;return i>=0&&typeof cfg.args[i+1]==='string'?cfg.args[i+1]:undefined;};const holder=(path,child,name)=>{if(!path||basename(dirname(path)).toLowerCase()!==child||(name&&basename(path).toLowerCase()!==name))return undefined;return dirname(dirname(path));};const runDataFolder=holder(flagValue('--pack'),'packs')??holder(flagValue('--mtp'),'mtp','rt');/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;const hy4Vis=!!hy4VisionShard(cfg)||!!inklingVisionShard(cfg);return {...entry,...(packaged?{kv:savedKv(cfg,entry.model,catalog)}:{}),ownGgufDir,runDataFolder,diskGb:entry.diskGb??entry.disk_gb,diskBytes:entry.diskBytes??entry.disk_bytes,sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,contextChosen:cfg.ui_context_chosen===true,visionPrepared:(!!cfg.vision||hy4Vis)&&entry.picturesMissing!==true,/* The picture files are prepared when the run config has a vision section (or Hy4-Flash's --vision shard): the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:((!!cfg.vision||hy4Vis)&&entry.picturesMissing!==true)?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',gpuRoles:cfg.gpu_roles&&typeof cfg.gpu_roles==='object'&&!Array.isArray(cfg.gpu_roles)?{...cfg.gpu_roles}:undefined,/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionChosen:cfg.ui_vision_chosen===true,visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
|
||||
function installedInfo(info,catalog){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_.-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* The folder this model's own run config keeps its prepared data in: the one that holds its packs/<tag> (or mtp/rt). It is the real data folder of the model, wherever the app's models folder is; a model in the person's own GGUF folder has its pack and draft layer here, not in the app's folder. A layout that only looks like <data>/models/<tag> says nothing: no pack, no folder. */const flagValue=flag=>{const i=cfg.args?.indexOf(flag)??-1;return i>=0&&typeof cfg.args[i+1]==='string'?cfg.args[i+1]:undefined;};const holder=(path,child,name)=>{if(!path||basename(dirname(path)).toLowerCase()!==child||(name&&basename(path).toLowerCase()!==name))return undefined;return dirname(dirname(path));};const runDataFolder=holder(flagValue('--pack'),'packs')??holder(flagValue('--mtp'),'mtp','rt');/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;const hy4Vis=!!hy4VisionShard(cfg)||!!inklingVisionShard(cfg);return {...entry,...(packaged?{kv:savedKv(cfg,entry.model,catalog)}:{}),ownGgufDir,runDataFolder,diskGb:entry.diskGb??entry.disk_gb??(entry.custom===true&&Number.isFinite(entry.custom_bytes)?entry.custom_bytes/1024**3:undefined),diskBytes:entry.diskBytes??entry.disk_bytes??(entry.custom===true&&Number.isFinite(entry.custom_bytes)?entry.custom_bytes:undefined),sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,contextChosen:cfg.ui_context_chosen===true,visionPrepared:(!!cfg.vision||hy4Vis)&&entry.picturesMissing!==true,/* The picture files are prepared when the run config has a vision section (or Hy4-Flash's --vision shard): the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:((!!cfg.vision||hy4Vis)&&entry.picturesMissing!==true)?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',gpuRoles:cfg.gpu_roles&&typeof cfg.gpu_roles==='object'&&!Array.isArray(cfg.gpu_roles)?{...cfg.gpu_roles}:undefined,/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionChosen:cfg.ui_vision_chosen===true,visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
|
||||
function installRoot(){const found=[preferences.installDir].find(d=>d&&existsSync(d));if(found)return realpathSync(found);mkdirSync(defaultInstall(),{recursive:true});return realpathSync(defaultInstall());}
|
||||
/* The settings file Strata Control and the installer read (control-runtime.mjs sets STRATA_SETTINGS_FILE to it): the app's data folder is written there. */
|
||||
function controlSettingsFile(){return process.env.STRATA_SETTINGS_FILE||join(dirname(componentsDirectory()),'app-settings.json');}
|
||||
@@ -270,7 +271,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
}
|
||||
/* The folder the person picked in the first-run chooser can be the one that holds their GGUF files (or a folder inside it). It is theirs, not a Strata data folder: packs are never made in it, and a Strata folder around it (<Strata>/models/<tag>) is used instead (#3507, #3424). */
|
||||
function ownFilesDataFolder(candidate,args){if(!candidate||args.data_dir!==undefined||!args.gguf_dir)return candidate;const same=(a,b)=>{const x=resolve(a),y=resolve(b);return process.platform==='win32'?x.toLowerCase()===y.toLowerCase():x===y;};const inside=(a,b)=>{const rel=relative(resolve(b),resolve(a));return rel===''||(!!rel&&!rel.startsWith('..')&&!isAbsolute(rel));};if(!same(candidate,args.gguf_dir)&&!inside(candidate,args.gguf_dir))return candidate;const models=dirname(resolve(args.gguf_dir)),top=dirname(models);return basename(models).toLowerCase()==='models'&&/strata/i.test(basename(top))?top:undefined;}
|
||||
function installArgs(args,confirm){const allowed=['family','model','context','vision','kv','gpu','gpus','backend','low_ram','port','gguf_dir','drafter','mtp'];/* One drafter per run: when the choice means DFlash2 the installer does not fetch the MTP layer's ~5 GB (the drafter is fetched by the load); choosing the MTP later fetches the layer once. */if(args.drafter===undefined&&args.drafting!==undefined||args.drafter===undefined&&dflash2Served===true){const d=resolveDrafter(args.drafting,args.family,dflash2Served,dflash2Split);if(d==='dflash2')args={...args,drafter:'dflash2'};else if(d==='off'&&args.mtp===undefined)args={...args,mtp:'off'};}/* Drafting Off: setup is told `--mtp off`, so it fetches no draft layer (the Mac's setup step too: the Terminal's 1821f298d) */const size=snapshot.catalog?.families?.find(f=>f.family===args.family)?.sizes.find(s=>s.model===args.model);const existing=snapshot.installed?.models?.find(m=>m.model===size?.id);/* A model adopted from the person's own GGUF folder reports that folder's parent as its data folder: it is theirs, not Strata's, so a second preparation never uses it for the packs. */if(args.gguf_dir===undefined&&existing?.ownGgufDir)args={...args,gguf_dir:existing.ownGgufDir};/* A model that is installed keeps working in the data folder its own run config names (where its pack and draft layer are), whether its files are under it or in the person's own folder: that is never changed or written to the settings from here. Only a folder taken from the app's models folder is the person's choice, and the one the installer is told about. */const own=args.data_dir===undefined?existing?.runDataFolder:undefined;const data=own??nativeDataDirectory(ownFilesDataFolder(args.data_dir??(args.gguf_dir?undefined:existing?.dataFolder)??preferences.downloadDirectory??modelsDirectory?.(),args));if(data&&packaged&&!args.data_dir&&!own)rememberDataFolder(controlSettingsFile(),data);return {...(data?{data_dir:data}:{}),...Object.fromEntries(allowed.filter(k=>args[k]!==undefined).map(k=>[k,args[k]])),/* One card is "gpu", never "gpus" (the installer wants two or more there: "Gpus='0' is not valid", #3203). */...(/^\d{1,2}$/.test(String(args.gpus??''))?{gpu:Number(args.gpus),gpus:undefined}:{}),/* Picture reading is only downloaded when it was asked for (Read pictures); the default stays the smaller download (Hy4-Flash and Inkling-2-Mini default pictures on). */...(packaged&&args.vision===undefined&&!isHy4Family(args.family)&&!isInklingFamily(args.family)?{vision:'no'}:{}),confirm};}
|
||||
function installArgs(args,confirm){const allowed=['family','model','context','vision','kv','gpu','gpus','backend','low_ram','port','gguf_dir','drafter','mtp'];/* A custom build (the person's own fine-tune or quantization, named by them): the name is cleaned to a short printable string, never a path, and the build is never matched to the official install of the same size (its own run config is written). */const custom=customLabel(args.custom_label);args={...args,custom_label:custom};if(custom)allowed.push('custom_label');/* One drafter per run: when the choice means DFlash2 the installer does not fetch the MTP layer's ~5 GB (the drafter is fetched by the load); choosing the MTP later fetches the layer once. */if(args.drafter===undefined&&args.drafting!==undefined||args.drafter===undefined&&dflash2Served===true){const d=resolveDrafter(args.drafting,args.family,dflash2Served,dflash2Split);if(d==='dflash2')args={...args,drafter:'dflash2'};else if(d==='off'&&args.mtp===undefined)args={...args,mtp:'off'};}/* Drafting Off: setup is told `--mtp off`, so it fetches no draft layer (the Mac's setup step too: the Terminal's 1821f298d) */const size=snapshot.catalog?.families?.find(f=>f.family===args.family)?.sizes.find(s=>s.model===args.model);const existing=custom?undefined:snapshot.installed?.models?.find(m=>m.model===size?.id);/* A model adopted from the person's own GGUF folder reports that folder's parent as its data folder: it is theirs, not Strata's, so a second preparation never uses it for the packs. */if(args.gguf_dir===undefined&&existing?.ownGgufDir)args={...args,gguf_dir:existing.ownGgufDir};/* A model that is installed keeps working in the data folder its own run config names (where its pack and draft layer are), whether its files are under it or in the person's own folder: that is never changed or written to the settings from here. Only a folder taken from the app's models folder is the person's choice, and the one the installer is told about. */const own=args.data_dir===undefined?existing?.runDataFolder:undefined;const data=own??nativeDataDirectory(ownFilesDataFolder(args.data_dir??(args.gguf_dir?undefined:existing?.dataFolder)??preferences.downloadDirectory??modelsDirectory?.(),args));if(data&&packaged&&!args.data_dir&&!own)rememberDataFolder(controlSettingsFile(),data);return {...(data?{data_dir:data}:{}),...Object.fromEntries(allowed.filter(k=>args[k]!==undefined).map(k=>[k,args[k]])),/* One card is "gpu", never "gpus" (the installer wants two or more there: "Gpus='0' is not valid", #3203). */...(/^\d{1,2}$/.test(String(args.gpus??''))?{gpu:Number(args.gpus),gpus:undefined}:{}),/* Picture reading is only downloaded when it was asked for (Read pictures); the default stays the smaller download (Hy4-Flash and Inkling-2-Mini default pictures on). */...(packaged&&args.vision===undefined&&!isHy4Family(args.family)&&!isInklingFamily(args.family)?{vision:'no'}:{}),confirm};}
|
||||
|
||||
function begin(kind,run,metadata={}){if([...jobs.values()].some(j=>j.state==='running'))throw new Error('Finish or cancel the current engine operation first.');const job={id:randomUUID(),kind,state:'running',startedAt:new Date().toISOString(),summary:'Starting…',result:null,error:null,...metadata};for(const [id,old] of jobs)if(jobs.size>=12&&old.state!=='running')jobs.delete(id);jobs.set(job.id,job);emit();void run(job).then(result=>{if(job.state==='running'){Object.assign(job,{state:'done',summary:result?.summary??'Complete',result,finishedAt:new Date().toISOString()});}}).catch(error=>{if(job.state==='running')Object.assign(job,{state:'error',error:error.message,summary:error.message,...(error.details?{details:error.details}:{}),finishedAt:new Date().toISOString()});}).finally(()=>{if(job.kind.startsWith('update')||job.kind==='rollback')disconnect();lastRead=0;emit();void refresh(true);});return state().jobs.find(j=>j.id===job.id);}
|
||||
async function watchInstall(job,current){job.summary=current.step??'Resuming preparation status…';job.result={install:current};while(job.state==='running'){await new Promise(r=>setTimeout(r,1500));const result=await tool('strata_install');job.summary=result.summary;job.result=result;emit();if(!result.install?.running){if(result.install?.exit_code!==0)throw new Error(result.install?.error??'Preparation did not finish. Retry to reuse completed files.');return {summary:'Model preparation complete. Load it from Models.'};}}}
|
||||
@@ -313,12 +314,14 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
if(result.install.exit_code!==0)throw new Error(result.install.error??result.summary);
|
||||
if(engineTask){job.summary='Model files are ready. Finishing the engine for this PC…';emit();await engineTask;publish(result);}
|
||||
await refresh(true);
|
||||
/* A custom build has its own run config id (Control names it in the install result as run_id; else the installed row that carries the person's label): the load and the saved choices go to it, never to the official model of the same size. */
|
||||
const customName=customLabel(args.custom_label),customRow=customName?(snapshot.installed?.models??[]).find(m=>m.custom&&(m.model===result.install.run_id||m.display_name===customName)):undefined,customId=customName?(typeof result.install.run_id==='string'&&result.install.run_id?result.install.run_id:customRow?.model):undefined;
|
||||
const note=engineStep?.summaryNote();
|
||||
const finalResult=engineStep?job.result:result;
|
||||
if(note)return {...finalResult,summary:note};
|
||||
/* A context the person picked is kept with a marker (ui_context_chosen), so only an old saved 32K, which has no marker, is read as the old default. */
|
||||
if(args.contextChosen===true){try{const id=(result.install.family??args.family??'qwen')==='qwen'?String(args.model).toLowerCase():`${args.family}-${String(args.model).toLowerCase()}`;rememberSetting(record(id).path,'ui_context_chosen',true);}catch{/* the install itself is done */}}
|
||||
if(args.loadAfter){const model=(result.install.family??args.family??'qwen')==='qwen'?String(args.model).toLowerCase():`${args.family}-${String(args.model).toLowerCase()}`;const gpusArr=Array.isArray(args.gpus)?args.gpus:typeof args.gpus==='string'?args.gpus.split(',').map(Number).filter(Number.isInteger):args.gpu!==undefined&&Number.isInteger(Number(args.gpu))?[Number(args.gpu)]:undefined;return loadEngine(job,{model,firstLoad:true,multiple:!!args.multiple,resourceProfile:args.resourceProfile,vision:args.loadVision,...(args.visionUnavailable===true?{visionUnavailable:true}:{}),...(args.gpuRoles!==undefined?{gpuRoles:args.gpuRoles}:gpusArr?.length?{gpus:gpusArr}:{}),...(typeof args.drafting==='string'?{values:{drafting:args.drafting}}:{})});}
|
||||
if(args.contextChosen===true){try{const id=customId??((result.install.family??args.family??'qwen')==='qwen'?String(args.model).toLowerCase():`${args.family}-${String(args.model).toLowerCase()}`);rememberSetting(record(id).path,'ui_context_chosen',true);}catch{/* the install itself is done */}}
|
||||
if(args.loadAfter){const model=customId??((result.install.family??args.family??'qwen')==='qwen'?String(args.model).toLowerCase():`${args.family}-${String(args.model).toLowerCase()}`);const gpusArr=Array.isArray(args.gpus)?args.gpus:typeof args.gpus==='string'?args.gpus.split(',').map(Number).filter(Number.isInteger):args.gpu!==undefined&&Number.isInteger(Number(args.gpu))?[Number(args.gpu)]:undefined;return loadEngine(job,{model,firstLoad:true,multiple:!!args.multiple,resourceProfile:args.resourceProfile,vision:args.loadVision,...(args.visionUnavailable===true?{visionUnavailable:true}:{}),...(args.gpuRoles!==undefined?{gpuRoles:args.gpuRoles}:gpusArr?.length?{gpus:gpusArr}:{}),...(typeof args.drafting==='string'?{values:{drafting:args.drafting}}:{})});}
|
||||
return finalResult;
|
||||
}
|
||||
}
|
||||
@@ -335,14 +338,16 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
|
||||
async function removeModel(job,args){if(!safeId(args.model))throw new Error('Choose an installed model.');
|
||||
if(externalRunning().length)throw new Error('Stop the native server running outside this UI before deleting a model.');
|
||||
for(const instance of [...instances.values()].filter(i=>i.model===args.model)){if(busy(requests().filter(r=>r.instanceId===instance.id)))throw new Error('Finish or cancel requests before deleting this model.');await unload(instance.id);}
|
||||
job.summary='Deleting downloaded files…';emit();
|
||||
/* A custom build is a reference to the person's own files: only Strata's run config is removed (Control does it), the model files stay where they are. */
|
||||
const customRow=(snapshot.installed?.models??[]).find(m=>m.model===args.model&&m.custom===true);
|
||||
job.summary=customRow?'Removing from Strata…':'Deleting downloaded files…';emit();
|
||||
const result=await tool('strata_remove',{model:args.model,confirm:true});
|
||||
if(result.failed?.length)throw new Error(`Some files could not be removed: ${result.failed.slice(0,3).join('; ')}`);
|
||||
await refresh(true);
|
||||
/* Verify it is really gone: the model must no longer be listed as installed, and the files the plan named must not exist. */
|
||||
const still=(result.plan?.remove??[]).map(i=>i.path).filter(p=>{try{return existsSync(p);}catch{return false;}});
|
||||
if(still.length)throw new Error(`Some files could not be removed: ${still.slice(0,3).map(p=>basename(p)).join('; ')}`);
|
||||
return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
return {summary:result.summary??(customRow?'Removed from Strata. Your model files were left in place.':'Deleted'),removed:result.plan?.gb??null};}
|
||||
/* The configuration a load starts the engine with (before its port and key): the saved model config, the user's choices and the resource profile. The tuner measures exactly this, so a saved tuning belongs to the same choices a load makes. */
|
||||
/* A DeepSeek run config (Strata 0.2.13 and earlier; strata_control/retired.py): this Strata does not start it, and no app setting ever writes it. */
|
||||
const retiredDeepSeek=config=>/^deepseek/i.test(String(config?.arch??''))||/strata-dsv41/i.test(String(config?.exe??''));
|
||||
@@ -628,7 +633,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
|
||||
if(!args.multiple){if(busy(requests().filter(r=>instances.has(r.instanceId))))throw new Error('Finish or cancel native requests before switching models.');for(const id of [...instances.keys()])await unload(id);}else if(matching)await unload(matching.id);
|
||||
if(job.state!=='running')return;
|
||||
writeFileSync(configPath,JSON.stringify(cfg,null,2),{mode:0o600});
|
||||
const instance={id,apiModelId,fingerprint,context:entry.context??0,aliases:cfg.aliases??[],arch:isHy4(cfg)?'hy4flash':isInkling(cfg)?'inkling2_loop':(cfg.arch??null),vision:isHy4(cfg)?!!hy4VisionShard(cfg):isInkling(cfg)?!!inklingVisionShard(cfg):!!cfg.vision,resourceProfile:cfg.ui_resource_profile??null,model:args.model,label:friendlyModelName(snapshot.catalog,args.model)??entry.model_name??args.model,port:cfg.port,gpus:Array.isArray(cfg.gpu)?cfg.gpu:cfg.gpu===undefined?[]:[cfg.gpu],status:'loading',phase:'loading',parallel:cfg.parallel??1,mcpServers:cfg.mcp_servers??cfg.mcpServers??{},mcpTimeoutS:cfg.mcp_timeout_s??null,key,configPath,loadedAt:new Date().toISOString(),metrics:null,error:null,...(picturesNote?{picturesNote}:{})};
|
||||
const instance={id,apiModelId,fingerprint,context:entry.context??0,aliases:cfg.aliases??[],arch:isHy4(cfg)?'hy4flash':isInkling(cfg)?'inkling2_loop':(cfg.arch??null),vision:isHy4(cfg)?!!hy4VisionShard(cfg):isInkling(cfg)?!!inklingVisionShard(cfg):!!cfg.vision,resourceProfile:cfg.ui_resource_profile??null,model:args.model,...(entry.custom===true?{custom:true}:{}),label:((entry.custom===true&&(entry.display_name||entry.model_name))||friendlyModelName(snapshot.catalog,args.model))??entry.model_name??args.model,port:cfg.port,gpus:Array.isArray(cfg.gpu)?cfg.gpu:cfg.gpu===undefined?[]:[cfg.gpu],status:'loading',phase:'loading',parallel:cfg.parallel??1,mcpServers:cfg.mcp_servers??cfg.mcpServers??{},mcpTimeoutS:cfg.mcp_timeout_s??null,key,configPath,loadedAt:new Date().toISOString(),metrics:null,error:null,...(picturesNote?{picturesNote}:{})};
|
||||
/* Another model on the same graphics card: the engine takes the card's free memory, so a second one usually finds none. Loading goes on (recommend, never force); if it fails, the reason is said. */
|
||||
const sharedWith=instance.gpus.length?[...instances.values()].find(i=>i.id!==id&&i.status!=='error'&&i.model!==args.model&&i.gpus.some(g=>instance.gpus.includes(g))):null;
|
||||
const sharedSentence=sharedWith?`GPU ${instance.gpus.find(g=>sharedWith.gpus.includes(g))+1} is already used by ${sharedWith.label}, so this model did not fit there. Load it on another GPU, or unload ${sharedWith.label} first.`:null;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { useId, useRef, useState } from 'react';
|
||||
import { FloatingMenu } from './FloatingMenu';
|
||||
import { Bar, Btn, Dialog, ErrorNotice, Icon } from './ui';
|
||||
import { go, useLifecycle, loadVariant, selectRemoteModel, setSettingsSection, useStore } from '../lib/store';
|
||||
import { pickerGroups, pickerNativeModels, pickerVersionState } from '../lib/model-picker';
|
||||
import { pickerGroups, pickerNativeModels, pickerNativeName, pickerVersionState } from '../lib/model-picker';
|
||||
import { versionFit } from '../lib/model-versions';
|
||||
import type { ModelVariant } from '../lib/types';
|
||||
import { sizeGb } from '../lib/format';
|
||||
@@ -20,7 +20,7 @@ function NativeChatModelPicker() {
|
||||
const [open, setOpen] = useState(false), [error, setError] = useState('');
|
||||
const ref = useRef<HTMLButtonElement>(null);
|
||||
const current = native?.instances.find(i => i.id === native.defaultId);
|
||||
return <><button className="chat-model-badge chat-model-picker" ref={ref} aria-label={tr("Choose model: {0}", [current?.label ?? 'Native model'])} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name="models" size={16}/><span>{tr(current?.label ?? 'Native model')}</span><Icon name="chevron" size={12}/></button>{tr(open ? <FloatingMenu anchor={ref.current} title={tr("Chat model")} width={340} onClose={() => setOpen(false)}>{tr(native?.instances.filter(i => i.status !== 'error').map(i => <button className="menu__item" role="menuitemradio" aria-checked={current?.id === i.id} disabled={streaming || i.status !== 'ready'} key={i.id} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => setOpen(false)).catch(e => setError(e.message))}><Icon name="models"/><span><strong>{tr(i.label)}</strong><small>{tr(i.gpus.map(g => `GPU ${g + 1}`).join(" + ") || "Automatic GPU")}</small></span>{tr(current?.id === i.id ? <Icon name="check" size={16} className="menu__check"/> : null)}</button>))}{tr(providers?.connections.flatMap(c => c.models.map(m => <button className="menu__item" role="menuitem" disabled={streaming} key={`${c.id}-${m.id}`} onClick={() => { selectRemoteModel({ connectionId: c.id, modelId: m.id }); setOpen(false); }}><Icon name="link"/>{m.name} · {c.name}</button>)))}<button className="menu__item" role="menuitem" onClick={() => { setOpen(false); go('models'); }}>{tr("Manage models")}</button>{tr(error ? <p className="small inline-error">{tr(error)}</p> : null)}</FloatingMenu> : null)}</>;
|
||||
return <><button className="chat-model-badge chat-model-picker" ref={ref} aria-label={tr("Choose model: {0}", [current?.label ?? 'Native model'])} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name="models" size={16}/><span>{tr(current?.label ?? 'Native model')}</span><Icon name="chevron" size={12}/></button>{tr(open ? <FloatingMenu anchor={ref.current} title={tr("Chat model")} width={340} onClose={() => setOpen(false)}>{tr(native?.instances.filter(i => i.status !== 'error').map(i => <button className="menu__item" role="menuitemradio" aria-checked={current?.id === i.id} disabled={streaming || i.status !== 'ready'} key={i.id} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => setOpen(false)).catch(e => setError(e.message))}><Icon name="models"/><span><strong>{tr(i.label)}</strong>{tr(i.custom ? <span className="version-tag version-tag--custom">{tr("Custom")}</span> : null)}<small>{tr(i.gpus.map(g => `GPU ${g + 1}`).join(" + ") || "Automatic GPU")}</small></span>{tr(current?.id === i.id ? <Icon name="check" size={16} className="menu__check"/> : null)}</button>))}{tr(providers?.connections.flatMap(c => c.models.map(m => <button className="menu__item" role="menuitem" disabled={streaming} key={`${c.id}-${m.id}`} onClick={() => { selectRemoteModel({ connectionId: c.id, modelId: m.id }); setOpen(false); }}><Icon name="link"/>{m.name} · {c.name}</button>)))}<button className="menu__item" role="menuitem" onClick={() => { setOpen(false); go('models'); }}>{tr("Manage models")}</button>{tr(error ? <p className="small inline-error">{tr(error)}</p> : null)}</FloatingMenu> : null)}</>;
|
||||
}
|
||||
function LegacyChatModelPicker() {
|
||||
const native = useNative();
|
||||
@@ -79,7 +79,7 @@ function LegacyChatModelPicker() {
|
||||
<button ref={trigger} className="chat-model-badge chat-model-picker" aria-label={tr("Choose model: {0}", [apiModel?.name ?? (running?.local ? running.name : running?.family) ?? 'No model loaded'])} title={tr(apiModel ? `${connection?.name} · ${apiModel.id}` : 'View and switch models')} disabled={!library && !providers} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name={apiModel ? 'link' : modelFamilyIcon(running?.family ?? groups[0]?.family)} size={16}/><span>{tr(apiModel?.name ?? (running?.local ? running.name : running?.family) ?? groups[0]?.family ?? 'No model loaded')}</span><Icon name="chevron" size={12}/></button>
|
||||
{tr(open ? <FloatingMenu anchor={trigger.current} title={tr("Models")} width={380} onClose={() => setOpen(false)}>
|
||||
{tr(native?.instances.filter(i => i.status !== 'error').map(i => <button key={i.id} className="menu__item" role="menuitem" disabled={streaming || i.status !== 'ready'} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => { selectRemoteModel(null); setOpen(false); }).catch(e => setError(e.message))}><Icon name="models"/><span>{tr(i.label)}<small>{tr(i.gpus.map(g => `GPU ${g + 1}`).join(" + ") || "Automatic GPU")}</small></span></button>))}<p className="model-picker-heading">{tr("Local models")}</p>
|
||||
{tr(installedNative.map(m => <button key={m.config || m.model} className="menu__item model-picker-option model-picker-api" role="menuitem" disabled={streaming} onClick={() => { setOpen(false); go('models'); }}><span><strong>{tr(m.model_name || m.model)}</strong><small>{tr("Downloaded, not loaded. Open Models to load it.")}</small></span></button>))}
|
||||
{tr(installedNative.map(m => <button key={m.config || m.model} className="menu__item model-picker-option model-picker-api" role="menuitem" disabled={streaming} onClick={() => { setOpen(false); go('models'); }}><span><strong>{tr(pickerNativeName(m))}</strong><small>{tr(m.custom ? "Custom · Not loaded. Open Models to load it." : "Downloaded, not loaded. Open Models to load it.")}</small></span></button>))}
|
||||
{tr(!groups.length && !installedNative.length ? <p className="model-picker-empty">{tr("No local models downloaded yet.")}</p> : null)}
|
||||
{tr(groups.map(({ family, versions }, index) => {
|
||||
const main = versions[0], state = pickerVersionState(main, library!.loaded);
|
||||
|
||||
@@ -77,7 +77,7 @@ export function LocalModelImport({ open, directory, onClose, onChoose }: {
|
||||
};
|
||||
return <Dialog open={open} title={tr("Use a local model")} className="local-model-dialog" onClose={close} actions={<><Btn disabled={pending} onClick={preview ? () => { setPreview(null); setError(''); } : close}>{tr(preview ? 'Choose another file' : 'Cancel')}</Btn>{tr(preview ? <Btn variant="primary" icon="models" disabled={pending || !name.trim()} onClick={() => void useModel()}>{tr(pending ? 'Adding…' : 'Use this model')}</Btn> : null)}</>}>
|
||||
{preview ? <div className="local-model-review">
|
||||
<div className="local-model-review__identity"><Icon name="model-file" size={25}/><div><strong>{preview.variant.name}</strong><small>{tr("Local GGUF \u00B7 ")}{tr(preview.variant.local!.shards === 1 ? 'One file' : `${preview.variant.local!.shards} files found`)}</small></div></div>
|
||||
<div className="local-model-review__identity"><Icon name="model-file" size={25}/><div><strong>{preview.variant.name}</strong><small>{tr("Local model file \u00B7 ")}{tr(preview.variant.local!.shards === 1 ? 'One file' : `${preview.variant.local!.shards} files found`)}</small></div></div>
|
||||
<dl className="local-model-facts"><div><dt>{tr("Architecture")}</dt><dd>{tr(preview.variant.local!.architecture)}</dd></div><div><dt>{tr("Quantization")}</dt><dd>{tr(preview.variant.quant)}</dd></div><div><dt>{tr("Size")}</dt><dd>{tr(fileSize(preview.variant.local!.files.reduce((n, f) => n + f.bytes, 0)))}</dd></div><div><dt>{tr("Context limit")}</dt><dd>{tr(Math.floor(preview.variant.local!.contextLength / 1024).toLocaleString(localeTag()))}{tr("K tokens")}</dd></div></dl>
|
||||
<label className="local-model-name">{tr("Display name")}<input className="st-input" value={name} maxLength={160} onChange={e => setName(e.target.value)} disabled={pending}/></label>
|
||||
<details className="local-model-files"><summary>{tr(preview.variant.local!.shards === 1 ? 'File location' : 'Model files')}</summary><code>{preview.variant.local!.path}</code>{tr(preview.files.length > 1 ? <ul>{tr(preview.files.map(file => <li key={file}>{tr(file)}</li>))}</ul> : null)}</details>
|
||||
@@ -85,17 +85,17 @@ export function LocalModelImport({ open, directory, onClose, onChoose }: {
|
||||
<p className="local-model-compatibility small"><Icon name="info" size={16}/><span>{tr("Custom model \u00B7 engine compatibility is checked when loading. Memory estimates use the file\u2019s metadata.")}</span></p>
|
||||
{tr(!preview.variant.local!.hasChatTemplate ? <p className="small muted">{tr("No chat template is declared; response formatting depends on the engine.")}</p> : null)}
|
||||
</div> : <div className="local-model-browser">
|
||||
<p className="small muted">{tr("Choose the model’s .gguf file. For a split model, choose any shard; Strata finds the first and checks the full set.")}</p>
|
||||
<p className="small muted">{tr("Choose the model’s .strata or .gguf file. For a split .gguf model, choose any shard; Strata finds the first and checks the full set.")}</p>
|
||||
<form className="local-model-browser__path" onSubmit={e => {
|
||||
e.preventDefault();
|
||||
if (!pending)
|
||||
void (/\.gguf$/i.test(path.trim()) ? inspect(path) : browse(path));
|
||||
void (/\.(gguf|strata)$/i.test(path.trim()) ? inspect(path) : browse(path));
|
||||
}}><input className="st-input" aria-label={tr("Model file or folder path")} placeholder={tr("Model file or folder path")} value={path} disabled={pending} onChange={e => setPath(e.target.value)}/><Btn type="submit" disabled={pending || !path.trim()}>{tr("Go")}</Btn></form>
|
||||
<div className="local-model-browser__navigation"><div>{folder?.shortcuts.map(shortcut => <Btn key={shortcut.path} size="sm" icon="folder" disabled={pending} onClick={() => void browse(shortcut.path)}>{tr(shortcut.name)}</Btn>)}</div><Btn size="sm" disabled={pending || !folder?.parent} onClick={() => folder?.parent && void browse(folder.parent)}>{tr("Up a folder")}</Btn></div>
|
||||
<div className="local-model-browser__list" aria-label={tr("Local model files")} aria-busy={pending}>{pending ? <p className="small muted" role="status">{tr("Reading files\u2026")}</p> : folder?.entries.length ? folder.entries.map(entry => <button key={entry.path} className="local-model-file" aria-label={tr("{0} {1}", [entry.kind === 'folder' ? tr('Open folder') : tr('Choose file'), entry.name])} onClick={() => void (entry.kind === 'folder' ? browse(entry.path) : inspect(entry.path))}><Icon name={entry.kind === 'folder' ? 'folder' : 'model-file'} size={19}/><span title={entry.name}>{entry.name}</span>{tr(entry.kind === 'folder' ? <Icon name="chevron" size={15}/> : <small>{tr(fileSize(entry.bytes ?? 0))}</small>)}</button>) : <div className="local-model-browser__empty"><Icon name="folder" size={26}/><strong>{tr("No GGUF files here")}</strong><p className="small muted">{tr("Open another folder or enter a model\u2019s full path above.")}</p></div>}</div>
|
||||
<div className="local-model-browser__list" aria-label={tr("Local model files")} aria-busy={pending}>{pending ? <p className="small muted" role="status">{tr("Reading files\u2026")}</p> : folder?.entries.length ? folder.entries.map(entry => <button key={entry.path} className="local-model-file" aria-label={tr("{0} {1}", [entry.kind === 'folder' ? tr('Open folder') : tr('Choose file'), entry.name])} onClick={() => void (entry.kind === 'folder' ? browse(entry.path) : inspect(entry.path))}><Icon name={entry.kind === 'folder' ? 'folder' : 'model-file'} size={19}/><span title={entry.name}>{entry.name}</span>{tr(entry.kind === 'folder' ? <Icon name="chevron" size={15}/> : <small>{tr(fileSize(entry.bytes ?? 0))}</small>)}</button>) : <div className="local-model-browser__empty"><Icon name="folder" size={26}/><strong>{tr("No model files here")}</strong><p className="small muted">{tr("Open another folder or enter a model\u2019s full path above.")}</p></div>}</div>
|
||||
{tr(folder?.truncated ? <p className="small muted">{tr("Showing the first 1,000 items. Enter a path to open a specific file.")}</p> : null)}
|
||||
<p className="xs muted">{tr("Only folders and GGUF files are shown. LoRA adapters and image projectors need separate support.")}</p>
|
||||
<p className="xs muted">{tr("Only folders and .strata or .gguf files are shown. LoRA adapters and image projectors need separate support.")}</p>
|
||||
</div>}
|
||||
{tr(error ? <ErrorNotice message={error} next={tr("Choose a complete text model GGUF file.")}/> : null)}
|
||||
{tr(error ? <ErrorNotice message={error} next={tr("Choose a complete text model file (.strata or .gguf).")}/> : null)}
|
||||
</Dialog>;
|
||||
}
|
||||
@@ -11,12 +11,13 @@ export function NativeDeleteDialog({ id, onClose }: { id: string | null; onClose
|
||||
const native = useNative();
|
||||
const [pending, setPending] = useState(false), [error, setError] = useState('');
|
||||
const entry = native?.installed?.models.find(m => m.model === id);
|
||||
const label = (() => { const sizes = nativeCatalogModels(native?.catalog?.families ?? []).flatMap(f => f.sizes); const v = sizes.find(s => s.id === id); return v ? `${catalogVersionLabel(v)} · ${v.model}` : entry?.model_name ?? id ?? ''; })();
|
||||
const label = (() => { const sizes = nativeCatalogModels(native?.catalog?.families ?? [], native?.installed?.models).flatMap(f => f.sizes); const v = sizes.find(s => s.id === id); return v ? `${catalogVersionLabel(v)} · ${v.model}` : entry?.model_name ?? id ?? ''; })();
|
||||
const running = !!native?.instances.some(i => i.model === id);
|
||||
const busy = !!native?.jobs.some(j => j.state === 'running');
|
||||
const size = entry?.diskGb ?? 0, gb = entry?.removableGb ?? size;
|
||||
// Files in the person's own folder (an adopted GGUF) stay where they are: only the entry is removed.
|
||||
const keepsFiles = entry?.removableGb === 0 && size > 0;
|
||||
const custom = entry?.custom === true; // a custom build: only Strata's own entry for it is removed, never the person's model files
|
||||
const keepsFiles = custom || (entry?.removableGb === 0 && size > 0);
|
||||
function close() { if (!pending) { onClose(); setError(''); } }
|
||||
async function remove() {
|
||||
setPending(true);
|
||||
@@ -37,9 +38,9 @@ export function NativeDeleteDialog({ id, onClose }: { id: string | null; onClose
|
||||
catch (e) { setError(e instanceof Error ? e.message : String(e)); }
|
||||
finally { setPending(false); }
|
||||
}
|
||||
return <Dialog open={!!id} compact title={tr("Delete this version?")} onClose={close} actions={<><Btn disabled={pending} onClick={close}>{tr("Keep version")}</Btn><Btn variant="danger" disabled={pending || busy || !entry} onClick={() => void remove()}>{tr(pending ? 'Working…' : 'Delete version')}</Btn></>}>
|
||||
return <Dialog open={!!id} compact title={tr(custom ? "Remove this model from Strata?" : "Delete this version?")} onClose={close} actions={<><Btn disabled={pending} onClick={close}>{tr(custom ? "Keep model" : "Keep version")}</Btn><Btn variant="danger" disabled={pending || busy || !entry} onClick={() => void remove()}>{tr(pending ? 'Working…' : custom ? 'Remove from Strata' : 'Delete version')}</Btn></>}>
|
||||
<p>{tr(label)}{tr(size ? ` · ${sizeGb(size)}` : '')}</p>
|
||||
{tr(!entry ? <p className="small muted">{tr("This version is no longer downloaded.")}</p> : <p className="small muted storage-delete-note">{keepsFiles ? tr('These files are in your own folder, so they stay there. Only the entry in Strata is removed.') : tr('Remove {0} GB of downloaded files. You can download this version again.', [gb ? gb.toFixed(1) : '0'])}{tr(running ? ' ' : '')}{tr(running ? (keepsFiles ? 'The running model will be unloaded.' : 'The running model will be unloaded and its files deleted.') : '')}</p>)}
|
||||
{tr(!entry ? <p className="small muted">{tr("This version is no longer downloaded.")}</p> : <p className="small muted storage-delete-note">{custom ? tr('Only the entry in Strata is removed. Your .strata or .gguf files stay where they are and are not changed.') : keepsFiles ? tr('These files are in your own folder, so they stay there. Only the entry in Strata is removed.') : tr('Remove {0} GB of downloaded files. You can download this version again.', [gb ? gb.toFixed(1) : '0'])}{tr(running ? ' ' : '')}{tr(running ? (keepsFiles ? 'The running model will be unloaded.' : 'The running model will be unloaded and its files deleted.') : '')}</p>)}
|
||||
{tr(error ? <ErrorNotice message={error}/> : null)}
|
||||
</Dialog>;
|
||||
}
|
||||
@@ -11,10 +11,16 @@ import { sizeGb } from '../lib/format';
|
||||
import { NativeProgress } from './NativeModels';
|
||||
import { ownFilesVision } from '../lib/own-files-vision';
|
||||
|
||||
interface Preview { path: string; preview: { model_dir?: string; plain_issues?: string[]; already_set_up?: { data_dir?: string | null; pack?: string | null } | null; file_count: number; total_bytes: number; file_set_status: string; issues: string[]; messages?: string[]; projectors?: { name: string; status: string; pinned: boolean; plain: string }[]; reads_pictures?: boolean; candidate_selection: { family: string; model: string } | null } }
|
||||
import { cleanDisplayName, customTarget, suggestedDisplayName } from '../lib/custom-models';
|
||||
|
||||
/** The words for why a folder of GGUF files cannot be used: a sentence and what to do, the checker's own codes under Details. */
|
||||
function problem(issues: string[]): { message: string; next: string } {
|
||||
/** `custom`: the files are not a build Strata publishes (a fine-tune, a merge, another maker's quantization) but have the layout of a model its engines run: they are used in place under a name the person chooses. */
|
||||
interface Preview { path: string; preview: { model_dir?: string; file_kind?: 'gguf' | 'strata'; plain_issues?: string[]; already_set_up?: { data_dir?: string | null; pack?: string | null } | null; file_count: number; total_bytes: number; file_set_status: string; issues: string[]; messages?: string[]; projectors?: { name: string; status: string; pinned: boolean; plain: string }[]; reads_pictures?: boolean; candidate_selection: { family: string; model: string; custom?: boolean; suggested_label?: string; family_title?: string; base_family?: string; base_model?: string } | null } }
|
||||
|
||||
/** The model families Strata's own engines run, in the words of the unsupported-variant message. */
|
||||
export const SUPPORTED_FAMILIES_TEXT = 'Strata runs Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash and Inkling-2-Mini, and compatible fine-tunes and quantizations of them. Download one from Models, or choose its .strata or .gguf files.';
|
||||
|
||||
/** The words for why a folder of model files cannot be used: a sentence and what to do, the checker's own codes under Details. */
|
||||
export function problem(issues: string[]): { message: string; next: string } {
|
||||
const has = (re: RegExp) => issues.some(i => re.test(i));
|
||||
if (has(/multiple_model_groups/))
|
||||
return { message: 'This folder holds more than one model.', next: 'Type the full path of the .gguf file of the one you want, or choose the folder of that model.' };
|
||||
@@ -23,18 +29,20 @@ function problem(issues: string[]): { message: string; next: string } {
|
||||
if (has(/unsupported_architecture|unsupported_or_missing_architecture/))
|
||||
return { message: 'This model type isn’t supported by the Strata engine.', next: 'Add it as a Custom model API instead: start it with llama-server, then open Settings > Models > Add model provider > Custom model API.' };
|
||||
if (has(/unrecognized_or_unsupported_model_variant|expert_quantization|tokenizer/))
|
||||
return { message: 'Strata can’t run these files yet.', next: 'Strata runs the Qwen3.8-Flash-Next models. Download one from Models, or choose a folder with its files.' };
|
||||
return { message: 'These files could not be checked.', next: 'Check that the folder holds complete GGUF files, then try again. The file named under Details says what is wrong with it.' };
|
||||
return { message: 'Strata can’t run these files yet.', next: SUPPORTED_FAMILIES_TEXT };
|
||||
return { message: 'These files could not be checked.', next: 'Check that the folder holds complete .strata or .gguf files, then try again. The file named under Details says what is wrong with it.' };
|
||||
}
|
||||
|
||||
/** "Use a local GGUF": choose the folder of a model you already have, Strata checks it, and prepares and loads it without copying
|
||||
/** "Use local model files": choose the folder of a model you already have, or one .strata or .gguf file, Strata checks it, and prepares and loads it without copying
|
||||
* or downloading the model files. The same page layout and cards as the optimized models page. */
|
||||
export function NativeLocalModel({ onBack }: { onBack: () => void }) {
|
||||
const native = useNative(), ime = useImeKeys();
|
||||
const [typed, setTyped] = useState(''), [checked, setChecked] = useState<Preview | null>(null), [pending, setPending] = useState(false), [error, setError] = useState(''), [jobId, setJobId] = useState('');
|
||||
const job = native?.jobs.find(j => j.id === jobId);
|
||||
const active = native?.jobs.find(j => j.state === 'running');
|
||||
const [label, setLabel] = useState('');
|
||||
const selection = checked?.preview.candidate_selection;
|
||||
const isCustom = selection?.custom === true;
|
||||
const usable = !!checked && checked.preview.file_set_status === 'plausible' && !!selection;
|
||||
const version = selection ? nativeCatalogModels(native?.catalog?.families ?? []).flatMap(f => f.sizes).find(s => s.sourceFamily === selection.family && s.model === selection.model) : undefined;
|
||||
const family = selection ? nativeCatalogModels(native?.catalog?.families ?? []).find(f => f.sizes.some(s => s.sourceFamily === selection.family && s.model === selection.model)) : undefined;
|
||||
@@ -47,6 +55,7 @@ export function NativeLocalModel({ onBack }: { onBack: () => void }) {
|
||||
if (!result.cancelled) {
|
||||
setChecked(result);
|
||||
setTyped(result.path);
|
||||
setLabel(suggestedDisplayName(result.preview.candidate_selection?.suggested_label, result.path));
|
||||
}
|
||||
}
|
||||
catch (e) { setError(e instanceof Error ? e.message : String(e)); }
|
||||
@@ -64,8 +73,12 @@ export function NativeLocalModel({ onBack }: { onBack: () => void }) {
|
||||
setError('');
|
||||
try {
|
||||
const isInkling = selection.family === 'inkling-2-mini';
|
||||
const localTarget = isInkling && /\.(gguf|strata)$/i.test(checked.path) ? checked.path : (checked.preview.model_dir ?? checked.path);
|
||||
const result = await nativeAction<NativeJob>('operations', { kind: 'install', args: { family: selection.family, model: selection.model, gguf_dir: localTarget, ...(ownDataFolder ? { data_dir: ownDataFolder } : {}), context: isInkling ? 32768 : (native?.catalog?.recommendation?.context ?? 32768), vision: ownFilesVision(checked.preview.projectors, native?.visionReader, native?.installed?.models, selection.family), kv: 'int8', loadAfter: true } });
|
||||
// A custom build is used from the very file that was picked (the folder can hold the official files too); it is saved under the name the person chose, never over the official build of the same size.
|
||||
const localTarget = isCustom ? customTarget(checked.path, checked.preview.model_dir, true) : isInkling && /\.(gguf|strata)$/i.test(checked.path) ? checked.path : (checked.preview.model_dir ?? checked.path);
|
||||
const customName = isCustom ? cleanDisplayName(label) : '';
|
||||
if (isCustom && !customName)
|
||||
throw new Error('Give this model a name.');
|
||||
const result = await nativeAction<NativeJob>('operations', { kind: 'install', args: { family: selection.family, model: selection.model, gguf_dir: localTarget, ...(isCustom ? { custom_label: customName, drafting: 'auto' } : {}), ...(ownDataFolder && !isCustom ? { data_dir: ownDataFolder } : {}), context: isInkling ? 32768 : (native?.catalog?.recommendation?.context ?? 32768), vision: ownFilesVision(checked.preview.projectors, native?.visionReader, native?.installed?.models, selection.family), kv: 'int8', loadAfter: true } });
|
||||
setJobId(result.id);
|
||||
}
|
||||
catch (e) { setError(e instanceof Error ? e.message : String(e)); }
|
||||
@@ -75,17 +88,18 @@ export function NativeLocalModel({ onBack }: { onBack: () => void }) {
|
||||
return <Screen plainHeader title={tr("Model")} actions={<Btn onClick={onBack}>{tr("Back")}</Btn>}>
|
||||
<div className="native-model-layout">
|
||||
<div className="stack stack--lg">
|
||||
<section className="st-card native-choice"><h2 className="h3">{tr("Use a local GGUF…")}</h2>
|
||||
<p className="small muted">{tr("Already have a supported model on this computer? Choose the folder that holds its files, or one of its .gguf files. Strata checks them, prepares the model and loads it. Nothing is copied or downloaded.")}</p>
|
||||
<label className="input-field"><span>{tr("Folder with the GGUF files, or one .gguf file")}</span><input className="st-input" value={typed} placeholder={tr("Full path to the folder or the file")} spellCheck={false} onChange={e => setTyped(e.target.value)} {...ime.events} onKeyDown={e => { if (ime.owns(e)) return; if (e.key === 'Enter' && typed.trim()) void check(typed); }}/></label>
|
||||
<section className="st-card native-choice"><h2 className="h3">{tr("Use local model files (.strata or .gguf)…")}</h2>
|
||||
<p className="small muted">{tr("Already have a supported model on this computer, such as a compatible fine-tune or quantization? Choose the folder that holds its files, or one of its .strata or .gguf files. Strata checks them, prepares the model and loads it. Nothing is copied or downloaded, and your files are never changed.")}</p>
|
||||
<label className="input-field"><span>{tr("Folder with the model files, or one .strata or .gguf file")}</span><input className="st-input" value={typed} placeholder={tr("Full path to the folder or the file")} spellCheck={false} onChange={e => setTyped(e.target.value)} {...ime.events} onKeyDown={e => { if (ime.owns(e)) return; if (e.key === 'Enter' && typed.trim()) void check(typed); }}/></label>
|
||||
<div className="native-settings-actions"><Btn icon="folder" disabled={pending || !!active} onClick={() => void check('')}>{tr("Choose folder")}</Btn><Btn disabled={pending || !typed.trim() || !!active} onClick={() => void check(typed)}>{tr(pending && !jobId ? 'Checking…' : 'Check files')}</Btn></div>
|
||||
</section>
|
||||
{tr(checked ? <section className="st-card native-choice">{tr(usable ? <>
|
||||
<h2 className="h3">{tr(family ? family.title : 'Model found')}</h2>
|
||||
<p><strong>{tr(version ? catalogVersionLabel(version) : selection?.model ?? '')}</strong> · {tr(selection?.model ?? '')}</p>
|
||||
<h2 className="h3">{tr(selection?.family_title ?? family?.title ?? 'Model found')}{tr(isCustom ? <> <span className="version-tag">{tr("Custom")}</span></> : null)}</h2>
|
||||
<p><strong>{tr(isCustom ? 'Custom build' : version ? catalogVersionLabel(version) : selection?.model ?? '')}</strong> · {tr(isCustom ? (version ? `${tr('Closest build:')} ${catalogVersionLabel(version)}` : selection?.model ?? '') : selection?.model ?? '')}</p>
|
||||
{tr(isCustom ? <label className="input-field local-model-name"><span>{tr("Display name")}</span><input className="st-input" aria-label={tr("Display name")} value={label} maxLength={80} spellCheck={false} disabled={pending || !!active} onChange={e => setLabel(e.target.value)}/><small className="muted">{tr("This is how the model is listed in Strata. Your files stay where they are.")}</small></label> : null)}
|
||||
<p className="small muted">{tr("{0} files · {1}", [checked.preview.file_count, sizeGb(checked.preview.total_bytes / 1024 ** 3)])}</p>
|
||||
{tr(checked.preview.messages?.map(m => <p className="small muted" key={m}>{tr(m)}</p>))}
|
||||
<div className="native-model-actions"><Btn variant="primary" icon="models" disabled={pending || !!active} onClick={() => void prepare()}>{tr(pending ? 'Checking…' : 'Prepare and load')}</Btn></div>
|
||||
<div className="native-model-actions"><Btn variant="primary" icon="models" disabled={pending || !!active || (isCustom && !cleanDisplayName(label))} onClick={() => void prepare()}>{tr(pending ? 'Checking…' : 'Prepare and load')}</Btn></div>
|
||||
</> : <>
|
||||
<h2 className="h3">{tr(found!.message)}</h2>
|
||||
<p className="small muted">{tr(found!.next)}</p>
|
||||
|
||||
@@ -52,7 +52,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
const [toastedJob, setToastedJob] = useKept('models.toasted', ''), [appliedSig, setAppliedSig] = useKept('models.applied', '');
|
||||
const presetPending = useRef(false), visionPicks = useRef(new Map<string, string>()); // Read pictures per version: what the person set, or what the version opened with; later reports of the host never overwrite it
|
||||
const [deleting, setDeleting] = useState<string | null>(null);
|
||||
const families = nativeCatalogModels(native?.catalog?.families ?? []);
|
||||
const families = nativeCatalogModels(native?.catalog?.families ?? [], native?.installed?.models);
|
||||
const expertSection = useRef<HTMLElement>(null);
|
||||
// The card is inserted above the fold and the browser's scroll anchoring
|
||||
// immediately compensates by scrolling down, which cancelled the smooth
|
||||
@@ -298,11 +298,11 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
|
||||
<NativeDeleteDialog id={deleting} onClose={() => setDeleting(null)}/>
|
||||
<Dialog open={manage} compact title={tr("Manage models")} onClose={() => setManage(false)} actions={<Btn onClick={() => setManage(false)}>{tr("Done")}</Btn>}><div className="native-manage">
|
||||
{tr(downloaded.some(m => !m.retired && (m.ready || m.diskGb)) ? <div className="native-manage-list" role="list">{tr(downloaded.filter(m => !m.retired && (m.ready || m.diskGb)).map(m => { const v = allSizes.find(x => x.id === m.model), loaded = native?.instances.some(i => i.model === m.model && i.status === 'ready'); return <div className="native-manage-row" role="listitem" key={m.model} data-selected={selectedSize?.id === m.model || undefined}>
|
||||
<span className="native-manage-name"><strong>{tr(v ? `${catalogVersionLabel(v)}` : m.model_name ?? m.model)}</strong><small>{tr(v ? v.model : m.model)}{tr(m.diskGb ? ` · ${sizeGb(m.diskGb)}` : '')}</small></span>
|
||||
<span className={loaded ? 'st-pill st-pill--accent' : 'st-pill'}>{tr(loaded ? 'Loaded' : 'Downloaded')}</span>
|
||||
<span className="native-manage-actions"><Btn size="sm" disabled={!!active || !v} onClick={() => { if (v) setSize(v.id); setManage(false); }}>{tr(selectedSize?.id === m.model ? 'Selected' : 'Use version')}</Btn><Btn size="sm" variant="danger" disabled={!!active} onClick={() => setDeleting(m.model)}>{tr("Delete")}</Btn></span>
|
||||
<span className="native-manage-name"><strong>{tr(v ? `${catalogVersionLabel(v)}` : m.model_name ?? m.model)}</strong><small>{tr(m.custom ? `${tr('Custom')} · ${m.base_model ?? ''}` : v ? v.model : m.model)}{tr(m.diskGb ? ` · ${sizeGb(m.diskGb)}` : '')}</small></span>
|
||||
<span className={loaded ? 'st-pill st-pill--accent' : 'st-pill'}>{tr(loaded ? 'Loaded' : m.custom ? 'Local' : 'Downloaded')}</span>
|
||||
<span className="native-manage-actions"><Btn size="sm" disabled={!!active || !v} onClick={() => { if (v) setSize(v.id); setManage(false); }}>{tr(selectedSize?.id === m.model ? 'Selected' : 'Use version')}</Btn><Btn size="sm" variant="danger" disabled={!!active} onClick={() => setDeleting(m.model)}>{tr(m.custom ? "Remove from Strata" : "Delete")}</Btn></span>
|
||||
</div>; }))}</div> : <p className="small muted native-manage-empty">{tr("No downloaded models")}</p>)}
|
||||
<div className="native-manage-foot"><Btn variant="ghost" icon="folder" onClick={() => { setManage(false); (onImport ?? onOtherModels)(); }}>{tr("Use a local GGUF…")}</Btn></div>
|
||||
<div className="native-manage-foot"><Btn variant="ghost" icon="folder" onClick={() => { setManage(false); (onImport ?? onOtherModels)(); }}>{tr("Use local model files (.strata or .gguf)…")}</Btn></div>
|
||||
</div></Dialog>
|
||||
{selectedSize && !isHy4Selected ? <NativeTune open={tuneOpen} onClose={() => setTuneOpen(false)} model={selectedSize.id} resourceProfile={resourceProfile} vision={selectedSize.images ? vision : 'no'} visionUnavailable={noReader}/> : null}
|
||||
</Screen>;
|
||||
|
||||
@@ -9,6 +9,7 @@ import { fitOn, recommendedVersions, versionFit, versionGroups, type CacheChoice
|
||||
|
||||
/** The name a version goes by in the list: the quantization, with the maker only where the quantization alone would be ambiguous. */
|
||||
export function versionName(v: CatalogVersion): string {
|
||||
if (v.custom && v.displayName) return v.displayName; // the person's own build: the name they chose
|
||||
switch (v.sourceFamily) {
|
||||
case 'swift': return `Swift ${v.model}`;
|
||||
case 'unsloth': return `Unsloth ${v.model}`;
|
||||
@@ -21,7 +22,7 @@ export function versionName(v: CatalogVersion): string {
|
||||
|
||||
/** Who made a version (Details only): the family name of the quantization, a proper name in every language. */
|
||||
const MAKERS: Record<string, string> = { qwen: 'GSQ-RCO', coder: 'GSQ-RCO', swift: 'Swift', unsloth: 'Unsloth', gyro: 'Gyro', nvfp4: 'NVFP4' };
|
||||
const makerOf = (v: CatalogVersion): string | undefined => (v.sourceFamily === 'inkling-2-mini' ? (/^UD-/i.test(v.model) ? 'Unsloth GGUF' : /^GSQ-RCO-/i.test(v.model) ? 'GSQ-RCO GGUF' : 'Strata') : MAKERS[v.sourceFamily]);
|
||||
const makerOf = (v: CatalogVersion): string | undefined => v.custom ? 'Local files' : (v.sourceFamily === 'inkling-2-mini' ? (/^UD-/i.test(v.model) ? 'Unsloth GGUF' : /^GSQ-RCO-/i.test(v.model) ? 'GSQ-RCO GGUF' : 'Strata') : MAKERS[v.sourceFamily]);
|
||||
|
||||
const gb = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} GB`;
|
||||
const whole = (n: number) => `${Math.round(n)} GB`;
|
||||
@@ -86,18 +87,18 @@ export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnG
|
||||
return tr("Needs {0} of memory", [whole(size)]);
|
||||
};
|
||||
const row = (v: CatalogVersion) => {
|
||||
const on = v.id === selectedId, have = !!downloaded?.has(v.id);
|
||||
const on = v.id === selectedId, have = !!downloaded?.has(v.id) && !v.custom; // a custom build has its own "Custom" tag instead of "Downloaded": its files are the person's own
|
||||
const state = versionFit(v, hardware, cache);
|
||||
const technical = [makerOf(v), need(v, true), v.credit ? tr(v.credit) : ''].filter(Boolean).join(' · ');
|
||||
const note = versionNote(v.model);
|
||||
return <button key={v.id} role="menuitemradio" aria-checked={on} className={cx('version-row', on && 'is-on')} onClick={() => { onSelect(v.id); setOpen(false); }}>
|
||||
<span className="version-row__check">{tr(on ? <Icon name="check" size={14}/> : null)}</span>
|
||||
<span className="version-row__body">
|
||||
<span className="version-row__title"><strong>{versionName(v)}</strong>{tr(have || v.offered === false ? <span className="version-row__tags">{tr(have ? <span className="version-tag version-tag--have">{tr("Downloaded")}</span> : null)}{tr(v.offered === false ? <span className="version-tag">{tr("No longer offered")}</span> : null)}{tr(have && v.update_available ? <span className="version-tag">{tr("Update available")}</span> : null)}</span> : null)}</span>
|
||||
<span className="version-row__title"><strong>{versionName(v)}</strong>{tr(have || v.offered === false || v.custom ? <span className="version-row__tags">{tr(v.custom ? <span className="version-tag version-tag--custom">{tr("Custom")}</span> : null)}{tr(have ? <span className="version-tag version-tag--have">{tr("Downloaded")}</span> : null)}{tr(v.offered === false ? <span className="version-tag">{tr("No longer offered")}</span> : null)}{tr(have && v.update_available ? <span className="version-tag">{tr("Update available")}</span> : null)}</span> : null)}</span>
|
||||
{tr(state === 'ssd' ? <span className="version-row__fit" data-fit={state}>{tr('may run slower')}</span> : null)}
|
||||
{tr(details ? <span className="version-row__tech">{technical}{tr(note ? <><br/>{note}</> : null)}</span> : null)}
|
||||
</span>
|
||||
<span className="version-row__size">{have ? gb(v.download_gb) : tr("{0} download", [gb(v.download_gb)])}</span>
|
||||
<span className="version-row__size">{have || v.custom ? gb(v.download_gb) : tr("{0} download", [gb(v.download_gb)])}</span>
|
||||
</button>;
|
||||
};
|
||||
// The open menu opens on the chosen version, not at the top of a long list.
|
||||
@@ -105,7 +106,7 @@ export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnG
|
||||
useEffect(() => { if (open) menu.current?.querySelector('.is-on')?.scrollIntoView({ block: 'nearest' }); }, [open]);
|
||||
return <>
|
||||
<button ref={trigger} type="button" className="version-trigger" aria-haspopup="menu" aria-expanded={open} aria-label={tr("Model version")} onClick={() => setOpen(v => !v)}>
|
||||
<strong>{shown ? versionName(shown) : tr(moreLabel ?? "Choose a version")}</strong>{tr(shown && downloaded?.has(shown.id) ? <span className="version-tag version-tag--have">{tr("Downloaded")}</span> : null)}
|
||||
<strong>{shown ? versionName(shown) : tr(moreLabel ?? "Choose a version")}</strong>{tr(shown?.custom ? <span className="version-tag version-tag--custom">{tr("Custom")}</span> : shown && downloaded?.has(shown.id) ? <span className="version-tag version-tag--have">{tr("Downloaded")}</span> : null)}
|
||||
<span className="version-trigger__need muted">{tr(shown ? need(shown, details) : '')}</span>
|
||||
<Icon name="chevron" size={14} className="version-trigger__chev"/>
|
||||
</button>
|
||||
@@ -117,7 +118,7 @@ export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnG
|
||||
{tr(foldedOpen ? <div className="version-more__rows">{tr(more.map(row))}</div> : null)}
|
||||
</div> : null)}
|
||||
<div className="version-foot">
|
||||
<button role="menuitem" className="version-foot__btn" onClick={() => { setOpen(false); onOwnGguf(); }}><Icon name="folder" size={14}/>{tr("Use your own GGUF…")}</button>
|
||||
<button role="menuitem" className="version-foot__btn" onClick={() => { setOpen(false); onOwnGguf(); }}><Icon name="folder" size={14}/>{tr("Use local model files (.strata or .gguf)…")}</button>
|
||||
<button role="menuitem" className="version-foot__btn" aria-pressed={details} onClick={() => setDetails(d => !d)}>{tr(details ? "Hide details" : "Show details")}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
/**
|
||||
* Custom builds: the person's own compatible fine-tunes, merges and quantizations of a model Strata's engines already run, kept in place
|
||||
* (.strata or .gguf files on their own disk). Control writes one run config per build (`strata-<family>-custom-<name>.json`, with `custom: true`);
|
||||
* this file turns those installed rows into versions of their parent model, so they are listed beside the official builds and are picked the same way.
|
||||
* Pure logic only (no screen code): the cleaning of the name, the choice of group and the size figures.
|
||||
*/
|
||||
import type { NativeSize } from './native';
|
||||
|
||||
/** The installed-model row fields Control adds for a custom build. */
|
||||
export interface CustomRow {
|
||||
model: string;
|
||||
custom?: boolean;
|
||||
display_name?: string;
|
||||
model_name?: string;
|
||||
base_family?: string;
|
||||
base_model?: string;
|
||||
custom_bytes?: number;
|
||||
diskBytes?: number;
|
||||
ready?: boolean;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
/** The display groups the Models screen shows (native-catalog.ts), by the id of the group. */
|
||||
export type CustomGroup = 'qwen3.8' | 'qwen3.6' | 'ornith' | 'hy4-flash' | 'inkling-2-mini';
|
||||
|
||||
/** Which display group a setup family belongs to; undefined for a family Strata does not run as a custom build. */
|
||||
export function customGroupOf(baseFamily: string | undefined | null): CustomGroup | undefined {
|
||||
const f = String(baseFamily ?? '').toLowerCase();
|
||||
if (!f) return undefined;
|
||||
if (f === 'hy4-flash') return 'hy4-flash';
|
||||
if (f === 'inkling-2-mini') return 'inkling-2-mini';
|
||||
if (/ornith/.test(f)) return 'ornith';
|
||||
if (/qwen3[._-]?6|35b[-_]?a3b/.test(f)) return 'qwen3.6';
|
||||
if (['qwen', 'swift', 'coder', 'unsloth', 'gyro', 'nvfp4', 'qwen3.8'].includes(f)) return 'qwen3.8';
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** The file types each display group's engine reads as a custom build. HY-4 Flash has no GGUF loader. */
|
||||
export const CUSTOM_FILE_TYPES: Record<CustomGroup, readonly ('gguf' | 'strata')[]> = {
|
||||
'qwen3.8': ['gguf'], 'qwen3.6': ['gguf'], ornith: ['gguf'], 'hy4-flash': ['strata'], 'inkling-2-mini': ['strata', 'gguf'],
|
||||
};
|
||||
|
||||
/** A name for the person to read: printable characters only, no path separators, one line, at most `max` characters. */
|
||||
export function cleanDisplayName(value: unknown, max = 80): string {
|
||||
return String(value ?? '').replace(/[\u0000-\u001f\u007f\\/:*?"<>|]/g, ' ').replace(/\s+/g, ' ').trim().slice(0, max).trim();
|
||||
}
|
||||
|
||||
/** The name the Display name box starts with: what the checker suggested, else the file name without its folder, extension and shard numbers. */
|
||||
export function suggestedDisplayName(suggested: unknown, path: string): string {
|
||||
const fromCheck = cleanDisplayName(suggested);
|
||||
if (fromCheck) return fromCheck;
|
||||
const file = String(path ?? '').split(/[\\/]/).filter(Boolean).pop() ?? '';
|
||||
return cleanDisplayName(file.replace(/-\d{5}-of-\d{5}(?=\.gguf$)/i, '').replace(/\.(gguf|strata)$/i, ''));
|
||||
}
|
||||
|
||||
/** The file to hand to the installer for a custom build: the picked file itself (a folder can hold the official files too), else the checked folder. */
|
||||
export function customTarget(picked: string, modelDir: string | undefined, isCustom: boolean): string {
|
||||
return isCustom && /\.(gguf|strata)$/i.test(picked) ? picked : (modelDir ?? picked);
|
||||
}
|
||||
|
||||
const finite = (n: unknown): n is number => typeof n === 'number' && Number.isFinite(n) && n >= 0;
|
||||
|
||||
/** The size (in bytes) of a custom build: the figure Control recorded, else what the disk row reports. */
|
||||
export const customBytesOf = (row: CustomRow): number => finite(row.custom_bytes) ? row.custom_bytes : finite(row.diskBytes) ? row.diskBytes : 0;
|
||||
|
||||
/**
|
||||
* A custom row as a version of its parent model. The closest official build (`base_model`) gives the profile the fit figures start from; the
|
||||
* memory figures move by the difference between the real file size and that build's size, so the "needs" line follows the actual file.
|
||||
* Its id is the run config id, so Load, Context, Vision, Drafting, GPU roles and Remove all act on this build and never on the official one.
|
||||
*/
|
||||
export function customVersion<T extends NativeSize & { sourceFamily?: string }>(row: CustomRow, base: T | undefined, group: CustomGroup): T & { custom: true; displayName: string; customBytes: number; sourceFamily: string; edition: string; images: boolean } {
|
||||
const name = cleanDisplayName(row.display_name) || cleanDisplayName(row.model_name) || row.model;
|
||||
const bytes = customBytesOf(row), gb = bytes / 1024 ** 3;
|
||||
const baseGb = base && finite(base.download_gb) ? base.download_gb : 0;
|
||||
const delta = base && gb > 0 ? gb - baseGb : 0;
|
||||
const shift = (n: unknown) => finite(n) ? Math.max(0, +(n + delta).toFixed(3)) : 0;
|
||||
const profile = (base ?? {}) as Partial<T>;
|
||||
return {
|
||||
about: '', on_this_pc: null, ...profile,
|
||||
id: row.model, model: String(row.base_model ?? profile.model ?? ''),
|
||||
download_gb: gb, ram_needed_gb: base ? shift(profile.ram_needed_gb) : gb, experts_gb: base ? shift(profile.experts_gb) : gb,
|
||||
...(finite(profile.fit_gb) ? { fit_gb: shift(profile.fit_gb) } : {}),
|
||||
...(profile.inkling ? { inkling: { ...profile.inkling, recommended: false } } : {}),
|
||||
...(profile.hy4 ? { hy4: { ...profile.hy4, recommended: false } } : {}),
|
||||
installed: true, offered: true, needsNewerEngine: false, update_available: false,
|
||||
custom: true, displayName: name, customBytes: bytes,
|
||||
sourceFamily: String(row.base_family ?? (base as { sourceFamily?: string } | undefined)?.sourceFamily ?? ''), edition: 'Custom',
|
||||
images: !!(base as { images?: boolean } | undefined)?.images || group === 'hy4-flash' || group === 'inkling-2-mini',
|
||||
} as unknown as T & { custom: true; displayName: string; customBytes: number; sourceFamily: string; edition: string; images: boolean };
|
||||
}
|
||||
|
||||
/**
|
||||
* The display groups with every installed custom build added to its parent model, after the official builds. Groups are never changed in place.
|
||||
* A custom build whose family is not one Strata runs is left out; a group that has no entry yet (Ornith with nothing offered) is made.
|
||||
*/
|
||||
export function withCustomBuilds<S extends NativeSize & { sourceFamily?: string }, G extends { family: string; title: string; sizes: S[]; images?: boolean; about?: string; experimental?: boolean }>(groups: G[], rows: readonly CustomRow[] | null | undefined): G[] {
|
||||
const custom = (rows ?? []).filter(r => r?.custom === true && typeof r.model === 'string' && r.model);
|
||||
if (!custom.length) return groups;
|
||||
const out = groups.map(g => ({ ...g, sizes: [...g.sizes] }));
|
||||
const TITLES: Record<CustomGroup, string> = { 'qwen3.8': 'Qwen3.8-Flash-Next', 'qwen3.6': 'Qwen3.6-35B-A3B', ornith: 'Ornith-1.5-35B-A3B', 'hy4-flash': 'HY-4 Flash', 'inkling-2-mini': 'Inkling-2-Mini' };
|
||||
for (const row of custom) {
|
||||
const group = customGroupOf(row.base_family);
|
||||
if (!group || out.some(g => g.sizes.some(s => s.id === row.model))) continue;
|
||||
let target = out.find(g => g.family === group);
|
||||
if (!target) {
|
||||
target = { family: group, title: TITLES[group], about: '', experimental: false, images: false, sizes: [] } as unknown as G;
|
||||
out.push(target);
|
||||
}
|
||||
const base = target.sizes.find(s => !(s as { custom?: boolean }).custom && s.model === row.base_model && (!row.base_family || s.sourceFamily === row.base_family)) ?? target.sizes.find(s => !(s as { custom?: boolean }).custom && s.model === row.base_model);
|
||||
target.sizes.push(customVersion(row, base, group) as unknown as S);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/** The words of the small badge a custom build carries in the version lists. */
|
||||
export const CUSTOM_BADGE = 'Custom';
|
||||
@@ -24,7 +24,11 @@ export function pickerGroups(library: ModelLibrary) {
|
||||
}
|
||||
|
||||
/** Optimized models that are on this PC but not loaded yet: the chat picker must list them, or it says "none downloaded" while Storage shows them (#3814). */
|
||||
export function pickerNativeModels<M extends { model: string; model_name?: string; ready?: boolean }>(installed: M[] | undefined | null, instances: { label: string }[] | undefined | null): M[] {
|
||||
export function pickerNativeModels<M extends { model: string; model_name?: string; ready?: boolean; custom?: boolean; display_name?: string }>(installed: M[] | undefined | null, instances: { label: string }[] | undefined | null): M[] {
|
||||
const loaded = new Set((instances ?? []).map(i => i.label));
|
||||
return (installed ?? []).filter(m => m.ready !== false && !loaded.has(m.model_name ?? m.model));
|
||||
return (installed ?? []).filter(m => m.ready !== false && !loaded.has(pickerNativeName(m)));
|
||||
}
|
||||
/** The name the chat picker shows for an installed model: a custom build goes by the name its owner gave it. */
|
||||
export function pickerNativeName(m: { model: string; model_name?: string; custom?: boolean; display_name?: string }): string {
|
||||
return (m.custom === true && m.display_name) || m.model_name || m.model;
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
import type {NativeFamily,NativeSize} from './native';
|
||||
import {tr} from './i18n';
|
||||
import {nvfp4Version} from './native-names';
|
||||
import {withCustomBuilds,type CustomRow} from './custom-models';
|
||||
export interface CatalogVersion extends NativeSize{sourceFamily:string;edition:string;images:boolean}
|
||||
export interface CatalogModel extends Omit<NativeFamily,'sizes'>{sizes:CatalogVersion[]}
|
||||
export function nativeVersionLabel(model:string){const nv=nvfp4Version(model);if(nv)return tr(nv.name);return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory','SQ-64':'Flagship','SQ-96':'High quality','SQ-128':'Highest quality','SQ-20':'Lossless','SQ-15':'Flagship','SQ-10':'Compact'} as Record<string,string>)[model]??model);}
|
||||
export const catalogVersionLabel=(version:CatalogVersion)=>{if(version.sourceFamily===INKLING_FAMILY&&/^UD-/i.test(version.model))return `${tr('Unsloth')} · ${version.model}`;if(version.sourceFamily===INKLING_FAMILY&&/^GSQ-RCO-/i.test(version.model))return `GSQ-RCO · ${version.model.replace(/^GSQ-RCO-/i,'')}`;const label=nativeVersionLabel(version.model);return [tr(version.edition),label===version.model&&version.edition?'':label].filter(Boolean).join(' · ');};
|
||||
export const catalogVersionLabel=(version:CatalogVersion)=>{if(version.custom&&version.displayName)return version.displayName;if(version.sourceFamily===INKLING_FAMILY&&/^UD-/i.test(version.model))return `${tr('Unsloth')} · ${version.model}`;if(version.sourceFamily===INKLING_FAMILY&&/^GSQ-RCO-/i.test(version.model))return `GSQ-RCO · ${version.model.replace(/^GSQ-RCO-/i,'')}`;const label=nativeVersionLabel(version.model);return [tr(version.edition),label===version.model&&version.edition?'':label].filter(Boolean).join(' · ');};
|
||||
/**
|
||||
* Models whose picture files Load fetches by itself (strata_control/pictures.py): the Flash-Next GGUF families, which share the original's reader (Swift has its own file).
|
||||
* NVFP4 packs and Qwen3.6 keep the installer for their pictures. With these the Load of a model that is on this computer never runs the installer again just
|
||||
@@ -20,7 +21,7 @@ export const versionNote=(model:string)=>{const nv=nvfp4Version(model);return nv
|
||||
* listed only while installed) comes last. Control sends them in this order already; the sort keeps it when an older Control does not. */
|
||||
const INKLING_ORDER=['SQ-20','SQ-15','SQ-10','GSQ-RCO-IQ3_S','UD-Q4_K_XL'];
|
||||
export const inklingRank=(model:string,offered?:boolean)=>{if(offered===false)return 20;const i=INKLING_ORDER.indexOf(String(model).toUpperCase());return i>=0?i:/^SQ-/i.test(model)?5:/^GSQ-/i.test(model)?6:7;};
|
||||
export function orderInklingSizes<T extends {model:string;offered?:boolean;installed?:boolean}>(sizes:T[]):T[]{return sizes.filter(s=>s.offered!==false||s.installed).map((s,i)=>({s,i})).sort((a,b)=>inklingRank(a.s.model,a.s.offered)-inklingRank(b.s.model,b.s.offered)||a.i-b.i).map(x=>x.s);}
|
||||
export function orderInklingSizes<T extends {model:string;offered?:boolean;installed?:boolean;custom?:boolean}>(sizes:T[]):T[]{const rank=(s:T)=>s.custom?10:inklingRank(s.model,s.offered);/* the person's own builds come after the official ones */return sizes.filter(s=>s.offered!==false||s.installed).map((s,i)=>({s,i})).sort((a,b)=>rank(a.s)-rank(b.s)||a.i-b.i).map(x=>x.s);}
|
||||
export const hasKvChoice=(group?:string)=>group!=='qwen3.6'&&group!==ORNITH_FAMILY&&group!==HY4_FAMILY&&group!==INKLING_FAMILY;
|
||||
/** Ornith-1.5-35B-A3B (setup.py OWN_PATH_FAMILIES['ornith'], the Qwen3.6 engine path): a display group of its own, so its Q4_K_M..Q8_0 sizes are not listed under Qwen3.6. */
|
||||
export const ORNITH_FAMILY='ornith';
|
||||
@@ -30,7 +31,12 @@ export const HY4_FAMILY='hy4-flash';
|
||||
/** Thinking Machines Inkling-2-Mini (setup.py INKLING_FAMILIES, its own shape engine strata-inkling). */
|
||||
export const INKLING_FAMILY='inkling-2-mini';
|
||||
/** Display groups are distinct from the engine's installation family IDs. */
|
||||
export function nativeCatalogModels(families:NativeFamily[]):CatalogModel[]{
|
||||
export function nativeCatalogModels(families:NativeFamily[],installed?:readonly CustomRow[]|null):CatalogModel[]{
|
||||
// The person's own builds (installed rows with custom:true) are versions of their parent model, listed after the official ones.
|
||||
const official=officialCatalogModels(families);
|
||||
return official.length?withCustomBuilds(official,installed):official;
|
||||
}
|
||||
function officialCatalogModels(families:NativeFamily[]):CatalogModel[]{
|
||||
if(!families.length)return[];
|
||||
const groups:CatalogModel[]=[{family:'qwen3.8',title:'Qwen3.8-Flash-Next',about:'',experimental:false,images:false,sizes:[]},{family:'qwen3.6',title:'Qwen3.6-35B-A3B',about:'',experimental:false,images:false,sizes:[]}];
|
||||
// Ornith-1.5-35B-A3B (#7134) runs on the Qwen3.6 engine path but is its own model: its sizes are a group of their own, listed after Qwen3.6 only when Control offers them (an older Control does not).
|
||||
|
||||
@@ -104,7 +104,7 @@ export const OTHER_NOTE = 'the other choice';
|
||||
*/
|
||||
export function recommendedVersions<V extends { sourceFamily: string; model: string }>(versions: V[], pick?: PcPick | null): { r: typeof RECOMMENDED[number]; v: V }[] {
|
||||
type Row = { r: typeof RECOMMENDED[number]; v: V };
|
||||
const find = (family: string, model: string) => versions.find(v => v.sourceFamily === family && v.model === model);
|
||||
const find = (family: string, model: string) => versions.find(v => v.sourceFamily === family && v.model === model && !(v as { custom?: boolean }).custom); // a custom build never takes an official build's place
|
||||
const rows: Row[] = RECOMMENDED.map(r => ({ r, v: find(r.family, r.model) })).filter((x): x is Row => !!x.v);
|
||||
if (!pick?.family || !pick.model) return rows;
|
||||
const chosen = find(pick.family, pick.model);
|
||||
|
||||
@@ -3,18 +3,18 @@ import { api } from './client';
|
||||
import type { Hardware, RuntimeModels } from './types';
|
||||
export interface GpuChoiceOption {key:string;cards:number[];label:string;verdict:'fits'|'tight'|'spills'|'unknown';words:string;notes:string[];recommended:boolean}
|
||||
export interface GpuChoice {options:GpuChoiceOption[];recommended:string|null;ignored:{name?:string;why_ignored:string}[];cards:number}
|
||||
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;/** The files without the lookup table (the download minus the n-gram / PLE / Engram file): what the fit label and the "Needs" figure use. */fit_gb?:number|null;format?:string;/** Qwen3.6: its own context rule (strata_control/own_path_fit.py via the catalog, #5715). */context_fit?:import('./native-fit').ContextFit|null;/** Tencent Hy4-Flash: where the build's experts go on this PC (strata_control/hy4_fit.py via the catalog). */hy4?:{placement:{vram_gb:number;ram_gb:number;ssd_gb:number};mode:'ram_vram_zero_ssd'|'near_resident_ssd'|'cross_tier_ssd';recommended:boolean;unified:boolean;engram_gb:number}|null;/** Inkling-2-Mini: hardware placement & auto-selection (strata_control/inkling_fit.py via the catalog). */inkling?:{placement:{vram_gb:number;ram_gb:number;ssd_gb:number;full_vram?:boolean};mode:'full_vram'|'ram_vram_zero_ssd'|'near_resident_ssd'|'cross_tier_ssd';recommended:boolean;unified:boolean;context:number;kv_gb:number;parallel_choices?:number[]}|null;installed:boolean;/** Inkling-2-Mini: false for a quant 0.2.23 no longer offers (listed only while it is installed; never recommended, never downloaded). */offered?:boolean;/** The line of credit shown with the version (GSQ-RCO: GSQ + RCO by IST Austria DASLab, Apache-2.0). */credit?:string;/** Installed, but the file is an older one than the one offered now (SQ-20 of 0.2.22): the list says so; the old file keeps working and is never deleted. */update_available?:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean;}
|
||||
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;/** The files without the lookup table (the download minus the n-gram / PLE / Engram file): what the fit label and the "Needs" figure use. */fit_gb?:number|null;format?:string;/** Qwen3.6: its own context rule (strata_control/own_path_fit.py via the catalog, #5715). */context_fit?:import('./native-fit').ContextFit|null;/** Tencent Hy4-Flash: where the build's experts go on this PC (strata_control/hy4_fit.py via the catalog). */hy4?:{placement:{vram_gb:number;ram_gb:number;ssd_gb:number};mode:'ram_vram_zero_ssd'|'near_resident_ssd'|'cross_tier_ssd';recommended:boolean;unified:boolean;engram_gb:number}|null;/** Inkling-2-Mini: hardware placement & auto-selection (strata_control/inkling_fit.py via the catalog). */inkling?:{placement:{vram_gb:number;ram_gb:number;ssd_gb:number;full_vram?:boolean};mode:'full_vram'|'ram_vram_zero_ssd'|'near_resident_ssd'|'cross_tier_ssd';recommended:boolean;unified:boolean;context:number;kv_gb:number;parallel_choices?:number[]}|null;installed:boolean;/** Inkling-2-Mini: false for a quant 0.2.23 no longer offers (listed only while it is installed; never recommended, never downloaded). */offered?:boolean;/** The line of credit shown with the version (GSQ-RCO: GSQ + RCO by IST Austria DASLab, Apache-2.0). */credit?:string;/** Installed, but the file is an older one than the one offered now (SQ-20 of 0.2.22): the list says so; the old file keeps working and is never deleted. */update_available?:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean;/** A custom build (the person's own .strata or .gguf, used in place): its id is its own run config; `model` is the closest official build. */custom?:boolean;displayName?:string;customBytes?:number;}
|
||||
export interface NativeFamily {family:string;title:string;about:string;experimental:boolean;images:boolean;sizes:NativeSize[];/** A model of the signed update feed (shown after the built-in ones); `available:false` = this engine does not run it, `unavailable_reason` says so in plain words. */feed?:boolean;available?:boolean;unavailable_reason?:string}
|
||||
export interface NativeField {id:string;label:string;group:string;type:'number'|'boolean'|'string'|'enum'|'array';min?:number;max?:number;choices?:string[];hint?:string;supported?:boolean}
|
||||
export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;family?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record<string,any>|null;progress?:Record<string,any>|null;/** An engine update beside a loaded model: which step it is on and the models it concerns (the app words these itself). */step?:'getting-ready'|'stopping'|'stopped';models?:string[]}
|
||||
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;arch?:string|null;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;/** One short line when the model was loaded without picture reading although it was on (no internet for the picture files, no room on the disk). */picturesNote?:string;metrics:Record<string,any>|null}
|
||||
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;/** A custom build (the person's own model files, used in place). */custom?:boolean;arch?:string|null;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;/** One short line when the model was loaded without picture reading although it was on (no internet for the picture files, no room on the disk). */picturesNote?:string;metrics:Record<string,any>|null}
|
||||
export interface NativeState {
|
||||
/** The host has not had an answer from Control yet (it is still starting): not "nothing installed". */
|
||||
checking?: boolean;
|
||||
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
|
||||
/** Strata Control's view of the engine for this computer (the app): usable false = none found or recognised; `notice` says why in plain words. */
|
||||
engine?:{usable:boolean;notice?:string|null;wrongMake?:boolean;version?:string|null;/** Installed shape engines (e.g. strata-inkling, strata-hy4) reported by Control. */shapes?:{shape:string;component:string;usable:boolean;version?:string|null;backend?:string|null;notice?:string|null}[];/** What the last update check found newer (kept on this PC, read without the network): the engine, the app. */updateAvailable?:{engine?:string|null;app?:string|null}|null};
|
||||
visionReader?: boolean;/** The installed app (Strata Control is bundled): picture files, engines and updates go through it. */packaged?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** A DeepSeek model of an earlier Strata (Control's models list: no longer run): its one line and Control's refusal. */retired?:{line:string;refusal:string};/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;/** The picture choice saved was made with a reader present (ui_vision_chosen): an off holds even without the picture files. */visionChosen?:boolean;/** The data folder the model's own run config keeps its pack and draft layer in (not the app's models folder). */runDataFolder?:string;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;/** The Main / Helper / Off per card the model was last started with (its run config's gpu_roles), when it has them. */gpuRoles?:Record<string,string>;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;/** The context was picked by a person (a marker saved with the model); a saved 32K without it is the old default. */contextChosen?:boolean;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;/** a unified-memory chip's BIOS carve-out (setup.py amd_apply_uma) */dedicated_gb?:number;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;/** Models an engine update stopped, to offer starting them again with the same settings (updated: false = the update did not finish, the old engine is unchanged). */stoppedForUpdate?:{updated:boolean;at:string;models:{id:string;label:string}[]}|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;/** Control's word that DFlash2 uses the converted pack (the selector as Q4_0 rows, 175 MiB less graphics memory): the fit says 0.72 GB instead of 0.89 */dflash2Selq4?:boolean;/** Control's plan: the all-cards split engine takes an Auto start on this computer (it runs the MTP, so Auto is the MTP, not DFlash2) */dflash2Split?:boolean;/** What was measured on this kind of card, in Control's words (null until Control answers). */dflash2Support?:{level:'tested'|'slower'|'untested';line:string}|null;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
|
||||
visionReader?: boolean;/** The installed app (Strata Control is bundled): picture files, engines and updates go through it. */packaged?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** A custom build kept in place (Control writes its own run config, with these fields): only the run config is removed, never the person's files. */custom?:boolean;display_name?:string;base_family?:string;base_model?:string;custom_bytes?:number;/** A DeepSeek model of an earlier Strata (Control's models list: no longer run): its one line and Control's refusal. */retired?:{line:string;refusal:string};/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;/** The picture choice saved was made with a reader present (ui_vision_chosen): an off holds even without the picture files. */visionChosen?:boolean;/** The data folder the model's own run config keeps its pack and draft layer in (not the app's models folder). */runDataFolder?:string;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;/** The Main / Helper / Off per card the model was last started with (its run config's gpu_roles), when it has them. */gpuRoles?:Record<string,string>;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;/** The context was picked by a person (a marker saved with the model); a saved 32K without it is the old default. */contextChosen?:boolean;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;/** a unified-memory chip's BIOS carve-out (setup.py amd_apply_uma) */dedicated_gb?:number;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;/** Models an engine update stopped, to offer starting them again with the same settings (updated: false = the update did not finish, the old engine is unchanged). */stoppedForUpdate?:{updated:boolean;at:string;models:{id:string;label:string}[]}|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;/** Control's word that DFlash2 uses the converted pack (the selector as Q4_0 rows, 175 MiB less graphics memory): the fit says 0.72 GB instead of 0.89 */dflash2Selq4?:boolean;/** Control's plan: the all-cards split engine takes an Auto start on this computer (it runs the MTP, so Auto is the MTP, not DFlash2) */dflash2Split?:boolean;/** What was measured on this kind of card, in Control's words (null until Control answers). */dflash2Support?:{level:'tested'|'slower'|'untested';line:string}|null;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
|
||||
let state:NativeState|null=null;
|
||||
const listeners=new Set<()=>void>();
|
||||
/** True once the first read of the native state has ended, whatever its answer: until then the Models page must not pick a model of its own (#3740). */
|
||||
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "Ein Modell läuft bereits über das Terminal",
|
||||
"gtui02": "Ein mit strata launch gestartetes Modell belegt Port {0}, deshalb hat sich Strata stattdessen auf Port {1} geöffnet. Die Seite des Terminals auf Port {0} verlangt einen eigenen API-Schlüssel, und diese App verwendet diese Seite nicht. Um hier ein Modell zu laden, beenden Sie zuerst das Modell des Terminals (strata launch --stop). Auf Port {0} gespeicherte Chats und Einstellungen werden hier nicht angezeigt.",
|
||||
"gtui03": "Einige frühere Bilder fehlen",
|
||||
"gtui04": "Bilder aus früheren Nachrichten sind in diesem Browser nicht mehr gespeichert, deshalb sieht das Modell sie in dieser Antwort nicht. Hängen Sie sie erneut an, wenn sie wichtig sind."
|
||||
"gtui04": "Bilder aus früheren Nachrichten sind in diesem Browser nicht mehr gespeichert, deshalb sieht das Modell sie in dieser Antwort nicht. Hängen Sie sie erneut an, wenn sie wichtig sind.",
|
||||
"cm01": "Lokale Modelldateien verwenden (.strata oder .gguf)…",
|
||||
"cm02": "Sie haben bereits ein unterstütztes Modell auf diesem Computer, etwa ein kompatibles Fine-Tuning oder eine kompatible Quantisierung? Wählen Sie den Ordner mit den Dateien oder eine der .strata- oder .gguf-Dateien. Strata prüft sie, bereitet das Modell vor und lädt es. Nichts wird kopiert oder heruntergeladen, und Ihre Dateien werden nie verändert.",
|
||||
"cm03": "Ordner mit den Modelldateien oder eine .strata- oder .gguf-Datei",
|
||||
"cm04": "Strata führt Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash und Inkling-2-Mini aus, dazu kompatible Fine-Tunings und Quantisierungen davon. Laden Sie eines unter Modelle herunter oder wählen Sie seine .strata- oder .gguf-Dateien.",
|
||||
"cm05": "Prüfen Sie, ob der Ordner vollständige .strata- oder .gguf-Dateien enthält, und versuchen Sie es erneut. Die unter Details genannte Datei zeigt, was daran nicht stimmt.",
|
||||
"cm06": "Eigene Variante",
|
||||
"cm07": "Nächstliegende Variante:",
|
||||
"cm08": "So wird das Modell in Strata aufgeführt. Ihre Dateien bleiben, wo sie sind.",
|
||||
"cm09": "Geben Sie diesem Modell einen Namen.",
|
||||
"cm10": "Aus Strata entfernen",
|
||||
"cm11": "Eigene Variante · Nicht geladen. Öffnen Sie Modelle, um es zu laden.",
|
||||
"cm12": "Lokale Modelldatei ·",
|
||||
"cm13": "Wählen Sie die .strata- oder .gguf-Datei des Modells. Bei einem geteilten .gguf-Modell wählen Sie einen beliebigen Teil; Strata findet den ersten und prüft den ganzen Satz.",
|
||||
"cm14": "Hier sind keine Modelldateien",
|
||||
"cm15": "Es werden nur Ordner sowie .strata- und .gguf-Dateien angezeigt. LoRA-Adapter und Bildprojektoren brauchen eigene Unterstützung.",
|
||||
"cm16": "Wählen Sie eine vollständige Textmodell-Datei (.strata oder .gguf).",
|
||||
"cm17": "Dieses Modell aus Strata entfernen?",
|
||||
"cm18": "Modell behalten",
|
||||
"cm19": "Es wird nur der Eintrag in Strata entfernt. Ihre .strata- oder .gguf-Dateien bleiben, wo sie sind, und werden nicht verändert."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "A model is already running from the Terminal",
|
||||
"gtui02": "A model started with strata launch is using port {0}, so Strata opened on port {1} instead. The Terminal’s page on port {0} asks for its own API key, and this app does not use that page. To load a model here, stop the Terminal’s one first (strata launch --stop). Chats and settings saved on port {0} are not shown here.",
|
||||
"gtui03": "Some earlier pictures are missing",
|
||||
"gtui04": "Pictures from earlier messages are no longer stored in this browser, so the model does not see them in this answer. Attach them again if they matter."
|
||||
"gtui04": "Pictures from earlier messages are no longer stored in this browser, so the model does not see them in this answer. Attach them again if they matter.",
|
||||
"cm01": "Use local model files (.strata or .gguf)…",
|
||||
"cm02": "Already have a supported model on this computer, such as a compatible fine-tune or quantization? Choose the folder that holds its files, or one of its .strata or .gguf files. Strata checks them, prepares the model and loads it. Nothing is copied or downloaded, and your files are never changed.",
|
||||
"cm03": "Folder with the model files, or one .strata or .gguf file",
|
||||
"cm04": "Strata runs Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash and Inkling-2-Mini, and compatible fine-tunes and quantizations of them. Download one from Models, or choose its .strata or .gguf files.",
|
||||
"cm05": "Check that the folder holds complete .strata or .gguf files, then try again. The file named under Details says what is wrong with it.",
|
||||
"cm06": "Custom build",
|
||||
"cm07": "Closest build:",
|
||||
"cm08": "This is how the model is listed in Strata. Your files stay where they are.",
|
||||
"cm09": "Give this model a name.",
|
||||
"cm10": "Remove from Strata",
|
||||
"cm11": "Custom · Not loaded. Open Models to load it.",
|
||||
"cm12": "Local model file ·",
|
||||
"cm13": "Choose the model’s .strata or .gguf file. For a split .gguf model, choose any shard; Strata finds the first and checks the full set.",
|
||||
"cm14": "No model files here",
|
||||
"cm15": "Only folders and .strata or .gguf files are shown. LoRA adapters and image projectors need separate support.",
|
||||
"cm16": "Choose a complete text model file (.strata or .gguf).",
|
||||
"cm17": "Remove this model from Strata?",
|
||||
"cm18": "Keep model",
|
||||
"cm19": "Only the entry in Strata is removed. Your .strata or .gguf files stay where they are and are not changed."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "Ya hay un modelo en marcha desde el Terminal",
|
||||
"gtui02": "Un modelo iniciado con strata launch está usando el puerto {0}, así que Strata se abrió en el puerto {1}. La página del Terminal en el puerto {0} pide su propia clave de API, y esta aplicación no usa esa página. Para cargar un modelo aquí, detenga primero el del Terminal (strata launch --stop). Los chats y los ajustes guardados en el puerto {0} no se muestran aquí.",
|
||||
"gtui03": "Faltan algunas imágenes anteriores",
|
||||
"gtui04": "Las imágenes de mensajes anteriores ya no están guardadas en este navegador, así que el modelo no las ve en esta respuesta. Adjúntelas de nuevo si son importantes."
|
||||
"gtui04": "Las imágenes de mensajes anteriores ya no están guardadas en este navegador, así que el modelo no las ve en esta respuesta. Adjúntelas de nuevo si son importantes.",
|
||||
"cm01": "Usar archivos de modelo locales (.strata o .gguf)…",
|
||||
"cm02": "¿Ya tiene un modelo compatible en este ordenador, por ejemplo un ajuste fino o una cuantización compatible? Elija la carpeta que contiene sus archivos, o uno de sus archivos .strata o .gguf. Strata los comprueba, prepara el modelo y lo carga. No se copia ni se descarga nada, y sus archivos nunca se modifican.",
|
||||
"cm03": "Carpeta con los archivos del modelo, o un archivo .strata o .gguf",
|
||||
"cm04": "Strata ejecuta Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash e Inkling-2-Mini, y los ajustes finos y cuantizaciones compatibles de ellos. Descargue uno desde Modelos, o elija sus archivos .strata o .gguf.",
|
||||
"cm05": "Compruebe que la carpeta contiene archivos .strata o .gguf completos y vuelva a intentarlo. El archivo indicado en Detalles dice qué falla.",
|
||||
"cm06": "Versión personalizada",
|
||||
"cm07": "Versión más cercana:",
|
||||
"cm08": "Así se muestra el modelo en Strata. Sus archivos se quedan donde están.",
|
||||
"cm09": "Póngale un nombre a este modelo.",
|
||||
"cm10": "Quitar de Strata",
|
||||
"cm11": "Versión personalizada · No cargado. Abra Modelos para cargarlo.",
|
||||
"cm12": "Archivo de modelo local ·",
|
||||
"cm13": "Elija el archivo .strata o .gguf del modelo. Si es un modelo .gguf dividido, elija cualquier parte; Strata encuentra la primera y comprueba el conjunto completo.",
|
||||
"cm14": "No hay archivos de modelo aquí",
|
||||
"cm15": "Solo se muestran carpetas y archivos .strata o .gguf. Los adaptadores LoRA y los proyectores de imagen necesitan compatibilidad aparte.",
|
||||
"cm16": "Elija un archivo de modelo de texto completo (.strata o .gguf).",
|
||||
"cm17": "¿Quitar este modelo de Strata?",
|
||||
"cm18": "Conservar el modelo",
|
||||
"cm19": "Solo se quita la entrada en Strata. Sus archivos .strata o .gguf se quedan donde están y no se modifican."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "Un modèle tourne déjà depuis le Terminal",
|
||||
"gtui02": "Un modèle lancé avec strata launch utilise le port {0} ; Strata s’est donc ouvert sur le port {1}. La page du Terminal sur le port {0} demande sa propre clé d’API, et cette application n’utilise pas cette page. Pour charger un modèle ici, arrêtez d’abord celui du Terminal (strata launch --stop). Les conversations et réglages enregistrés sur le port {0} ne sont pas affichés ici.",
|
||||
"gtui03": "Certaines images précédentes sont absentes",
|
||||
"gtui04": "Les images des messages précédents ne sont plus conservées dans ce navigateur ; le modèle ne les voit donc pas dans cette réponse. Joignez-les de nouveau si elles comptent."
|
||||
"gtui04": "Les images des messages précédents ne sont plus conservées dans ce navigateur ; le modèle ne les voit donc pas dans cette réponse. Joignez-les de nouveau si elles comptent.",
|
||||
"cm01": "Utiliser des fichiers de modèle locaux (.strata ou .gguf)…",
|
||||
"cm02": "Vous avez déjà un modèle pris en charge sur cet ordinateur, par exemple un fine-tuning ou une quantification compatible ? Choisissez le dossier qui contient ses fichiers, ou l’un de ses fichiers .strata ou .gguf. Strata les vérifie, prépare le modèle et le charge. Rien n’est copié ni téléchargé, et vos fichiers ne sont jamais modifiés.",
|
||||
"cm03": "Dossier des fichiers du modèle, ou un fichier .strata ou .gguf",
|
||||
"cm04": "Strata exécute Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash et Inkling-2-Mini, ainsi que leurs fine-tunings et quantifications compatibles. Téléchargez-en un depuis Modèles, ou choisissez ses fichiers .strata ou .gguf.",
|
||||
"cm05": "Vérifiez que le dossier contient des fichiers .strata ou .gguf complets, puis réessayez. Le fichier indiqué sous Détails dit ce qui ne va pas.",
|
||||
"cm06": "Version personnalisée",
|
||||
"cm07": "Version la plus proche :",
|
||||
"cm08": "C’est ainsi que le modèle apparaît dans Strata. Vos fichiers restent où ils sont.",
|
||||
"cm09": "Donnez un nom à ce modèle.",
|
||||
"cm10": "Retirer de Strata",
|
||||
"cm11": "Version personnalisée · Non chargé. Ouvrez Modèles pour le charger.",
|
||||
"cm12": "Fichier de modèle local ·",
|
||||
"cm13": "Choisissez le fichier .strata ou .gguf du modèle. Pour un modèle .gguf fractionné, choisissez n’importe quelle partie ; Strata trouve la première et vérifie l’ensemble.",
|
||||
"cm14": "Aucun fichier de modèle ici",
|
||||
"cm15": "Seuls les dossiers et les fichiers .strata ou .gguf sont affichés. Les adaptateurs LoRA et les projecteurs d’images demandent une prise en charge distincte.",
|
||||
"cm16": "Choisissez un fichier de modèle texte complet (.strata ou .gguf).",
|
||||
"cm17": "Retirer ce modèle de Strata ?",
|
||||
"cm18": "Garder le modèle",
|
||||
"cm19": "Seule l’entrée dans Strata est retirée. Vos fichiers .strata ou .gguf restent où ils sont et ne sont pas modifiés."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "מודל כבר פועל מהטרמינל",
|
||||
"gtui02": "מודל שהופעל באמצעות strata launch משתמש בפורט {0}, ולכן Strata נפתחה בפורט {1}. הדף של הטרמינל בפורט {0} דורש מפתח API משלו, והאפליקציה הזאת אינה משתמשת בדף הזה. כדי לטעון כאן מודל, עצרו קודם את המודל של הטרמינל (strata launch --stop). שיחות והגדרות ששמורות בפורט {0} אינן מוצגות כאן.",
|
||||
"gtui03": "חלק מהתמונות הקודמות חסרות",
|
||||
"gtui04": "התמונות מהודעות קודמות כבר אינן שמורות בדפדפן הזה, ולכן המודל לא רואה אותן בתשובה הזאת. צרפו אותן שוב אם הן חשובות."
|
||||
"gtui04": "התמונות מהודעות קודמות כבר אינן שמורות בדפדפן הזה, ולכן המודל לא רואה אותן בתשובה הזאת. צרפו אותן שוב אם הן חשובות.",
|
||||
"cm01": "שימוש בקובצי מודל מקומיים (.strata או .gguf)…",
|
||||
"cm02": "כבר יש לכם במחשב הזה מודל נתמך, למשל כוונון עדין או כימות תואם? בחרו את התיקייה שמכילה את הקבצים שלו, או אחד מקובצי ה-.strata או ה-.gguf שלו. Strata בודקת אותם, מכינה את המודל וטוענת אותו. שום דבר לא מועתק ולא מורד, והקבצים שלכם לא משתנים לעולם.",
|
||||
"cm03": "תיקייה עם קובצי המודל, או קובץ .strata או .gguf אחד",
|
||||
"cm04": "Strata מריצה את Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash ו-Inkling-2-Mini, ואת הכוונונים העדינים והכימותים התואמים שלהם. הורידו אחד מתוך מודלים, או בחרו את קובצי ה-.strata או ה-.gguf שלו.",
|
||||
"cm05": "ודאו שהתיקייה מכילה קובצי .strata או .gguf שלמים ונסו שוב. הקובץ שמופיע תחת פרטים מראה מה לא בסדר.",
|
||||
"cm06": "גרסה מותאמת",
|
||||
"cm07": "הגרסה הקרובה ביותר:",
|
||||
"cm08": "כך המודל מופיע ב-Strata. הקבצים שלכם נשארים במקומם.",
|
||||
"cm09": "תנו שם למודל הזה.",
|
||||
"cm10": "הסרה מ-Strata",
|
||||
"cm11": "גרסה מותאמת · לא נטען. פתחו את מודלים כדי לטעון אותו.",
|
||||
"cm12": "קובץ מודל מקומי ·",
|
||||
"cm13": "בחרו את קובץ ה-.strata או ה-.gguf של המודל. במודל .gguf מפוצל אפשר לבחור כל חלק; Strata מוצאת את הראשון ובודקת את הקבוצה כולה.",
|
||||
"cm14": "אין כאן קובצי מודל",
|
||||
"cm15": "מוצגים רק תיקיות וקובצי .strata או .gguf. מתאמי LoRA ומקרני תמונה דורשים תמיכה נפרדת.",
|
||||
"cm16": "בחרו קובץ מודל טקסט שלם (.strata או .gguf).",
|
||||
"cm17": "להסיר את המודל הזה מ-Strata?",
|
||||
"cm18": "להשאיר את המודל",
|
||||
"cm19": "רק הרישום ב-Strata יוסר. קובצי ה-.strata או ה-.gguf שלכם נשארים במקומם ולא משתנים."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "ターミナルからモデルがすでに動いています",
|
||||
"gtui02": "strata launch で起動したモデルがポート {0} を使っているため、Strata はポート {1} で開きました。ターミナルのポート {0} のページは独自の API キーを求めますが、このアプリはそのページを使いません。ここでモデルを読み込むには、先にターミナル側のモデルを停止してください(strata launch --stop)。ポート {0} に保存されたチャットと設定は、ここには表示されません。",
|
||||
"gtui03": "以前の画像の一部が見つかりません",
|
||||
"gtui04": "以前のメッセージの画像はこのブラウザーに保存されていないため、今回の返答ではモデルに見えません。必要なら、もう一度添付してください。"
|
||||
"gtui04": "以前のメッセージの画像はこのブラウザーに保存されていないため、今回の返答ではモデルに見えません。必要なら、もう一度添付してください。",
|
||||
"cm01": "ローカルのモデルファイルを使う(.strata または .gguf)…",
|
||||
"cm02": "このコンピューターに、対応するモデル(互換性のあるファインチューンや量子化版など)がすでにありますか。そのファイルが入っているフォルダー、または .strata か .gguf のファイルを選んでください。Strata がファイルを確認し、モデルを準備して読み込みます。コピーもダウンロードも行わず、ファイルが変更されることはありません。",
|
||||
"cm03": "モデルファイルのフォルダー、または .strata か .gguf のファイル",
|
||||
"cm04": "Strata は Qwen3.8-Flash-Next、Qwen3.6-35B-A3B、HY-4 Flash、Inkling-2-Mini と、その互換のファインチューンや量子化版を実行できます。「モデル」からダウンロードするか、その .strata または .gguf ファイルを選んでください。",
|
||||
"cm05": "フォルダーに完全な .strata または .gguf ファイルがあることを確認して、もう一度お試しください。「詳細」に示されたファイルが問題の箇所です。",
|
||||
"cm06": "カスタム版",
|
||||
"cm07": "最も近い版:",
|
||||
"cm08": "Strata でのモデルの表示名です。ファイルは元の場所に残ります。",
|
||||
"cm09": "このモデルに名前を付けてください。",
|
||||
"cm10": "Strata から削除",
|
||||
"cm11": "カスタム版 · 未読み込み。「モデル」を開いて読み込みます。",
|
||||
"cm12": "ローカルのモデルファイル ·",
|
||||
"cm13": "モデルの .strata または .gguf ファイルを選んでください。分割された .gguf モデルは、どの分割でも構いません。Strata が最初の分割を見つけ、全体を確認します。",
|
||||
"cm14": "ここにはモデルファイルがありません",
|
||||
"cm15": "フォルダーと .strata または .gguf ファイルだけを表示しています。LoRA アダプターと画像プロジェクターは別途の対応が必要です。",
|
||||
"cm16": "完全なテキストモデルのファイル(.strata または .gguf)を選んでください。",
|
||||
"cm17": "このモデルを Strata から削除しますか?",
|
||||
"cm18": "モデルを残す",
|
||||
"cm19": "Strata の登録だけが削除されます。.strata や .gguf のファイルは元の場所に残り、変更されません。"
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "터미널에서 이미 모델이 실행 중입니다",
|
||||
"gtui02": "strata launch로 시작한 모델이 포트 {0}을(를) 사용 중이어서 Strata는 포트 {1}에서 열렸습니다. 포트 {0}의 터미널 페이지는 자체 API 키를 요구하며, 이 앱은 그 페이지를 사용하지 않습니다. 여기서 모델을 불러오려면 먼저 터미널의 모델을 중지하세요(strata launch --stop). 포트 {0}에 저장된 채팅과 설정은 여기에 표시되지 않습니다.",
|
||||
"gtui03": "이전 사진 일부가 없습니다",
|
||||
"gtui04": "이전 메시지의 사진이 이 브라우저에 더 이상 저장되어 있지 않아 모델이 이번 답변에서 볼 수 없습니다. 필요하면 다시 첨부하세요."
|
||||
"gtui04": "이전 메시지의 사진이 이 브라우저에 더 이상 저장되어 있지 않아 모델이 이번 답변에서 볼 수 없습니다. 필요하면 다시 첨부하세요.",
|
||||
"cm01": "로컬 모델 파일 사용(.strata 또는 .gguf)…",
|
||||
"cm02": "이 컴퓨터에 지원되는 모델(호환되는 파인튜닝 또는 양자화 버전 등)이 이미 있나요? 파일이 들어 있는 폴더나 .strata 또는 .gguf 파일 하나를 선택하세요. Strata가 파일을 확인하고 모델을 준비해 불러옵니다. 아무것도 복사하거나 다운로드하지 않으며, 파일은 절대 변경되지 않습니다.",
|
||||
"cm03": "모델 파일이 있는 폴더 또는 .strata 또는 .gguf 파일 하나",
|
||||
"cm04": "Strata는 Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash, Inkling-2-Mini와 이들의 호환되는 파인튜닝 및 양자화 버전을 실행합니다. 모델에서 하나를 내려받거나 해당 .strata 또는 .gguf 파일을 선택하세요.",
|
||||
"cm05": "폴더에 완전한 .strata 또는 .gguf 파일이 있는지 확인한 뒤 다시 시도하세요. 세부 정보에 표시된 파일이 문제의 원인을 알려 줍니다.",
|
||||
"cm06": "사용자 지정 버전",
|
||||
"cm07": "가장 가까운 버전:",
|
||||
"cm08": "Strata에 표시되는 모델 이름입니다. 파일은 원래 위치에 그대로 있습니다.",
|
||||
"cm09": "이 모델의 이름을 정해 주세요.",
|
||||
"cm10": "Strata에서 제거",
|
||||
"cm11": "사용자 지정 버전 · 불러오지 않음. 모델을 열어 불러오세요.",
|
||||
"cm12": "로컬 모델 파일 ·",
|
||||
"cm13": "모델의 .strata 또는 .gguf 파일을 선택하세요. 분할된 .gguf 모델은 어느 조각을 골라도 됩니다. Strata가 첫 조각을 찾아 전체를 확인합니다.",
|
||||
"cm14": "여기에는 모델 파일이 없습니다",
|
||||
"cm15": "폴더와 .strata 또는 .gguf 파일만 표시됩니다. LoRA 어댑터와 이미지 프로젝터는 별도 지원이 필요합니다.",
|
||||
"cm16": "완전한 텍스트 모델 파일(.strata 또는 .gguf)을 선택하세요.",
|
||||
"cm17": "이 모델을 Strata에서 제거할까요?",
|
||||
"cm18": "모델 유지",
|
||||
"cm19": "Strata의 항목만 제거됩니다. .strata 또는 .gguf 파일은 원래 위치에 그대로 있으며 변경되지 않습니다."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "Já há um modelo em execução a partir do Terminal",
|
||||
"gtui02": "Um modelo iniciado com strata launch está a usar a porta {0}, por isso o Strata abriu na porta {1}. A página do Terminal na porta {0} pede a sua própria chave de API, e esta aplicação não usa essa página. Para carregar um modelo aqui, pare primeiro o do Terminal (strata launch --stop). As conversas e as definições guardadas na porta {0} não são mostradas aqui.",
|
||||
"gtui03": "Faltam algumas imagens anteriores",
|
||||
"gtui04": "As imagens de mensagens anteriores já não estão guardadas neste navegador, por isso o modelo não as vê nesta resposta. Anexe-as de novo se forem importantes."
|
||||
"gtui04": "As imagens de mensagens anteriores já não estão guardadas neste navegador, por isso o modelo não as vê nesta resposta. Anexe-as de novo se forem importantes.",
|
||||
"cm01": "Usar ficheiros de modelo locais (.strata ou .gguf)…",
|
||||
"cm02": "Já tem um modelo compatível neste computador, como um ajuste fino ou uma quantização compatível? Escolha a pasta que contém os seus ficheiros, ou um dos ficheiros .strata ou .gguf. O Strata verifica-os, prepara o modelo e carrega-o. Nada é copiado nem transferido, e os seus ficheiros nunca são alterados.",
|
||||
"cm03": "Pasta com os ficheiros do modelo, ou um ficheiro .strata ou .gguf",
|
||||
"cm04": "O Strata executa o Qwen3.8-Flash-Next, o Qwen3.6-35B-A3B, o HY-4 Flash e o Inkling-2-Mini, e os ajustes finos e quantizações compatíveis deles. Transfira um em Modelos, ou escolha os seus ficheiros .strata ou .gguf.",
|
||||
"cm05": "Confirme que a pasta contém ficheiros .strata ou .gguf completos e tente de novo. O ficheiro indicado em Detalhes diz o que está errado.",
|
||||
"cm06": "Versão personalizada",
|
||||
"cm07": "Versão mais próxima:",
|
||||
"cm08": "É assim que o modelo aparece no Strata. Os seus ficheiros ficam onde estão.",
|
||||
"cm09": "Dê um nome a este modelo.",
|
||||
"cm10": "Remover do Strata",
|
||||
"cm11": "Versão personalizada · Não carregado. Abra Modelos para o carregar.",
|
||||
"cm12": "Ficheiro de modelo local ·",
|
||||
"cm13": "Escolha o ficheiro .strata ou .gguf do modelo. Num modelo .gguf dividido, escolha qualquer parte; o Strata encontra a primeira e verifica o conjunto completo.",
|
||||
"cm14": "Não há ficheiros de modelo aqui",
|
||||
"cm15": "Só são mostradas pastas e ficheiros .strata ou .gguf. Os adaptadores LoRA e os projetores de imagem precisam de suporte à parte.",
|
||||
"cm16": "Escolha um ficheiro de modelo de texto completo (.strata ou .gguf).",
|
||||
"cm17": "Remover este modelo do Strata?",
|
||||
"cm18": "Manter o modelo",
|
||||
"cm19": "Só a entrada no Strata é removida. Os seus ficheiros .strata ou .gguf ficam onde estão e não são alterados."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "Модель уже запущена из Терминала",
|
||||
"gtui02": "Модель, запущенная командой strata launch, занимает порт {0}, поэтому Strata открылась на порту {1}. Страница Терминала на порту {0} запрашивает собственный ключ API, а это приложение её не использует. Чтобы загрузить модель здесь, сначала остановите модель Терминала (strata launch --stop). Чаты и настройки, сохранённые на порту {0}, здесь не показываются.",
|
||||
"gtui03": "Некоторые прежние изображения недоступны",
|
||||
"gtui04": "Изображения из прежних сообщений больше не хранятся в этом браузере, поэтому модель не видит их в этом ответе. Прикрепите их снова, если они важны."
|
||||
"gtui04": "Изображения из прежних сообщений больше не хранятся в этом браузере, поэтому модель не видит их в этом ответе. Прикрепите их снова, если они важны.",
|
||||
"cm01": "Использовать локальные файлы модели (.strata или .gguf)…",
|
||||
"cm02": "Уже есть поддерживаемая модель на этом компьютере, например совместимая дообученная версия или квантизация? Выберите папку с её файлами или один из файлов .strata или .gguf. Strata проверит их, подготовит модель и загрузит её. Ничего не копируется и не скачивается, а ваши файлы никогда не изменяются.",
|
||||
"cm03": "Папка с файлами модели или один файл .strata или .gguf",
|
||||
"cm04": "Strata запускает Qwen3.8-Flash-Next, Qwen3.6-35B-A3B, HY-4 Flash и Inkling-2-Mini, а также их совместимые дообученные версии и квантизации. Скачайте одну в разделе «Модели» или выберите её файлы .strata или .gguf.",
|
||||
"cm05": "Проверьте, что в папке лежат полные файлы .strata или .gguf, и повторите попытку. Файл, названный в разделе «Подробности», показывает, что не так.",
|
||||
"cm06": "Своя сборка",
|
||||
"cm07": "Ближайшая сборка:",
|
||||
"cm08": "Так модель будет показана в Strata. Ваши файлы остаются на месте.",
|
||||
"cm09": "Дайте этой модели имя.",
|
||||
"cm10": "Убрать из Strata",
|
||||
"cm11": "Своя сборка · Не загружена. Откройте «Модели», чтобы загрузить её.",
|
||||
"cm12": "Локальный файл модели ·",
|
||||
"cm13": "Выберите файл модели .strata или .gguf. Для модели .gguf из нескольких частей выберите любую часть: Strata найдёт первую и проверит весь набор.",
|
||||
"cm14": "Здесь нет файлов модели",
|
||||
"cm15": "Показаны только папки и файлы .strata или .gguf. Адаптеры LoRA и проекторы изображений требуют отдельной поддержки.",
|
||||
"cm16": "Выберите полный файл текстовой модели (.strata или .gguf).",
|
||||
"cm17": "Убрать эту модель из Strata?",
|
||||
"cm18": "Оставить модель",
|
||||
"cm19": "Убирается только запись в Strata. Ваши файлы .strata или .gguf остаются на месте и не изменяются."
|
||||
}
|
||||
@@ -2,5 +2,24 @@
|
||||
"gtui01": "终端中已有模型在运行",
|
||||
"gtui02": "用 strata launch 启动的模型正在使用端口 {0},因此 Strata 改在端口 {1} 上打开。终端在端口 {0} 上的页面需要它自己的 API 密钥,而本应用不使用该页面。要在这里加载模型,请先停止终端中的那个模型(strata launch --stop)。保存在端口 {0} 上的聊天和设置不会在这里显示。",
|
||||
"gtui03": "部分之前的图片已丢失",
|
||||
"gtui04": "之前消息中的图片已不再保存在此浏览器中,因此模型在这次回答中看不到它们。如有需要,请重新附加。"
|
||||
"gtui04": "之前消息中的图片已不再保存在此浏览器中,因此模型在这次回答中看不到它们。如有需要,请重新附加。",
|
||||
"cm01": "使用本地模型文件(.strata 或 .gguf)…",
|
||||
"cm02": "这台电脑上已有受支持的模型,例如兼容的微调版或量化版?请选择存放其文件的文件夹,或选择其中一个 .strata 或 .gguf 文件。Strata 会检查文件、准备模型并加载。不会复制或下载任何内容,也不会修改您的文件。",
|
||||
"cm03": "存放模型文件的文件夹,或一个 .strata 或 .gguf 文件",
|
||||
"cm04": "Strata 可运行 Qwen3.8-Flash-Next、Qwen3.6-35B-A3B、HY-4 Flash 和 Inkling-2-Mini,以及它们兼容的微调版和量化版。请在“模型”中下载其一,或选择其 .strata 或 .gguf 文件。",
|
||||
"cm05": "请确认文件夹中是完整的 .strata 或 .gguf 文件,然后重试。“详细信息”中列出的文件会说明问题所在。",
|
||||
"cm06": "自定义版本",
|
||||
"cm07": "最接近的版本:",
|
||||
"cm08": "这是该模型在 Strata 中的显示名称。您的文件保持在原处。",
|
||||
"cm09": "请为此模型起个名字。",
|
||||
"cm10": "从 Strata 移除",
|
||||
"cm11": "自定义版本 · 未加载。打开“模型”即可加载。",
|
||||
"cm12": "本地模型文件 ·",
|
||||
"cm13": "请选择模型的 .strata 或 .gguf 文件。对于拆分的 .gguf 模型,选择任意一个分片即可;Strata 会找到第一个分片并检查整套文件。",
|
||||
"cm14": "这里没有模型文件",
|
||||
"cm15": "只显示文件夹以及 .strata 或 .gguf 文件。LoRA 适配器和图像投影器需要另行支持。",
|
||||
"cm16": "请选择完整的文本模型文件(.strata 或 .gguf)。",
|
||||
"cm17": "要将此模型从 Strata 移除吗?",
|
||||
"cm18": "保留模型",
|
||||
"cm19": "只会移除 Strata 中的条目。您的 .strata 或 .gguf 文件保持在原处,不会被修改。"
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
// 0.2.23 custom models: the person's own compatible .strata and .gguf files, used in place (CUSTOM-MODELS-0223, GUI part).
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdtempSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { build } from 'esbuild';
|
||||
import { browseLocalModels, inspectLocalModel, createLocalModels, customLabel, cleanLabel } from '../server/local-models.mjs';
|
||||
import { ggufFixture } from './helpers/local-gguf.mjs';
|
||||
|
||||
const fixture = t => { const root = mkdtempSync(join(tmpdir(), 'strata-custom-model-')); t.after(() => rmSync(root, { recursive: true, force: true })); return root; };
|
||||
const MAGIC = Buffer.from([0x53, 0x54, 0x52, 0x41, 0x54, 0x41, 0x00, 0x01]);
|
||||
/** A synthetic .strata file: the 8-byte magic then zeros up to `size` (4 KiB or 16 KiB headers are the two real header sizes). */
|
||||
const strataFixture = (file, size = 4096) => { const bytes = Buffer.alloc(size); MAGIC.copy(bytes); writeFileSync(file, bytes); return bytes; };
|
||||
const bundle = async entry => { const out = await build({ stdin: { contents: `export * from '${entry}';`, resolveDir: process.cwd() }, bundle: true, write: false, format: 'esm', platform: 'node', loader: { '.json': 'json' } }); return import(`data:text/javascript;base64,${Buffer.from(out.outputFiles[0].text).toString('base64')}`); };
|
||||
const src = async path => readFile(new URL(`../${path}`, import.meta.url), 'utf8');
|
||||
|
||||
test('a local .strata file (4 KiB and 16 KiB headers) is read by its magic and size only', t => {
|
||||
const root = fixture(t);
|
||||
for (const size of [4096, 16384]) {
|
||||
const file = join(root, `My Finetune ${size}.strata`);
|
||||
strataFixture(file, size);
|
||||
const preview = inspectLocalModel(file);
|
||||
assert.equal(preview.variant.quant, 'STRATA');
|
||||
assert.equal(preview.variant.local.architecture, 'strata');
|
||||
assert.equal(preview.variant.local.shards, 1);
|
||||
assert.equal(preview.variant.source.bytes, size);
|
||||
assert.equal(preview.variant.name, `My Finetune ${size}`);
|
||||
assert.ok(preview.variant.local.path.endsWith('.strata'));
|
||||
}
|
||||
});
|
||||
|
||||
test('a .strata file without the magic, a cut-short file, a helper shard and a folder are refused', t => {
|
||||
const root = fixture(t);
|
||||
const bad = join(root, 'bad.strata'); writeFileSync(bad, Buffer.alloc(4096, 7));
|
||||
assert.throws(() => inspectLocalModel(bad), /STRATA header/);
|
||||
const tiny = join(root, 'tiny.strata'); writeFileSync(tiny, MAGIC);
|
||||
assert.throws(() => inspectLocalModel(tiny), /empty or cut short/);
|
||||
const vision = join(root, 'Inkling-2-Mini-Vision.strata'); strataFixture(vision);
|
||||
assert.throws(() => inspectLocalModel(vision), /picture reader or helper/);
|
||||
mkdirSync(join(root, 'dir.strata'));
|
||||
assert.throws(() => inspectLocalModel(join(root, 'dir.strata')), /rather than its folder/);
|
||||
assert.throws(() => inspectLocalModel(join(root, 'missing.strata')), /unavailable/);
|
||||
});
|
||||
|
||||
test('the name of a .strata model is one printable line: no path pieces, at most 160 characters', t => {
|
||||
const root = fixture(t);
|
||||
const file = join(root, `a b ${'x'.repeat(200)}.strata`);
|
||||
strataFixture(file);
|
||||
const name = inspectLocalModel(file).variant.name;
|
||||
assert.equal(name.length, 160); assert.doesNotMatch(name, /[\u0000-\u001f\\/]/); assert.match(name, /^a b x+$/);
|
||||
assert.equal(cleanLabel('a\u0007b'), 'a b');
|
||||
assert.equal(cleanLabel('../../etc/passwd'), '.. .. etc passwd');
|
||||
});
|
||||
|
||||
test('folder browsing lists .strata and .gguf files and still hides other files', t => {
|
||||
const root = fixture(t);
|
||||
strataFixture(join(root, 'model.strata')); ggufFixture(join(root, 'other.gguf')); writeFileSync(join(root, 'notes.txt'), 'keep'); mkdirSync(join(root, 'sub'));
|
||||
const listing = browseLocalModels(root);
|
||||
assert.deepEqual(listing.entries.map(e => e.name), ['sub', 'model.strata', 'other.gguf']);
|
||||
assert.equal(listing.entries.find(e => e.name === 'model.strata').kind, 'model');
|
||||
});
|
||||
|
||||
test('GGUF files of Strata engine architectures (inkling2, inkling2_loop, hy4) are accepted; unrelated ones keep the Custom Model API guidance', t => {
|
||||
const root = fixture(t);
|
||||
for (const arch of ['inkling2', 'inkling2_loop', 'hy4', 'hy4flash', 'qwen35moe', 'qwen4exp']) {
|
||||
const file = join(root, `${arch}.gguf`); ggufFixture(file, { arch });
|
||||
assert.equal(inspectLocalModel(file).variant.local.architecture, arch);
|
||||
}
|
||||
const clip = join(root, 'clip.gguf'); ggufFixture(clip, { arch: 'clip' });
|
||||
assert.throws(() => inspectLocalModel(clip), /supported by the Strata engine; add it as a Custom model API \(llama-server\)/);
|
||||
});
|
||||
|
||||
test('removing a local reference keeps the person\'s .strata and .gguf files byte for byte', t => {
|
||||
const root = fixture(t);
|
||||
const a = join(root, 'a.strata'), b = join(root, 'b.gguf');
|
||||
const bytesA = strataFixture(a, 16384), bytesB = ggufFixture(b);
|
||||
const service = createLocalModels(join(root, 'data'));
|
||||
const first = inspectLocalModel(a), second = inspectLocalModel(b);
|
||||
service.add(first); service.add(second);
|
||||
assert.equal(service.list().length, 2);
|
||||
service.remove(first.variant.id); service.remove(second.variant.id);
|
||||
assert.equal(service.list().length, 0);
|
||||
assert.deepEqual(readFileSync(a), bytesA); assert.deepEqual(readFileSync(b), bytesB);
|
||||
assert.equal(statSync(a).size, 16384);
|
||||
});
|
||||
|
||||
test('the label sent to setup is a short printable name, never a path', () => {
|
||||
assert.equal(customLabel(' My merge v2 '), 'My merge v2');
|
||||
assert.equal(customLabel('C:\\Users\\me\\models\\x.gguf'), 'C Users me models x.gguf');
|
||||
assert.equal(customLabel('../../x'), 'x');
|
||||
assert.equal(customLabel('a/b\\c'), 'a b c');
|
||||
assert.equal(customLabel('line\none\u0000two'), 'line one two');
|
||||
assert.equal(customLabel('x'.repeat(200)).length, 80);
|
||||
for (const empty of ['', ' ', '...', undefined, null, 5, {}]) assert.equal(customLabel(empty), undefined);
|
||||
});
|
||||
|
||||
const size = (id, model, gb, extra = {}) => ({ id, model, about: '', download_gb: gb, ram_needed_gb: gb + 2, experts_gb: gb - 1, on_this_pc: null, installed: true, ...extra });
|
||||
const families = () => [
|
||||
{ family: 'qwen', title: 'Qwen3.8-Flash-Next', about: '', experimental: false, images: true, sizes: [size('q2_0', 'Q2_0', 10)] },
|
||||
{ family: 'qwen36', title: 'Qwen3.6-35B-A3B', about: '', experimental: false, images: false, sizes: [size('qwen36-ud-iq4_xs', 'UD-IQ4_XS', 20)] },
|
||||
{ family: 'hy4-flash', title: 'HY-4 Flash', about: '', experimental: false, images: true, sizes: [size('hy4-flash-sq-64', 'SQ-64', 60, { hy4: { placement: { vram_gb: 1, ram_gb: 2, ssd_gb: 3 }, mode: 'ram_vram_zero_ssd', recommended: true, unified: false, engram_gb: 1 } })] },
|
||||
{ family: 'inkling-2-mini', title: 'Inkling-2-Mini', about: '', experimental: false, images: true, sizes: [size('inkling-2-mini-sq-20', 'SQ-20', 20, { inkling: { placement: { vram_gb: 1, ram_gb: 2, ssd_gb: 3 }, mode: 'full_vram', recommended: true, unified: false, context: 32768, kv_gb: 1 } }), size('inkling-2-mini-sq-15', 'SQ-15', 15)] },
|
||||
];
|
||||
const row = (model, base_family, base_model, extra = {}) => ({ model, config: `strata-${model}.json`, model_name: `${model} alias`, ready: true, custom: true, display_name: `Mine ${model}`, base_family, base_model, custom_bytes: 12 * 1024 ** 3, ...extra });
|
||||
const official = (model) => ({ model, config: `strata-${model}.json`, model_name: model, ready: true });
|
||||
|
||||
test('installed custom builds join their parent model in the version list, beside the official builds', async () => {
|
||||
const { nativeCatalogModels, catalogVersionLabel } = await bundle('./src/lib/native-catalog');
|
||||
const installed = [official('q2_0'), official('qwen36-ud-iq4_xs'), official('hy4-flash-sq-64'), official('inkling-2-mini-sq-20'),
|
||||
row('custom-q38', 'qwen', 'Q2_0'), row('qwen36-custom-a', 'qwen36', 'UD-IQ4_XS'), row('hy4-flash-custom-a', 'hy4-flash', 'SQ-64'),
|
||||
row('inkling-2-mini-custom-a', 'inkling-2-mini', 'SQ-20'), row('inkling-2-mini-custom-b', 'inkling-2-mini', 'SQ-15', { display_name: 'Merge B' })];
|
||||
const groups = nativeCatalogModels(families(), installed);
|
||||
const byFamily = Object.fromEntries(groups.map(g => [g.family, g]));
|
||||
assert.deepEqual(groups.map(g => g.family), ['qwen3.8', 'qwen3.6', 'hy4-flash', 'inkling-2-mini']);
|
||||
assert.deepEqual(byFamily['qwen3.8'].sizes.map(s => s.id), ['q2_0', 'custom-q38']);
|
||||
assert.deepEqual(byFamily['qwen3.6'].sizes.map(s => s.id), ['qwen36-ud-iq4_xs', 'qwen36-custom-a']);
|
||||
assert.deepEqual(byFamily['hy4-flash'].sizes.map(s => s.id), ['hy4-flash-sq-64', 'hy4-flash-custom-a']);
|
||||
assert.deepEqual(byFamily['inkling-2-mini'].sizes.map(s => s.id), ['inkling-2-mini-sq-20', 'inkling-2-mini-sq-15', 'inkling-2-mini-custom-a', 'inkling-2-mini-custom-b']);
|
||||
for (const g of groups) {
|
||||
const custom = g.sizes.filter(s => s.custom), official = g.sizes.filter(s => !s.custom);
|
||||
assert.ok(custom.length && official.length, `${g.family} lists both kinds`);
|
||||
for (const c of custom) {
|
||||
assert.equal(c.installed, true); assert.equal(c.offered, true); assert.equal(c.edition, 'Custom');
|
||||
assert.equal(c.customBytes, 12 * 1024 ** 3); assert.equal(c.download_gb, 12);
|
||||
assert.equal(catalogVersionLabel(c), c.displayName);
|
||||
assert.ok(!official.some(o => o.id === c.id), 'distinct ids');
|
||||
}
|
||||
}
|
||||
const c = byFamily['inkling-2-mini'].sizes.find(s => s.id === 'inkling-2-mini-custom-a');
|
||||
assert.equal(c.model, 'SQ-20'); assert.equal(c.sourceFamily, 'inkling-2-mini'); assert.equal(c.inkling.recommended, false);
|
||||
assert.equal(byFamily['hy4-flash'].sizes[1].hy4.recommended, false);
|
||||
assert.equal(byFamily['hy4-flash'].sizes[0].hy4.recommended, true, 'the official pick is unchanged');
|
||||
});
|
||||
|
||||
test('a custom build\'s memory figures follow its real file size, not the official size of the build it is closest to', async () => {
|
||||
const { nativeCatalogModels } = await bundle('./src/lib/native-catalog');
|
||||
const groups = nativeCatalogModels(families(), [row('custom-q38', 'qwen', 'Q2_0', { custom_bytes: 14 * 1024 ** 3 })]);
|
||||
const [base, custom] = groups[0].sizes;
|
||||
assert.equal(custom.download_gb, 14);
|
||||
assert.equal(+(custom.ram_needed_gb - base.ram_needed_gb).toFixed(3), 4); // 14 GB file against the 10 GB official build
|
||||
assert.equal(+(custom.experts_gb - base.experts_gb).toFixed(3), 4);
|
||||
});
|
||||
|
||||
test('the official list is unchanged when nothing custom is installed, and an unknown family is never listed', async () => {
|
||||
const { nativeCatalogModels } = await bundle('./src/lib/native-catalog');
|
||||
const plain = nativeCatalogModels(families());
|
||||
assert.deepEqual(nativeCatalogModels(families(), [official('q2_0')]), plain);
|
||||
assert.deepEqual(nativeCatalogModels(families(), [row('custom-x', 'llama', 'Q4_0')]), plain);
|
||||
assert.deepEqual(nativeCatalogModels([], [row('custom-q38', 'qwen', 'Q2_0')]), [], 'no catalog yet: nothing is made up');
|
||||
});
|
||||
|
||||
test('the display name starts from the check, else the file name, and is cleaned', async () => {
|
||||
const { suggestedDisplayName, cleanDisplayName, customTarget, customGroupOf, CUSTOM_FILE_TYPES } = await bundle('./src/lib/custom-models');
|
||||
assert.equal(suggestedDisplayName('Orca Merge', '/x/y.gguf'), 'Orca Merge');
|
||||
assert.equal(suggestedDisplayName('', '/models/My-Merge-00001-of-00003.gguf'), 'My-Merge');
|
||||
assert.equal(suggestedDisplayName(undefined, 'C:\\models\\Inkling Tune.strata'), 'Inkling Tune');
|
||||
assert.equal(suggestedDisplayName(' ', ''), '');
|
||||
assert.equal(cleanDisplayName('a<b>:c|d'), 'a b c d');
|
||||
assert.equal(cleanDisplayName('z'.repeat(200)).length, 80);
|
||||
assert.equal(customTarget('/m/x.strata', '/m', true), '/m/x.strata');
|
||||
assert.equal(customTarget('/m', '/m', true), '/m');
|
||||
assert.equal(customTarget('/m/x.gguf', '/m', false), '/m');
|
||||
assert.deepEqual([customGroupOf('qwen'), customGroupOf('unsloth'), customGroupOf('qwen36'), customGroupOf('hy4-flash'), customGroupOf('inkling-2-mini'), customGroupOf('ornith'), customGroupOf('x')], ['qwen3.8', 'qwen3.8', 'qwen3.6', 'hy4-flash', 'inkling-2-mini', 'ornith', undefined]);
|
||||
assert.deepEqual(CUSTOM_FILE_TYPES['hy4-flash'], ['strata']);
|
||||
assert.deepEqual(CUSTOM_FILE_TYPES['inkling-2-mini'], ['strata', 'gguf']);
|
||||
});
|
||||
|
||||
test('the chat picker names a custom build by its display name', async () => {
|
||||
const { pickerNativeModels, pickerNativeName } = await bundle('./src/lib/model-picker');
|
||||
const rows = [{ model: 'custom-a', model_name: 'alias', custom: true, display_name: 'My Merge', ready: true }, { model: 'q2_0', model_name: 'Qwen3.8-Flash-Next-q2_0', ready: true }];
|
||||
assert.equal(pickerNativeName(rows[0]), 'My Merge'); assert.equal(pickerNativeName(rows[1]), 'Qwen3.8-Flash-Next-q2_0');
|
||||
assert.deepEqual(pickerNativeModels(rows, [{ label: 'My Merge' }]).map(r => r.model), ['q2_0']);
|
||||
});
|
||||
|
||||
test('the import screens say .strata and .gguf, list all four engine families and keep llama-server guidance for other architectures', async () => {
|
||||
const screen = await src('src/components/NativeLocalModel.tsx'), dialog = await src('src/components/LocalModelImport.tsx'), picker = await src('src/components/VersionPicker.tsx'), models = await src('src/components/NativeModels.tsx');
|
||||
for (const text of [screen, models, picker]) assert.match(text, /Use local model files \(\.strata or \.gguf\)…/);
|
||||
for (const family of ['Qwen3.8-Flash-Next', 'Qwen3.6-35B-A3B', 'HY-4 Flash', 'Inkling-2-Mini']) assert.ok(screen.includes(family), family);
|
||||
assert.doesNotMatch(screen, /Use a local GGUF/);
|
||||
assert.match(dialog, /\\\.\(gguf\|strata\)\$/);
|
||||
assert.match(screen, /Custom model API instead: start it with llama-server/, 'unrelated architectures keep the Custom Model API guidance');
|
||||
assert.match(screen, /candidate_selection\?\.suggested_label/);
|
||||
assert.match(screen, /custom_label: customName/);
|
||||
assert.match(screen, /aria-label=\{tr\("Display name"\)\}/);
|
||||
for (const text of [screen, dialog, picker, models]) assert.doesNotMatch(text, /jailbreak|uncensor|abliterat|nsfw/i, 'neutral wording');
|
||||
});
|
||||
|
||||
test('the host passes only a cleaned label to setup, never reuses the official install for a custom build, and removal adds no file deletion', async () => {
|
||||
const control = await src('server/native-control.mjs');
|
||||
assert.match(control, /import \{ customLabel \} from '\.\/local-models\.mjs'/);
|
||||
assert.match(control, /if\(custom\)allowed\.push\('custom_label'\)/);
|
||||
assert.match(control, /const existing=custom\?undefined:/);
|
||||
const start = control.indexOf('async function removeModel'), end = control.indexOf('/* The configuration a load starts the engine with', start);
|
||||
const remove = control.slice(start, end);
|
||||
assert.ok(start > 0 && end > start);
|
||||
assert.match(remove, /strata_remove/);
|
||||
assert.doesNotMatch(remove, /rmSync|unlinkSync|rmdirSync|\brm\(|rename|copyFileSync|writeFileSync/, 'the host deletes nothing itself');
|
||||
assert.match(remove, /Your model files were left in place/);
|
||||
});
|
||||
|
||||
test('every instance of a custom build is listed under its display name with a Custom badge, and its id is the /v1/models name', async () => {
|
||||
const control = await src('server/native-control.mjs');
|
||||
assert.match(control, /\.\.\.\(entry\.custom===true\?\{custom:true\}:\{\}\),label:\(\(entry\.custom===true&&\(entry\.display_name\|\|entry\.model_name\)\)\|\|friendlyModelName/);
|
||||
assert.match(control, /diskBytes:entry\.diskBytes\?\?entry\.disk_bytes\?\?\(entry\.custom===true/);
|
||||
const chat = await src('src/components/ChatModelPicker.tsx');
|
||||
assert.match(chat, /version-tag--custom/);
|
||||
});
|
||||
Reference in new issue
Block a user