The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(q4): follow the house rules for the preview, recall and catalog
purple718f23344458
diff --git a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts b/dev-server/__tests__/mlx-media-endpoint-coverage.test.tsindex 89246241..0f592cce 100644--- a/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts+++ b/dev-server/__tests__/mlx-media-endpoint-coverage.test.ts@@ -210,6 +210,10 @@ describe('endpointMap covers every backendCall/invokeMedia site the frontend can// components/models/HfLinkInbox.tsx). Read only behind isTauri(): a link// from the system reaches the desktop app, never the browser build.'hf_link_take',+ // The chat's HTML preview page (B29, 3.0.9, lib/html-preview-source.ts).+ // Put up only behind isTauri(): the browser build loads the page as+ // srcdoc and has no scheme to serve it from.+ 'html_preview_put','exit_app', 'file_read', 'find_orphan_downloads', 'fix_comfyui_cors', 'funnel_ping','get_comfy_gpu_status', 'get_current_time', 'import_local_model', 'install_character_trainer','install_lmstudio', 'install_lmstudio_status', 'install_method', 'install_python',diff --git a/src-tauri/tauri.ios.conf.json b/src-tauri/tauri.ios.conf.jsonindex bf993689..5d4d0d27 100644--- a/src-tauri/tauri.ios.conf.json+++ b/src-tauri/tauri.ios.conf.json@@ -16,7 +16,7 @@}],"security": {- "csp": "default-src 'self' ipc: http://ipc.localhost; connect-src 'self' blob: ipc: http://ipc.localhost http://tauri.localhost http://localhost:* http://127.0.0.1:* https://lu-labs.ai https://lrrhheztdytyfpizvuup.supabase.co https://civitai.com https://*.civitai.com https://huggingface.co https://*.huggingface.co https://ollama.com https://openrouter.ai https://api.openai.com https://api.groq.com https://api.together.xyz https://api.deepseek.com https://api.mistral.ai https://api.anthropic.com ws://localhost:* ws://127.0.0.1:*; img-src 'self' data: blob: http://localhost:* http://127.0.0.1:* https://lrrhheztdytyfpizvuup.supabase.co https://*.civitai.com https://*.githubusercontent.com; media-src 'self' blob: http://localhost:* http://127.0.0.1:* https://lrrhheztdytyfpizvuup.supabase.co https://lu-labs.ai; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval'"+ "csp": "default-src 'self' ipc: http://ipc.localhost; connect-src 'self' blob: ipc: http://ipc.localhost http://tauri.localhost http://localhost:* http://127.0.0.1:* https://lu-labs.ai https://lrrhheztdytyfpizvuup.supabase.co https://civitai.com https://*.civitai.com https://huggingface.co https://*.huggingface.co https://ollama.com https://openrouter.ai https://api.openai.com https://api.groq.com https://api.together.xyz https://api.deepseek.com https://api.mistral.ai https://api.anthropic.com ws://localhost:* ws://127.0.0.1:*; img-src 'self' data: blob: http://localhost:* http://127.0.0.1:* https://lrrhheztdytyfpizvuup.supabase.co https://*.civitai.com https://*.githubusercontent.com; media-src 'self' blob: http://localhost:* http://127.0.0.1:* https://lrrhheztdytyfpizvuup.supabase.co https://lu-labs.ai; font-src 'self' data:; style-src 'self' 'unsafe-inline'; script-src 'self' 'wasm-unsafe-eval'; frame-src 'self' luprev: http://luprev.localhost"}},"bundle": {diff --git a/src/components/chat/HtmlPreviewPanel.tsx b/src/components/chat/HtmlPreviewPanel.tsxindex acb0c0a5..6019f441 100644--- a/src/components/chat/HtmlPreviewPanel.tsx+++ b/src/components/chat/HtmlPreviewPanel.tsx@@ -41,7 +41,7 @@ export function HtmlPreviewPanel({ code, language, variant, onClose, onExpand }:<div className="flex items-center gap-0.5"><buttononClick={toggleNetwork}- className={`${ICON_BTN} flex items-center gap-1 t-micro ${allowNetwork ? 'text-amber-500 dark:text-amber-400' : ''}`}+ className={`${ICON_BTN} flex items-center gap-1 t-micro ${allowNetwork ? 'text-emerald-500 dark:text-emerald-400' : ''}`}aria-pressed={allowNetwork}title={allowNetwork ? 'This page may load from the internet (https). Click to turn off.' : 'This page cannot reach the internet. Click to allow it.'}data-testid="html-preview-network"@@ -63,11 +63,11 @@ export function HtmlPreviewPanel({ code, language, variant, onClose, onExpand }:</div></div>{askingNetwork && (- <div className="flex flex-wrap items-center gap-2 px-3 py-2 t-label text-gray-600 dark:text-gray-300 bg-amber-50 dark:bg-amber-500/10 border-b border-amber-200 dark:border-amber-500/20" data-testid="html-preview-network-ask">+ <div className="flex flex-wrap items-center gap-2 px-3 py-2 t-label text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-white/[0.04] border-b border-gray-200 dark:border-white/10" data-testid="html-preview-network-ask"><span className="flex-1 min-w-[12rem]">Let this page load from the internet? It can then fetch scripts and pictures over https and send what it contains to any website. Your computer, LU and local servers stay closed to it.</span>- <button className="px-2 py-0.5 rounded-md border border-amber-300 dark:border-amber-500/30 hover:bg-amber-100 dark:hover:bg-amber-500/20" onClick={() => { setAllowNetwork(true); setAskingNetwork(false) }}>+ <button className="px-2 py-0.5 rounded-md border border-gray-300 dark:border-white/15 hover:bg-gray-100 dark:hover:bg-white/10" onClick={() => { setAllowNetwork(true); setAskingNetwork(false) }}>Allow for this page</button><button className="px-2 py-0.5 rounded-md hover:bg-gray-100 dark:hover:bg-white/10" onClick={() => setAskingNetwork(false)}>diff --git a/src/components/settings/ChatRecallToggle.tsx b/src/components/settings/ChatRecallToggle.tsxindex 310a4d8a..77465e4b 100644--- a/src/components/settings/ChatRecallToggle.tsx+++ b/src/components/settings/ChatRecallToggle.tsx@@ -2,6 +2,7 @@ import { useSettingsStore } from '../../stores/settingsStore'import { useEmbedLane } from '../../hooks/useEmbedLane'import { laneIsOnThisMachine } from '../../api/embed-availability'import { InlineToggle } from './InlineToggle'+import { HINWEIS_TEXT } from '../../lib/hinweis'/*** B33: the switch for recall in long chats, under Auto-compact. Off by@@ -30,7 +31,7 @@ export function ChatRecallToggle() {/><div className="t-micro text-gray-500 dark:text-gray-500 leading-relaxed pt-0.5">After a compaction, the messages the summary stands for are indexed on this computer. With each new message, the few that relate to it most are sent along word for word, so details the summary dropped are not lost.- {why && <span className="block text-amber-600 dark:text-amber-400/80 pt-0.5">{why}</span>}+ {why && <span className={`block pt-0.5 ${HINWEIS_TEXT.ruhig}`}>{why}</span>}</div></div>)diff --git a/src/lib/html-preview-source.ts b/src/lib/html-preview-source.tsindex 95369de7..fd7e609a 100644--- a/src/lib/html-preview-source.ts+++ b/src/lib/html-preview-source.ts@@ -6,14 +6,14 @@* own closed policy; a srcdoc frame would inherit the app's, which allows no* inline script, so a generated page never ran in the installed app.*- * In the browser build there is no scheme. The page goes in as srcdoc with the- * closed policy as its first tag (the same one the phone preview uses); the- * network switch cannot open anything there, which errs on the safe side.+ * In the browser build there is no scheme. The page goes in as srcdoc with a+ * closed policy as its first tag (same rule as the phone preview's+ * withPolicyOnly, which the desktop may not import); the network switch+ * cannot open anything there, which errs on the safe side.** Nothing here runs on its own: the caller asks on the user's click.*/import { isTauri, backendCall } from '../api/backend'-import { withPolicyOnly } from '../mobile/screens/agent/parts/preview-doc'/** The scheme the Rust side registers. */export const PREVIEW_SCHEME = 'luprev'@@ -22,6 +22,18 @@ export type PreviewSource =| { kind: 'src'; src: string }| { kind: 'doc'; doc: string }+/** The closed policy of the browser fallback: inline script and style, pictures it carries, nothing else. */+export const FALLBACK_CSP =+ "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:; form-action 'none'; base-uri 'none'"++/** A doctype, the html tag and the head tag, anchored at the start: the policy goes behind those and before anything the page could run. */+const POLICY_SPOT = /^\s*(?:<!doctype[^>]*>\s*)?(?:<html(?:\s(?:[^>"']|"[^"]*"|'[^']*')*)?>\s*)?(?:<head(?:\s(?:[^>"']|"[^"]*"|'[^']*')*)?>)?/i++export function withClosedPolicy(doc: string): string {+ const at = POLICY_SPOT.exec(doc)?.[0].length ?? 0+ return doc.slice(0, at) + `<meta http-equiv="Content-Security-Policy" content="${FALLBACK_CSP}">` + doc.slice(at)+}+/** The URL of a stored page: `luprev://localhost/<id>` on macOS and Linux,* `http://luprev.localhost/<id>` on Windows and Android (Tauri's own rule). */export async function previewUrl(id: string): Promise<string> {@@ -31,7 +43,7 @@ export async function previewUrl(id: string): Promise<string> {/** Put the document up for one preview and say how the frame loads it. */export async function putPreviewDocument(doc: string, allowNetwork: boolean): Promise<PreviewSource> {- if (!isTauri()) return { kind: 'doc', doc: withPolicyOnly(doc) }+ if (!isTauri()) return { kind: 'doc', doc: withClosedPolicy(doc) }const id = await backendCall<string>('html_preview_put', { doc, allowNetwork })return { kind: 'src', src: await previewUrl(id) }}diff --git a/src/lib/settings-catalog.ts b/src/lib/settings-catalog.tsindex 2ac76f0e..a43c922b 100644--- a/src/lib/settings-catalog.ts+++ b/src/lib/settings-catalog.ts@@ -177,6 +177,7 @@ const e = (export const CATALOG: readonly CatalogEntry[] = [// Context. Three different knobs, the help says which is which.e('autoCompact', 'Auto-compact', 'general', 'Summarise older turns automatically when the chat nears the context window.', bool()),+ e('chatRecall', 'Recall older messages', 'general', 'After a compaction, send the older messages that relate to the new one along, found by a local embedding model.', bool()),e('autoCompactThreshold', 'Auto-compact at', 'general', 'How full the context window gets before auto-compact runs.', compactThreshold),e('contextWindowOverride', 'Context window (Ollama)', 'general', 'num_ctx sent to Ollama, in tokens. Other backends ignore it.', int(0, CONTEXT_WINDOW_MAX, 'tokens', 'auto')),e('engineIdleUnloadMinutes', 'Unload the model when unused', 'backends', 'Minutes without use before LU Engine frees the model.', int(0, 1_440, 'min', 'never')),