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(settings): der Engine-Port steht jetzt in der Oberflaeche
purple6e2c3d72b903
diff --git a/src/components/settings/BuiltinEngineSettings.tsx b/src/components/settings/BuiltinEngineSettings.tsxindex 9cbb1b49..31217317 100644--- a/src/components/settings/BuiltinEngineSettings.tsx+++ b/src/components/settings/BuiltinEngineSettings.tsx@@ -8,7 +8,8 @@import { useEffect, useState } from 'react'import { Loader2, AlertTriangle, Check, Zap } from 'lucide-react'import { useSettingsStore } from '../../stores/settingsStore'-import { bundledEngineStatus, swapBundledModel, type EngineStatus } from '../../api/engine'+import { bundledEngineStatus, swapBundledModel, ENGINE_PORT, type EngineStatus } from '../../api/engine'+import { enginePortLine } from '../../lib/engine-port'import { isTauri } from '../../api/backend'import type { BuiltinEngineTuning } from '../../types/settings'@@ -95,9 +96,15 @@ export function BuiltinEngineSettings() {{typeof status?.ctx === 'number' ? <> · ctx {status.ctx.toLocaleString()}</> : null}</>) : (- 'Engine not running — settings apply automatically on the next start.'+ 'Engine not running, settings apply automatically on the next start.')}</div>+ {/* A13: which port the engine really holds. It starts its walk at 8127+ and takes the next free one when that is held, and until now the only+ place that said so was the log. */}+ <div className="text-[0.6rem] text-gray-500" data-testid="builtin-engine-port">+ {enginePortLine(status, ENGINE_PORT)}+ </div>{/* Context length */}<div className="flex items-center justify-between">diff --git a/src/components/settings/ProviderConfig.tsx b/src/components/settings/ProviderConfig.tsxindex f7a40462..c01a1ff0 100644--- a/src/components/settings/ProviderConfig.tsx+++ b/src/components/settings/ProviderConfig.tsx@@ -68,12 +68,19 @@ export function providerSlotView(id: ProviderId, config: ProviderConfig): SlotVi: PROVIDER_PRESETS.find(p => p.providerId === 'openai' && (p.name === config.name || p.baseUrl === config.baseUrl)) ||PROVIDER_PRESETS.find(p => p.id === 'custom-openai')!if (config.managed) {+ // A13, Windows counter-check 2026-09-02: "nothing to configure" was true+ // and useless. The engine starts its walk at 8127 and moves to the next+ // free port when that one is held, and this row is where the address of a+ // backend belongs. It is the live slot URL, which api/engine keeps on the+ // port the engine really holds.return {label: preset.name || config.name,presetId: preset.id,endpointEditable: false,needsKey: false,- note: 'Built-in engine, runs locally, nothing to configure.',+ note: config.baseUrl+ ? `Built-in engine, runs locally on ${config.baseUrl}, nothing to configure.`+ : 'Built-in engine, runs locally, nothing to configure.',}}return {diff --git a/src/components/settings/__tests__/engine-port-is-visible.test.ts b/src/components/settings/__tests__/engine-port-is-visible.test.tsnew file mode 100644index 00000000..1e8984b4--- /dev/null+++ b/src/components/settings/__tests__/engine-port-is-visible.test.ts@@ -0,0 +1,103 @@+/**+ * @vitest-environment jsdom+ *+ * A13, Windows counter-check 2026-09-02, point 4: "DURCHGEFALLEN ist nur der+ * Teilpunkt Settings zeigt den Port: weder Providers noch Built-in Engine+ * (expert) noch Troubleshoot nennen 8127 oder 8129".+ *+ * The counter-check held 8127 with its own listener, pressed Use, and the+ * engine came up on 8129. The log said so. The app said nothing anywhere, so a+ * refused connection on 8127 had no explanation on screen.+ *+ * Run: npx vitest run src/components/settings/__tests__/engine-port-is-visible.test.ts+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, cleanup, act } from '@testing-library/react'++const bundledEngineStatus = vi.fn()+vi.mock('../../../api/engine', async () => {+ const actual = await vi.importActual<typeof import('../../../api/engine')>('../../../api/engine')+ return {+ ...actual,+ bundledEngineStatus: () => bundledEngineStatus(),+ swapBundledModel: vi.fn(),+ }+})+vi.mock('../../../api/backend', () => ({+ backendCall: vi.fn(async () => ({})),+ isTauri: () => true,+ isMacOS: () => false,+ openExternal: vi.fn(),+ secretGet: vi.fn().mockRejectedValue(new Error('no keychain here')),+ secretSet: vi.fn(),+ secretDelete: vi.fn(),+}))++const { enginePortLine } = await import('../../../lib/engine-port')+const { BuiltinEngineSettings } = await import('../BuiltinEngineSettings')+const { providerSlotView } = await import('../ProviderConfig')++beforeEach(() => { bundledEngineStatus.mockReset() })+afterEach(cleanup)++async function panel(status: unknown) {+ bundledEngineStatus.mockResolvedValue(status)+ render(createElement(BuiltinEngineSettings))+ await act(async () => { await Promise.resolve(); await Promise.resolve() })+ return screen.getByTestId('builtin-engine-port').textContent ?? ''+}++describe('the line itself', () => {+ it('names the port when the engine sits where it wanted to', () => {+ expect(enginePortLine({ running: true, port: 8127 }, 8127)).toBe('Port: 8127')+ })++ it('names the port AND why it is not the usual one', () => {+ expect(enginePortLine({ running: true, port: 8129 }, 8127)).toBe('Port: 8129 (8127 was taken)')+ })++ it('promises no port for an engine that is not up', () => {+ expect(enginePortLine({ running: false, port: 8127 }, 8127)).toBe('Engine not running')+ expect(enginePortLine(null, 8127)).toBe('Engine not running')+ })++ it('says nothing rather than something wrong when the port is nonsense', () => {+ expect(enginePortLine({ running: true, port: 0 }, 8127)).toBe('Engine not running')+ expect(enginePortLine({ running: true, port: '8127' }, 8127)).toBe('Engine not running')+ })+})++describe('Built-in Engine (expert) shows it', () => {+ it('shows the fallback port and the reason for it', async () => {+ expect(await panel({ running: true, healthy: true, port: 8129, model_path: 'C:\\m\\phi.gguf', ctx: 8192 }))+ .toBe('Port: 8129 (8127 was taken)')+ })++ it('shows the plain port on a free 8127', async () => {+ expect(await panel({ running: true, healthy: true, port: 8127, model_path: 'C:\\m\\phi.gguf', ctx: 8192 }))+ .toBe('Port: 8127')+ })++ it('says the engine is down instead of naming a port nobody listens on', async () => {+ expect(await panel({ running: false, healthy: false, port: 8127, model_path: null }))+ .toBe('Engine not running')+ })+})++describe('the Providers row for the built-in engine', () => {+ const slot = (baseUrl: string) => providerSlotView('openai', {+ id: 'openai', name: 'Built-in Engine', enabled: true,+ baseUrl, apiKey: '', isLocal: true, managed: true,+ })++ it('carries the address the engine really answers on', () => {+ expect(slot('http://127.0.0.1:8129/v1').note).toContain('http://127.0.0.1:8129/v1')+ expect(slot('http://127.0.0.1:8127/v1').note).toContain('http://127.0.0.1:8127/v1')+ })++ it('still says there is nothing to configure', () => {+ expect(slot('http://127.0.0.1:8127/v1').note).toContain('nothing to configure')+ expect(slot('http://127.0.0.1:8127/v1').endpointEditable).toBe(false)+ })+})diff --git a/src/lib/engine-port.ts b/src/lib/engine-port.tsindex 4db05f77..87c3137a 100644--- a/src/lib/engine-port.ts+++ b/src/lib/engine-port.ts@@ -71,3 +71,26 @@ export function baseUrlNeedingEnginePort(baseUrl: string, port: unknown): stringconst next = withEnginePort(baseUrl, port)return next === baseUrl ? null : next}++/**+ * The one line Settings shows about where the engine is listening.+ *+ * A13, Windows counter-check 2026-09-02: the engine walked from 8127 to 8129+ * because a leftover listener held 8127, the log said so, and no surface in+ * the app did. Providers said "nothing to configure", the expert panel named+ * the model and the context size, Troubleshoot named neither port. Anyone+ * pointing another tool at the engine, or reading a refused connection on+ * 8127, had nothing to go on.+ *+ * `preferred` is the port the engine starts its walk at (`ENGINE_PORT`, the+ * mirror of Rust's `DEFAULT_ENGINE_PORT`). It is passed in rather than+ * imported so this module stays free of the API layer that imports it.+ */+export function enginePortLine(+ status: { running?: boolean; port?: unknown } | null | undefined,+ preferred: number,+): string {+ if (!status?.running || !isPort(status.port)) return 'Engine not running'+ if (status.port === preferred) return `Port: ${status.port}`+ return `Port: ${status.port} (${preferred} was taken)`+}