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(engine): der alte Name verschwindet auch aus Rust-Meldungen und Logzeilen
purple4c064e18d8be
diff --git a/src-tauri/src/commands/engine.rs b/src-tauri/src/commands/engine.rsindex d50a9aa8..d2703f63 100644--- a/src-tauri/src/commands/engine.rs+++ b/src-tauri/src/commands/engine.rs@@ -592,7 +592,7 @@ pub fn builtin_models_dir() -> Result<PathBuf, String> {let base = dirs::data_dir().ok_or("Cannot resolve app data directory")?;let dir = base.join("Locally Uncensored").join("models");std::fs::create_dir_all(&dir)- .map_err(|e| format!("Create built-in models dir: {}", os_error::english(&e)))?;+ .map_err(|e| format!("Create LU Engine models folder: {}", os_error::english(&e)))?;Ok(dir)}@@ -1367,7 +1367,7 @@ fn spawn_engine_attempt(port: u16,ctx: u32,) -> Result<(), StartFailure> {- println!("[Engine] Starting built-in llama-server on port {port}, model {model_path}");+ println!("[Engine] Starting LU Engine llama-server on port {port}, model {model_path}");let mut cmd = Command::new(binary);cmd.args(args).stdin(Stdio::null())@@ -1818,13 +1818,13 @@ pub(crate) fn import_model_file(src: &Path, dest_dir: &Path, name: &str) -> Resulet target = dest_dir.join(sanitize_model_file_name(name));if target.exists() {return Err(format!(- "A model named {} already exists in the built-in models folder",+ "A model named {} already exists in the LU Engine models folder",target.file_name().and_then(|s| s.to_str()).unwrap_or("?")));}std::fs::hard_link(src, &target).map_err(|e| {format!(- "Could not link the model into the built-in folder ({e}). \+ "Could not link the model into the LU Engine folder ({e}). \Linking needs source and destination on the same drive. \Move the models folder (Settings, Model Storage) to that drive, \or copy the file there yourself."@@ -2165,7 +2165,7 @@ fn start_bundled_embed_blocking());}- println!("[Engine] Built-in embeddings server healthy on port {port}");+ println!("[Engine] LU Engine embeddings server healthy on port {port}");Ok(serde_json::json!({"status": "started","port": port,@@ -2226,7 +2226,7 @@ pub(crate) fn stop_embed_locked(state: &AppState) -> bool {if let Some(mut embed) = guard.take() {let _ = embed.child.kill();let _ = embed.child.wait();- println!("[Engine] Built-in embeddings server stopped (port {})", embed.port);+ println!("[Engine] LU Engine embeddings server stopped (port {})", embed.port);true} else {falsediff --git a/src/api/__tests__/builtin-engine-diagnose.test.ts b/src/api/__tests__/builtin-engine-diagnose.test.tsindex 8b833609..17cbbdae 100644--- a/src/api/__tests__/builtin-engine-diagnose.test.ts+++ b/src/api/__tests__/builtin-engine-diagnose.test.ts@@ -156,7 +156,7 @@ describe('diagnoseBuiltinEngine', () => {})it('says so when the model folder itself cannot be read', async () => {- backend({ running: false, healthy: false }, new Error('Create built-in models dir: permission denied'))+ backend({ running: false, healthy: false }, new Error('Create LU Engine models folder: permission denied'))const d = await diagnoseBuiltinEngine({ repair: true })expect(d.reason).toMatch(/model folder could not be read/i)expect(d.reason).toContain('permission denied')diff --git a/src/api/embed-install.ts b/src/api/embed-install.tsindex 7327b6e9..694bc340 100644--- a/src/api/embed-install.ts+++ b/src/api/embed-install.ts@@ -19,7 +19,7 @@ export async function installBundledEmbedModel(onProgress?: (completed: number, total: number) => void,): Promise<void> {const destDir = await detectProviderModelPath(BUILTIN_BACKEND_ID)- if (!destDir) throw new Error('Could not resolve the built-in models directory.')+ if (!destDir) throw new Error('Could not resolve the LU Engine models folder.')const { downloadUrl, filename, sizeGB } = ONBOARDING_EMBED_MODELuseDownloadStore.getState().setMeta(filename, downloadUrl, 'gguf', destDir)diff --git a/src/api/rag.ts b/src/api/rag.tsindex 89d3e45d..28f64067 100644--- a/src/api/rag.ts+++ b/src/api/rag.ts@@ -160,7 +160,7 @@ async function embedViaBuiltin(texts: string[], model: string): Promise<number[]// OpenAI shape: { data: [{ embedding: number[], index }] }. Sort by index so// the vectors line up with the input order even if the server reorders them.if (!data?.data || !Array.isArray(data.data)) {- throw new Error("Unexpected response from the built-in /v1/embeddings endpoint")+ throw new Error("Unexpected response from the LU Engine /v1/embeddings endpoint")}return [...data.data].sort((a: any, b: any) => (a.index ?? 0) - (b.index ?? 0))diff --git a/src/components/onboarding/Onboarding.tsx b/src/components/onboarding/Onboarding.tsxindex be7d2269..8475bba8 100644--- a/src/components/onboarding/Onboarding.tsx+++ b/src/components/onboarding/Onboarding.tsx@@ -527,7 +527,7 @@ export function Onboarding() {if (embedsViaBundled) {try {const destDir = await detectProviderModelPath(BUILTIN_BACKEND_ID)- if (!destDir) throw new Error('Could not resolve the built-in models directory.')+ if (!destDir) throw new Error('Could not resolve the LU Engine models folder.')const { downloadUrl, filename, sizeGB } = ONBOARDING_EMBED_MODELdlStore.getState().setMeta(filename, downloadUrl, 'gguf', destDir)const expectedBytes = sizeGB ? Math.round(sizeGB * 1_073_741_824) : undefineddiff --git a/src/lib/__tests__/no-built-in-engine-left-on-screen.test.ts b/src/lib/__tests__/no-built-in-engine-left-on-screen.test.tsindex a04e8768..37175898 100644--- a/src/lib/__tests__/no-built-in-engine-left-on-screen.test.ts+++ b/src/lib/__tests__/no-built-in-engine-left-on-screen.test.ts@@ -8,8 +8,17 @@** This is the sweep that keeps the next one from slipping through. It reads* every source file the app ships, throws the comments away, and fails on any- * remaining "built-in engine" / "built-in embeddings" in text that can reach a- * user, a log line included.+ * remaining "built-in" in text that can reach a user, a log line included.+ *+ * Second pass, same counter-check: the first version of this sweep only knew+ * "built-in engine" and "built-in embeddings", and the rename it was guarding+ * was not finished. It missed "Create built-in models dir", "already exists in+ * the built-in models folder", "Could not link the model into the built-in+ * folder", "Starting built-in llama-server", "Built-in embeddings server+ * healthy", "the built-in /v1/embeddings endpoint" and "Could not resolve the+ * built-in models directory." Two reasons: the pattern stopped at two nouns,+ * and the Rust side, where half of those live, was never read at all. Both are+ * fixed here.** Deliberately NOT covered:* - `release-notes.ts`. Notes for 2.6.7 and older describe the app as it was@@ -17,9 +26,16 @@* - `lib/engine-name.ts`. It holds the old display name on purpose:* `LEGACY_ENGINE_NAME` is what sits in provider configs written before* 2.6.8, and `isLuEngineName` has to keep recognising it.+ * - The legacy matcher in `commands/download.rs`, for the same reason one+ * step further down: those spellings are what older callers send, so the+ * old name IS the data there.* - Code identifiers (`isBuiltinEngineEntry`, `builtin_*`, `activateBuiltinModel`).* They are not text on a screen and renaming them would be a large diff* with no reader.+ * - Other things that are genuinely built in: ComfyUI's own nodes and VAEs,+ * LU's built-in workflows and personas, the built-in HTTP server behind+ * Remote Access. Those keep the adjective because it is true of them, and+ * the pattern below is deliberately narrow enough to walk past them.** Limit worth knowing: the comment stripper is a regular expression, not a* parser. It can swallow the tail of a string containing `//`, so the sweep can@@ -32,31 +48,54 @@ import { readFileSync, readdirSync, statSync } from 'node:fs'import { resolve, dirname, join, relative } from 'node:path'import { fileURLToPath } from 'node:url'-const SRC = resolve(dirname(fileURLToPath(import.meta.url)), '../..')+const HERE = dirname(fileURLToPath(import.meta.url))+const SRC = resolve(HERE, '../..')+const RUST_SRC = resolve(HERE, '../../../src-tauri/src')-/** The old name, in every spelling that ever shipped. */-const OLD_NAME = /built[-\s]?in\s+(engine|embedding)/i+/**+ * The old name, in every spelling that ever shipped.+ *+ * The noun list is what the second pass added. "built-in" on its own is not+ * the target: plenty of things in this app really are built in and say so+ * honestly. What is banned is the adjective standing where the product name+ * belongs, and these are the words the engine and its folder are named with.+ */+const OLD_NAME = /built[-\s]?in\s+(engine|embedding|model|folder|llama-server|\/v1\/embeddings)/iconst EXEMPT = ['lib/release-notes.ts','lib/engine-name.ts',]-function sourceFiles(dir: string): string[] {+/**+ * Rust lines that are exempt, and the whole reason each one is.+ *+ * A line, not a file: exempting `download.rs` outright would hide every future+ * message in a 1200 line file behind one legacy matcher.+ */+const RUST_EXEMPT_LINES = [+ // The legacy provider-id matcher. These strings arrive from configs and+ // callers written before 2.6.8, so the old spelling is input, not output.+ '"builtin" | "lu engine" | "built-in engine" | "built in engine" =>',+]++function sourceFiles(dir: string, ext: RegExp): string[] {const out: string[] = []for (const entry of readdirSync(dir)) {const full = join(dir, entry)if (statSync(full).isDirectory()) {- if (entry === '__tests__' || entry === 'node_modules') continue- out.push(...sourceFiles(full))- } else if (/\.(ts|tsx)$/.test(entry) && !/\.test\.tsx?$/.test(entry)) {+ if (entry === '__tests__' || entry === 'node_modules' || entry === 'target') continue+ out.push(...sourceFiles(full, ext))+ } else if (ext.test(entry) && !/\.test\.tsx?$/.test(entry)) {out.push(full)}}return out}-/** Everything that is not a comment. See the limit noted at the top. */+/** Everything that is not a comment. See the limit noted at the top. Serves+ * both languages: `//` and `/* *\/` mean the same in Rust, and `///` doc+ * comments fall out with the rest. */function withoutComments(src: string): string[] {return src.replace(/\/\*[\s\S]*?\*\//g, '')@@ -64,10 +103,23 @@ function withoutComments(src: string): string[] {.map((line) => line.replace(/(^|[^:"'`\\])\/\/.*$/, '$1'))}+/**+ * The double-quoted spans of a Rust line.+ *+ * Rust code is full of identifiers built from the same word (`builtin_models_dir`,+ * `is_builtin_generation_url`), and renaming those would be a large diff with+ * no reader, exactly as on the TypeScript side. So only string literals are+ * read here, because a string literal is the only thing in a .rs file that can+ * end up in front of a user or in a log.+ */+function rustStrings(line: string): string {+ return (line.match(/"(?:[^"\\]|\\.)*"/g) ?? []).join(' ')+}+describe('the old engine name is gone from everything a user can read', () => {it('leaves no "built-in engine" or "built-in embeddings" in src/', () => {const left: string[] = []- for (const file of sourceFiles(SRC)) {+ for (const file of sourceFiles(SRC, /\.(ts|tsx)$/)) {const rel = relative(SRC, file).replace(/\\/g, '/')if (EXEMPT.some((e) => rel.endsWith(e))) continuewithoutComments(readFileSync(file, 'utf8')).forEach((line, i) => {@@ -77,6 +129,21 @@ describe('the old engine name is gone from everything a user can read', () => {expect(left, `the old name is still on screen:\n${left.join('\n')}`).toEqual([])})+ it('and none in the Rust messages and log lines either', () => {+ // Where the counter-check's remaining leftovers actually lived. Rust+ // writes the folder errors the Model Storage panel shows and the engine+ // log lines a support answer is read out of, and none of that was swept.+ const left: string[] = []+ for (const file of sourceFiles(RUST_SRC, /\.rs$/)) {+ const rel = relative(RUST_SRC, file).replace(/\\/g, '/')+ withoutComments(readFileSync(file, 'utf8')).forEach((line, i) => {+ if (RUST_EXEMPT_LINES.some((e) => line.includes(e))) return+ if (OLD_NAME.test(rustStrings(line))) left.push(`src-tauri/src/${rel}:${i + 1}: ${line.trim()}`)+ })+ }+ expect(left, `the old name is still in a Rust string:\n${left.join('\n')}`).toEqual([])+ })+// NEGATIVE CONTROL: the sweep has to be able to see the thing it is looking// for. Without this a broken matcher would report a clean house forever.it('really does recognise the old name', () => {@@ -85,21 +152,49 @@ describe('the old engine name is gone from everything a user can read', () => {'the Built-in Engine loads it','moved to the built in engine',"log.warn('[x] built-in engine resume failed')",+ // The seven the second pass added, verbatim from where they stood.+ 'Create built-in models dir: {}',+ 'A model named {} already exists in the built-in models folder',+ 'Could not link the model into the built-in folder ({e}).',+ '[Engine] Starting built-in llama-server on port {port}',+ '[Engine] Built-in embeddings server healthy on port {port}',+ 'Unexpected response from the built-in /v1/embeddings endpoint',+ 'Could not resolve the built-in models directory.',].filter((s) => OLD_NAME.test(s))- expect(seen).toHaveLength(4)- // And it is not simply matching everything: ComfyUI's own built-in nodes- // and LU's built-in workflows are other things with the same adjective.- expect(OLD_NAME.test("ComfyUI's built-in inpaint nodes")).toBe(false)- expect(OLD_NAME.test('Use the built-in workflow')).toBe(false)+ expect(seen).toHaveLength(11)+ // And it is not simply matching everything. These things really are built+ // in and keep the word: ComfyUI's own nodes, LU's workflows and personas,+ // and the HTTP server Remote Access runs on.+ for (const innocent of [+ "ComfyUI's built-in inpaint nodes",+ 'Use the built-in workflow',+ 'the built-in VAE',+ 'built-in HTTP server, secure passcodes, Cloudflare tunnel',+ 'rebuilds built-in personas while migrating',+ ]) {+ expect(OLD_NAME.test(innocent), `swept an innocent: ${innocent}`).toBe(false)+ }+ })++ // NEGATIVE CONTROL: only STRING literals are read on the Rust side, or the+ // sweep would demand a rename of every `builtin_*` function in the crate.+ it('reads Rust strings and not Rust identifiers', () => {+ expect(OLD_NAME.test(rustStrings('pub fn builtin_models_dir() -> Result<PathBuf, String> {'))).toBe(false)+ expect(OLD_NAME.test(rustStrings(' let dir = builtin_models_dir()?;'))).toBe(false)+ expect(OLD_NAME.test(rustStrings(' println!("[Engine] Starting built-in llama-server");'))).toBe(true)})// NEGATIVE CONTROL: the exemptions are exemptions, not a hole big enough to- // hide the whole app in. Both named files must still contain what they are- // exempt for, or the exemption is stale and should go.- it('keeps the two exemptions honest', () => {+ // hide the whole app in. Each must still contain what it is exempt for, or+ // the exemption is stale and should go.+ it('keeps the exemptions honest', () => {const legacy = readFileSync(join(SRC, 'lib/engine-name.ts'), 'utf8')expect(legacy, 'engine-name.ts no longer needs its exemption').toMatch(OLD_NAME)const notes = readFileSync(join(SRC, 'lib/release-notes.ts'), 'utf8')expect(notes, 'release-notes.ts no longer needs its exemption').toMatch(OLD_NAME)+ const download = readFileSync(join(RUST_SRC, 'commands/download.rs'), 'utf8')+ for (const line of RUST_EXEMPT_LINES) {+ expect(download, `download.rs no longer holds the exempt line: ${line}`).toContain(line)+ }})})