Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Pictures: 8-language strings, plain-error rule narrowed, status unit test, real-browser paste/+/drop/off script
Niko122165ac8f9106d7
diff --git a/apps/host/scripts/pictures-ui.mjs b/apps/host/scripts/pictures-ui.mjsnew file mode 100644index 000000000..7c38fc084--- /dev/null+++ b/apps/host/scripts/pictures-ui.mjs@@ -0,0 +1,100 @@+// Needs: a throwaway host (STRATA_UI_BASE, default http://127.0.0.1:18791) and tests/helpers/scripted-worker.mjs listening on 18899 as the model (see ui-drive.mjs ensureMock).+// Pictures in the real app page: paste, "+" and drag-and-drop attach a picture; the OFF switch (per API model) refuses it with a plain message.+import { deflateSync } from 'node:zlib';+import { writeFileSync, mkdirSync } from 'node:fs';+import { ensureMock, open, api } from './ui-drive.mjs';++import { tmpdir } from 'node:os';+import { join } from 'node:path';+const OUT = process.env.PICS_OUT ?? join(tmpdir(), 'pics-ui').replaceAll('\', '/');+mkdirSync(OUT, { recursive: true });+const crc = (() => { const t = new Int32Array(256).map((_, n) => { let c = n; for (let k = 0; k < 8; k++) c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1; return c; }); return b => { let c = -1; for (const x of b) c = t[(c ^ x) & 255] ^ (c >>> 8); return (c ^ -1) >>> 0; }; })();+function png(w, h, rgb) {+ const chunk = (type, data) => { const len = Buffer.alloc(4); len.writeUInt32BE(data.length); const body = Buffer.concat([Buffer.from(type), data]); const c = Buffer.alloc(4); c.writeUInt32BE(crc(body)); return Buffer.concat([len, body, c]); };+ const raw = Buffer.alloc((w * 3 + 1) * h); for (let y = 0; y < h; y++) for (let x = 0; x < w; x++) { const o = y * (w * 3 + 1) + 1 + x * 3; raw[o] = rgb[0]; raw[o + 1] = rgb[1]; raw[o + 2] = rgb[2]; }+ const ihdr = Buffer.alloc(13); ihdr.writeUInt32BE(w, 0); ihdr.writeUInt32BE(h, 4); ihdr[8] = 8; ihdr[9] = 2;+ return Buffer.concat([Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]), chunk('IHDR', ihdr), chunk('IDAT', deflateSync(raw)), chunk('IEND', Buffer.alloc(0))]);+}+const file = `${OUT}/blue.png`; writeFileSync(file, png(64, 64, [30, 80, 220]));+const b64 = png(48, 48, [220, 40, 40]).toString('base64');+let failed = false;+const ok = (name, cond, detail = '') => { if (!cond) failed = true; console.log(`${cond ? 'ok ' : 'FAIL'} ${name}${detail ? ' ' + detail : ''}`); };++const connection = await ensureMock();+const { browser, page } = await open();+await page.locator('.chat-model-picker').first().click();+await page.locator('.model-picker-api').first().click();+await page.waitForTimeout(500);+const photos = () => page.locator('.composer .chat-photos img').count();+const textarea = page.locator('.composer textarea');++// 1. paste from the clipboard (a screenshot arrives as image.png)+await textarea.focus();+await page.evaluate(b64 => {+ const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));+ const data = new DataTransfer(); data.items.add(new File([bytes], 'image.png', { type: 'image/png' }));+ document.querySelector('.composer textarea').dispatchEvent(new ClipboardEvent('paste', { clipboardData: data, bubbles: true, cancelable: true }));+}, b64);+await page.waitForTimeout(700);+ok('paste: the picture is attached', await photos() === 1, `${await photos()} picture(s)`);+ok('paste: it has its own name', /Pasted picture/.test(await page.locator('.composer .chat-photos span').first().innerText()));+await page.screenshot({ path: `${OUT}/1-paste.png` });++// 2. the "+" menu+const chooser = page.waitForEvent('filechooser');+await page.locator('.composer-add').click();+await page.getByText('Add files or photos').click();+(await chooser).setFiles(file);+await page.waitForTimeout(700);+ok('+: the picture is attached', await photos() === 2, `${await photos()} picture(s)`);++// 3. drag and drop onto the conversation+await page.evaluate(b64 => {+ const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));+ const data = new DataTransfer(); data.items.add(new File([bytes], 'dropped.png', { type: 'image/png' }));+ const target = document.querySelector('.chatcol');+ for (const type of ['dragenter', 'dragover', 'drop']) target.dispatchEvent(new DragEvent(type, { dataTransfer: data, bubbles: true, cancelable: true }));+}, b64);+await page.waitForTimeout(700);+ok('drop: the picture is attached', await photos() === 3, `${await photos()} picture(s)`);+await page.screenshot({ path: `${OUT}/2-three.png` });++// 4. send: the model's request carries the pictures+await textarea.fill('what is in the pictures SCRIPT:echo seen');+await page.getByRole('button', { name: 'Send' }).click();+await page.waitForTimeout(6000);+const seen = (await (await fetch('http://127.0.0.1:18899/__requests')).json()).requests;+const withImages = seen.filter(r => (r.raw.match(/"type":"image_url"/g) ?? []).length || (r.raw.match(/"image_url"/g) ?? []).length);+ok('send: the model received the pictures as image input', withImages.length >= 1, `${withImages.length} request(s) with image input`);+await page.screenshot({ path: `${OUT}/3-sent.png` });++// 5. the OFF switch in Settings > Models+await page.getByText('More', { exact: true }).first().click();+await page.getByText('Settings', { exact: true }).first().click();+await page.locator('#settings-tab-Models').click();+await page.locator('#settings-panel-Models').getByRole('button', { name: /Edit/ }).first().click();+const box = page.locator('#settings-panel-Models .provider-selected input[type=checkbox]').first();+await box.scrollIntoViewIfNeeded();+ok('off switch: on by default', await box.isChecked());+await page.screenshot({ path: `${OUT}/4-settings-on.png` });+await box.uncheck();+await page.locator('#settings-panel-Models').getByRole('button', { name: 'Apply' }).first().click();+await page.waitForTimeout(1000);+const saved = (await api('/api/model-providers')).body.connections.find(c => c.id === connection.id).models[0];+ok('off switch: saved as off', saved.vision === false && saved.reads === false, JSON.stringify({ vision: saved.vision, reads: saved.reads }));+await page.keyboard.press('Escape');+await page.waitForTimeout(500);+await page.locator('.composer-add').click().catch(() => {});+await page.keyboard.press('Escape');+await page.evaluate(b64 => {+ const bytes = Uint8Array.from(atob(b64), c => c.charCodeAt(0));+ const data = new DataTransfer(); data.items.add(new File([bytes], 'image.png', { type: 'image/png' }));+ document.querySelector('.composer textarea').dispatchEvent(new ClipboardEvent('paste', { clipboardData: data, bubbles: true, cancelable: true }));+}, b64);+await page.waitForTimeout(700);+const message = await page.locator('.composer .verror, .composer [role=alert]').first().innerText().catch(() => '');+ok('off: a pasted picture is refused with a plain message and a next step', /turned off/.test(message) && /Models/.test(message), message.replace(/\s+/g, ' ').slice(0, 160));+ok('off: nothing was attached', await photos() === 0);+await page.screenshot({ path: `${OUT}/5-off.png` });+await browser.close();+process.exit(failed ? 1 : 0);diff --git a/apps/host/scripts/ui-drive.mjs b/apps/host/scripts/ui-drive.mjsnew file mode 100644index 000000000..8fea26877--- /dev/null+++ b/apps/host/scripts/ui-drive.mjs@@ -0,0 +1,26 @@+// Shared helpers for driving a throwaway host with Playwright (the app page in a real browser). STRATA_UI_BASE = the host's address, CHROME_PATH = the browser.+export { chromium } from 'playwright-core';+import { chromium as browserType } from 'playwright-core';+export const BASE = process.env.STRATA_UI_BASE ?? 'http://127.0.0.1:18791';+export const CHROME = process.env.CHROME_PATH ?? 'C:/Program Files/Google/Chrome/Application/chrome.exe';+export async function api(path, method = 'GET', body) {+ const r = await fetch(BASE + path, { method, headers: { 'content-type': 'application/json' }, body: body === undefined ? undefined : JSON.stringify(body) });+ return { status: r.status, body: await r.json().catch(() => null) };+}+export async function ensureMock(name = 'Mock model', models = [{ id: 'mock-model', name: 'Mock model' }], baseUrl = 'http://127.0.0.1:18899/v1') {+ const list = (await api('/api/model-providers')).body;+ const have = list.connections.find(c => c.name === name);+ const res = await api('/api/model-providers', 'POST', { ...(have ? { id: have.id } : {}), kind: 'custom', provider: null, name, baseUrl, protocol: 'openai-chat', apiKey: '', models });+ return res.body.connections.find(c => c.name === name);+}+export async function open({ theme = 'light', width = 1400, height = 900 } = {}) {+ const browser = await browserType.launch({ executablePath: CHROME, headless: true });+ const context = await browser.newContext({ viewport: { width, height }, deviceScaleFactor: 1, colorScheme: theme, permissions: ['clipboard-read', 'clipboard-write'] });+ const page = await context.newPage();+ await page.goto(BASE + '/');+ await page.waitForTimeout(1500);+ const skip = page.getByText('Go straight to the app');+ await skip.waitFor({ timeout: 10000 }).catch(() => {});+ if (await skip.count()) { await skip.click(); await page.waitForTimeout(800); }+ return { browser, context, page };+}diff --git a/apps/host/src/components/ComposerControls.tsx b/apps/host/src/components/ComposerControls.tsxindex 193e35af0..4dab29925 100644--- a/apps/host/src/components/ComposerControls.tsx+++ b/apps/host/src/components/ComposerControls.tsx@@ -94,7 +94,7 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlasif (!directory && (photoTypes.test(file.name) || /\.pdf$/i.test(file.name))) {await openFile(file);if (photoTypes.test(file.name))- onError(`${pictures.ok ? '' : pictures.message} It is open in preview.`);+ onError(`${pictures.ok ? '' : tr(pictures.message)} ${tr('It is open in preview.')}`);continue;}if (!textTypes.test(file.name) || bytes + file.size > 256 * 1024) {diff --git a/apps/host/src/lib/plain-errors.ts b/apps/host/src/lib/plain-errors.tsindex a08f28a3b..9fb76d75f 100644--- a/apps/host/src/lib/plain-errors.ts+++ b/apps/host/src/lib/plain-errors.ts@@ -15,7 +15,7 @@ const MEMORY_NEXT = 'Close other programs and try again, or choose “Leave 20%/** Order matters: the first rule that matches wins. */const RULES: Rule[] = [- { kind: 'picture-reading', match: /vision files|picture reading/i, message: 'Picture reading isn’t available for this model.', next: 'Turn off picture reading and try again.' },+ { kind: 'picture-reading', match: /vision files|enabling picture reading/i, message: 'Picture reading isn’t available for this model.', next: 'Turn off picture reading and try again.' },{ kind: 'access', match: /PermissionError|access is denied|can.t open its settings file/i, message: 'Strata can’t open its settings file.', next: 'Run Strata once as yourself (not as administrator) or press Repair.' },// A start that died: the exit code or the engine's own last line says why. Say "low on memory" only when that evidence is there// (2026-10-17: a missing DLL, 0xC0000135, was reported as "ran low on memory" and told the tester to free RAM).diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.tsindex a2a1ed80f..39a5e4182 100644--- a/apps/host/src/lib/store.ts+++ b/apps/host/src/lib/store.ts@@ -1527,7 +1527,7 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; greturn;}const pictureCheck=pictureStatus(nativeState(),state.remoteModel,state.providers);- if(pendingChatPhotos(state.activeSession).length&&!pictureCheck.ok){pushToast('error','This model cannot read pictures',pictureCheck.message);return;}+ if(pendingChatPhotos(state.activeSession).length&&!pictureCheck.ok){pushToast('error','This model cannot read pictures',tr(pictureCheck.message));return;}const pictures=takeChatPhotos(state.activeSession);const body=text.trim()||(pictures.length?'Describe this picture.':'');if(!body&&!resume&&!planStart)return;diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.jsonindex 10640289d..9961bdfda 100644--- a/apps/host/src/locales/de.json+++ b/apps/host/src/locales/de.json@@ -3151,5 +3151,16 @@"s3155": "Strata wurde beendet. Du kannst diesen Tab schließen. Um es wieder zu nutzen, starte Strata über sein Symbol.","s3156": "Strata konnte von hier aus nicht beendet werden. Starte die App im Terminal mit --quit oder versuche es erneut.","s3157": "Wird beendet …",- "s3158": "Die mit der App gelieferte Engine wird entpackt. Beim ersten Start dauert das etwa eine Minute."+ "s3158": "Die mit der App gelieferte Engine wird entpackt. Beim ersten Start dauert das etwa eine Minute.",+ "s3159": "Standardmäßig an",+ "s3160": "Versteht Fotos, Screenshots und Diagramme. Die Bilddateien werden automatisch geladen. Schalte es aus, um Speicher zu sparen.",+ "s3161": "Bilder mit diesem Modell lesen",+ "s3162": "(sein Server sagt, dass es das nicht kann)",+ "s3163": "(standardmäßig an)",+ "s3164": "Bilder lassen sich nur an Modell-APIs im OpenAI-Chat-Stil senden. Wähle ein anderes Modell oder entferne das Bild.",+ "s3165": "Das Lesen von Bildern ist für dieses Modell ausgeschaltet. Öffne Einstellungen, Modelle, bearbeite die Verbindung und schalte „Bilder mit diesem Modell lesen“ ein, oder wähle ein anderes Modell.",+ "s3166": "Lade zuerst ein Modell, das Bilder lesen kann, und füge dann das Bild hinzu.",+ "s3167": "Dieses Modell wurde ohne Bilderkennung gestartet. Öffne Modelle, schalte „Bilder lesen“ ein und lade es erneut.",+ "s3168": "Dieses Modell kann keine Bilder lesen. Wähle ein Modell, das Bilder lesen kann, oder entferne das Bild.",+ "s3169": "Es ist in der Vorschau geöffnet."}diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.jsonindex e5643af80..ec270e7f2 100644--- a/apps/host/src/locales/en.json+++ b/apps/host/src/locales/en.json@@ -3151,5 +3151,16 @@"s3155": "Strata has stopped. You can close this tab. To use it again, start Strata from its icon.","s3156": "Strata could not be stopped from here. Run the app with --quit in a terminal, or try again.","s3157": "Quitting…",- "s3158": "Unpacking the engine that came with the app. This takes about a minute the first time."+ "s3158": "Unpacking the engine that came with the app. This takes about a minute the first time.",+ "s3159": "On by default",+ "s3160": "Understand photos, screenshots and charts. The picture files download automatically. Turn it off to save memory.",+ "s3161": "Read pictures with this model",+ "s3162": "(its server says it cannot)",+ "s3163": "(on by default)",+ "s3164": "Pictures can only be sent to model APIs that use the OpenAI chat style. Choose another model, or remove the picture.",+ "s3165": "Picture reading is turned off for this model. Open Settings, Models, edit the connection and turn on Read pictures with this model, or choose another model.",+ "s3166": "Load a model that reads pictures first, then add the picture.",+ "s3167": "This model was started without picture reading. Open Models, turn on Read pictures and load it again.",+ "s3168": "This model cannot read pictures. Choose a model that reads pictures, or remove the picture.",+ "s3169": "It is open in preview."}diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.jsonindex a9559c76b..8c301a224 100644--- a/apps/host/src/locales/es.json+++ b/apps/host/src/locales/es.json@@ -3151,5 +3151,16 @@"s3155": "Strata se ha detenido. Puedes cerrar esta pestaña. Para volver a usarlo, inicia Strata desde su icono.","s3156": "No se pudo detener Strata desde aquí. Ejecuta la app con --quit en una terminal o inténtalo de nuevo.","s3157": "Saliendo…",- "s3158": "Se está descomprimiendo el motor incluido con la app. La primera vez tarda aproximadamente un minuto."+ "s3158": "Se está descomprimiendo el motor incluido con la app. La primera vez tarda aproximadamente un minuto.",+ "s3159": "Activado por defecto",+ "s3160": "Entiende fotos, capturas de pantalla y gráficos. Los archivos de imágenes se descargan solos. Desactívalo para ahorrar memoria.",+ "s3161": "Leer imágenes con este modelo",+ "s3162": "(su servidor dice que no puede)",+ "s3163": "(activado por defecto)",+ "s3164": "Las imágenes solo se pueden enviar a APIs de modelos con el estilo de chat de OpenAI. Elige otro modelo o quita la imagen.",+ "s3165": "La lectura de imágenes está desactivada para este modelo. Abre Ajustes, Modelos, edita la conexión y activa «Leer imágenes con este modelo», o elige otro modelo.",+ "s3166": "Primero carga un modelo que lea imágenes y luego añade la imagen.",+ "s3167": "Este modelo se inició sin lectura de imágenes. Abre Modelos, activa «Leer imágenes» y cárgalo de nuevo.",+ "s3168": "Este modelo no puede leer imágenes. Elige un modelo que lea imágenes o quita la imagen.",+ "s3169": "Está abierta en la vista previa."}diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.jsonindex 235e60f84..4c1778524 100644--- a/apps/host/src/locales/ja.json+++ b/apps/host/src/locales/ja.json@@ -3151,5 +3151,16 @@"s3155": "Strata を停止しました。このタブを閉じて構いません。もう一度使うには、アイコンから Strata を起動してください。","s3156": "ここから Strata を停止できませんでした。ターミナルで --quit を付けてアプリを実行するか、もう一度お試しください。","s3157": "終了しています…",- "s3158": "アプリに付属のエンジンを展開しています。初回は1分ほどかかります。"+ "s3158": "アプリに付属のエンジンを展開しています。初回は1分ほどかかります。",+ "s3159": "初期設定でオン",+ "s3160": "写真、スクリーンショット、グラフを理解します。画像用のファイルは自動でダウンロードされます。メモリを節約したいときはオフにしてください。",+ "s3161": "このモデルで画像を読み取る",+ "s3162": "(サーバーは対応していないと答えています)",+ "s3163": "(初期設定でオン)",+ "s3164": "画像を送れるのは OpenAI チャット形式のモデル API だけです。別のモデルを選ぶか、画像を取り除いてください。",+ "s3165": "このモデルでは画像の読み取りがオフです。設定 → モデルで接続を編集し、「このモデルで画像を読み取る」をオンにするか、別のモデルを選んでください。",+ "s3166": "まず画像を読み取れるモデルを読み込んでから、画像を追加してください。",+ "s3167": "このモデルは画像の読み取りなしで起動されました。モデルを開き、「画像を読み取る」をオンにして読み込み直してください。",+ "s3168": "このモデルは画像を読み取れません。画像を読み取れるモデルを選ぶか、画像を取り除いてください。",+ "s3169": "画像はプレビューで開いています。"}diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.jsonindex 663d9a60a..9255cac48 100644--- a/apps/host/src/locales/ko.json+++ b/apps/host/src/locales/ko.json@@ -3151,5 +3151,16 @@"s3155": "Strata가 종료되었습니다. 이 탭을 닫아도 됩니다. 다시 사용하려면 아이콘에서 Strata를 실행하세요.","s3156": "여기서는 Strata를 종료하지 못했습니다. 터미널에서 --quit 옵션으로 앱을 실행하거나 다시 시도하세요.","s3157": "종료하는 중…",- "s3158": "앱에 포함된 엔진의 압축을 푸는 중입니다. 처음에는 약 1분이 걸립니다."+ "s3158": "앱에 포함된 엔진의 압축을 푸는 중입니다. 처음에는 약 1분이 걸립니다.",+ "s3159": "기본으로 켜짐",+ "s3160": "사진, 스크린샷, 차트를 이해합니다. 이미지 파일은 자동으로 내려받습니다. 메모리를 아끼려면 끄세요.",+ "s3161": "이 모델로 이미지 읽기",+ "s3162": "(서버가 지원하지 않는다고 답했습니다)",+ "s3163": "(기본으로 켜짐)",+ "s3164": "이미지는 OpenAI 채팅 방식을 쓰는 모델 API로만 보낼 수 있습니다. 다른 모델을 고르거나 이미지를 제거하세요.",+ "s3165": "이 모델은 이미지 읽기가 꺼져 있습니다. 설정, 모델에서 연결을 편집해 '이 모델로 이미지 읽기'를 켜거나 다른 모델을 고르세요.",+ "s3166": "먼저 이미지를 읽을 수 있는 모델을 불러온 다음 이미지를 추가하세요.",+ "s3167": "이 모델은 이미지 읽기 없이 시작되었습니다. 모델에서 '이미지 읽기'를 켜고 다시 불러오세요.",+ "s3168": "이 모델은 이미지를 읽을 수 없습니다. 이미지를 읽는 모델을 고르거나 이미지를 제거하세요.",+ "s3169": "미리보기에서 열려 있습니다."}diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.jsonindex e60522102..4d4e876ad 100644--- a/apps/host/src/locales/pt.json+++ b/apps/host/src/locales/pt.json@@ -3151,5 +3151,16 @@"s3155": "O Strata parou. Pode fechar este separador. Para o usar de novo, inicie o Strata a partir do seu ícone.","s3156": "Não foi possível parar o Strata a partir daqui. Execute a app com --quit num terminal ou tente novamente.","s3157": "A sair…",- "s3158": "A descompactar o motor que veio com a app. Na primeira vez leva cerca de um minuto."+ "s3158": "A descompactar o motor que veio com a app. Na primeira vez leva cerca de um minuto.",+ "s3159": "Ativado por padrão",+ "s3160": "Entende fotos, capturas de tela e gráficos. Os arquivos de imagem são baixados automaticamente. Desative para economizar memória.",+ "s3161": "Ler imagens com este modelo",+ "s3162": "(o servidor dele diz que não consegue)",+ "s3163": "(ativado por padrão)",+ "s3164": "As imagens só podem ser enviadas a APIs de modelos no estilo de chat da OpenAI. Escolha outro modelo ou remova a imagem.",+ "s3165": "A leitura de imagens está desativada para este modelo. Abra Configurações, Modelos, edite a conexão e ative «Ler imagens com este modelo», ou escolha outro modelo.",+ "s3166": "Carregue primeiro um modelo que leia imagens e depois adicione a imagem.",+ "s3167": "Este modelo foi iniciado sem leitura de imagens. Abra Modelos, ative «Ler imagens» e carregue-o novamente.",+ "s3168": "Este modelo não consegue ler imagens. Escolha um modelo que leia imagens ou remova a imagem.",+ "s3169": "Ela está aberta na visualização."}diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.jsonindex 69f37eff2..32825beac 100644--- a/apps/host/src/locales/ru.json+++ b/apps/host/src/locales/ru.json@@ -3151,5 +3151,16 @@"s3155": "Strata остановлена. Эту вкладку можно закрыть. Чтобы снова пользоваться, запустите Strata по её значку.","s3156": "Не удалось остановить Strata отсюда. Запустите приложение с --quit в терминале или повторите попытку.","s3157": "Выход…",- "s3158": "Распаковывается движок, поставляемый с приложением. При первом запуске это занимает около минуты."+ "s3158": "Распаковывается движок, поставляемый с приложением. При первом запуске это занимает около минуты.",+ "s3159": "Включено по умолчанию",+ "s3160": "Понимает фотографии, скриншоты и диаграммы. Файлы для работы с картинками загружаются автоматически. Отключите, чтобы сэкономить память.",+ "s3161": "Читать картинки с этой моделью",+ "s3162": "(его сервер сообщает, что не умеет)",+ "s3163": "(включено по умолчанию)",+ "s3164": "Картинки можно отправлять только в API моделей в стиле чата OpenAI. Выберите другую модель или уберите картинку.",+ "s3165": "Чтение картинок для этой модели выключено. Откройте Настройки, Модели, измените подключение и включите «Читать картинки с этой моделью» либо выберите другую модель.",+ "s3166": "Сначала загрузите модель, которая читает картинки, затем добавьте картинку.",+ "s3167": "Эта модель была запущена без чтения картинок. Откройте Модели, включите «Читать картинки» и загрузите её снова.",+ "s3168": "Эта модель не умеет читать картинки. Выберите модель, которая их читает, или уберите картинку.",+ "s3169": "Она открыта в предпросмотре."}diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.jsonindex 877612abc..3d596a06b 100644--- a/apps/host/src/locales/zh.json+++ b/apps/host/src/locales/zh.json@@ -3151,5 +3151,16 @@"s3155": "Strata 已停止。你可以关闭此标签页。要再次使用,请从图标启动 Strata。","s3156": "无法在这里停止 Strata。请在终端中用 --quit 运行应用,或再试一次。","s3157": "正在退出…",- "s3158": "正在解压随应用附带的引擎。首次启动大约需要一分钟。"+ "s3158": "正在解压随应用附带的引擎。首次启动大约需要一分钟。",+ "s3159": "默认开启",+ "s3160": "理解照片、截图和图表。图片文件会自动下载。关闭可节省内存。",+ "s3161": "用此模型读取图片",+ "s3162": "(其服务器表示不支持)",+ "s3163": "(默认开启)",+ "s3164": "图片只能发送给使用 OpenAI 聊天风格的模型 API。请选择其他模型,或移除图片。",+ "s3165": "此模型已关闭图片读取。请打开“设置”→“模型”,编辑该连接并开启“用此模型读取图片”,或选择其他模型。",+ "s3166": "请先加载能读取图片的模型,再添加图片。",+ "s3167": "此模型启动时没有开启图片读取。请打开“模型”,开启“读取图片”后重新加载。",+ "s3168": "此模型无法读取图片。请选择能读取图片的模型,或移除图片。",+ "s3169": "图片已在预览中打开。"}diff --git a/apps/host/tests/pictures-status.test.mjs b/apps/host/tests/pictures-status.test.mjsnew file mode 100644index 000000000..b47d91f0e--- /dev/null+++ b/apps/host/tests/pictures-status.test.mjs@@ -0,0 +1,39 @@+/** One answer for "can this model take a picture?" (src/lib/pictures.ts): the composer and Send agree, pictures are on by default. */+import test from 'node:test';+import assert from 'node:assert/strict';+import { readFile } from 'node:fs/promises';+import { transform } from 'esbuild';++const source = await readFile(new URL('../src/lib/pictures.ts', import.meta.url), 'utf8');+const { code } = await transform(source, { loader: 'ts', format: 'esm' });+const { pictureStatus } = await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);++const native = (vision, { images = true, ready = true } = {}) => ({+ defaultId: 'i1', instances: [{ id: 'i1', model: 'Gyro-S', status: ready ? 'ready' : 'loading', vision }],+ catalog: { families: [{ family: 'gyro', images, sizes: [{ id: 'Gyro-S' }] }] },+});+const api = (model, protocol = 'openai-chat') => ({ connections: [{ id: 'c', protocol, models: [{ id: 'm', ...model }] }] });+const pick = { connectionId: 'c', modelId: 'm' };++test('a local model that was loaded with picture reading takes pictures', () => {+ assert.equal(pictureStatus(native(true), null, null).ok, true);+});++test('a local model that could read pictures but was loaded without says what to do (the stale-flag case of imageissue2)', () => {+ const r = pictureStatus(native(false), null, null);+ assert.equal(r.ok, false); assert.equal(r.why, 'local-off'); assert.match(r.message, /Open Models, turn on Read pictures and load it again/);+});++test('a local model that cannot read pictures, and no model at all, say so plainly', () => {+ assert.equal(pictureStatus(native(false, { images: false }), null, null).why, 'local-cannot');+ assert.equal(pictureStatus(native(false, { ready: false }), null, null).why, 'none');+ assert.equal(pictureStatus(null, null, null).why, 'none');+});++test('an API model takes pictures unless it was switched off or its server said no', () => {+ assert.equal(pictureStatus(null, pick, api({})).ok, true, 'nothing said: on');+ assert.equal(pictureStatus(null, pick, api({ reads: true })).ok, true);+ const off = pictureStatus(null, pick, api({ reads: false }));+ assert.equal(off.ok, false); assert.equal(off.why, 'api-off'); assert.match(off.message, /turn on Read pictures with this model/);+ assert.equal(pictureStatus(null, pick, api({}, 'anthropic')).why, 'api-style');+});