Skip to content

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.

fix(chat): actionable LM-Studio runtime hint + remove XP-style scrollbar buttons

purple90d54738a811
diff --git a/src/api/__tests__/provider-openai.test.ts b/src/api/__tests__/provider-openai.test.ts
index eda444fb..8eeded7b 100644
--- a/src/api/__tests__/provider-openai.test.ts
+++ b/src/api/__tests__/provider-openai.test.ts
@@ -89,6 +89,77 @@ describe('OpenAIProvider', () => {
}
vi.restoreAllMocks()
})
+
+ // Sweep #4 Bug (e): LM Studio's "model load failed because no inference
+ // runtime is installed" surfaces as `data.error.message` — without a rewrite
+ // the user just sees the raw API string and has no idea what to do. The
+ // parser detects the signature and replaces it with actionable Plug-and-Play
+ // guidance that points to LM Studio's GUI Runtimes tab. This test pins the
+ // detection (substring match, case-insensitive) and verifies the error
+ // gets the dedicated `lmstudio_runtime_missing` code so callers / UI can
+ // branch on it later if needed.
+ it('rewrites LM Studio "No LM Runtime found" into actionable guidance', async () => {
+ const provider = new OpenAIProvider(makeConfig({ name: 'LM Studio', isLocal: true }))
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(
+ JSON.stringify({
+ error: {
+ message:
+ 'Failed to load model "qwen2.5-0.5b-instruct". Error: No LM Runtime found for model format \'gguf\'!',
+ },
+ }),
+ { status: 400 },
+ ),
+ )
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e).toBeInstanceOf(ProviderError)
+ expect(e.code).toBe('lmstudio_runtime_missing')
+ expect(e.message).toMatch(/runtime/i)
+ expect(e.message).toMatch(/discover|runtimes/i)
+ expect(e.message).toMatch(/llama\.cpp/i)
+ // The raw API phrasing must NOT leak through unmodified.
+ expect(e.message).not.toMatch(/No LM Runtime found/)
+ }
+ vi.restoreAllMocks()
+ })
+
+ it('matches the runtime-missing pattern case-insensitively', async () => {
+ const provider = new OpenAIProvider(makeConfig({ name: 'LM Studio' }))
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(
+ JSON.stringify({ error: { message: 'NO LM RUNTIME FOUND for gguf' } }),
+ { status: 400 },
+ ),
+ )
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).toBe('lmstudio_runtime_missing')
+ }
+ vi.restoreAllMocks()
+ })
+
+ it('does not rewrite unrelated 400 errors', async () => {
+ const provider = new OpenAIProvider(makeConfig({ name: 'LM Studio' }))
+ vi.spyOn(globalThis, 'fetch').mockResolvedValueOnce(
+ new Response(
+ JSON.stringify({ error: { message: 'Bad request: missing model' } }),
+ { status: 400 },
+ ),
+ )
+ try {
+ await provider.listModels()
+ expect.fail('Should have thrown')
+ } catch (e: any) {
+ expect(e.code).not.toBe('lmstudio_runtime_missing')
+ expect(e.message).toBe('Bad request: missing model')
+ }
+ vi.restoreAllMocks()
+ })
})
describe('listModels', () => {
diff --git a/src/api/providers/openai-provider.ts b/src/api/providers/openai-provider.ts
index 3e0baecf..7acfbc5e 100644
--- a/src/api/providers/openai-provider.ts
+++ b/src/api/providers/openai-provider.ts
@@ -396,6 +396,26 @@ export class OpenAIProvider implements ProviderClient {
code = 'not_found'
}
+ // LM Studio: model load fails when there's no inference runtime for the
+ // model's format installed. The raw API error reads "No LM Runtime found
+ // for model format 'gguf'" which doesn't tell a noob what to do —
+ // rewrite it into actionable steps. This commonly happens on Windows
+ // ARM64 where LM Studio doesn't auto-fetch a runtime, and on any fresh
+ // install where the user installed via LU's in-app install_lmstudio.
+ // The runtime catalogue isn't reachable from `lms` CLI (no `runtime`
+ // subcommand), so the only Plug-and-Play step we can offer is a clear
+ // pointer into LM Studio's GUI.
+ if (/no\s+lm\s+runtime\s+found/i.test(message)) {
+ code = 'lmstudio_runtime_missing'
+ message =
+ "LM Studio has no inference runtime installed for GGUF models on this machine.\n\n" +
+ "Open LM Studio → click the 🔍 Discover icon in the left sidebar → " +
+ "switch to the \"Runtimes\" tab → download \"llama.cpp (CPU)\" " +
+ "(plus a GPU runtime if you have one).\n\n" +
+ "Once the runtime is downloaded, come back here and resend your message — " +
+ "no need to restart Locally Uncensored."
+ }
+
return new ProviderError(message, 'openai', code, res.status)
}
}
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index 3fd82f52..f6a9b988 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -190,7 +190,7 @@ export function ChatInput({ onSend, onStop, isGenerating, pendingApproval, onApp
placeholder={disabled ? "Claude Code not installed" : isDragOver ? "Drop images here..." : isTranscribing ? "Transcribing..." : isVoiceRecording ? "Recording..." : "Message..."}
disabled={disabled}
rows={1}
- className="flex-1 bg-transparent resize-none text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-600 focus:outline-none text-[0.75rem] leading-relaxed max-h-[200px] disabled:opacity-50"
+ className="flex-1 bg-transparent resize-none text-gray-800 dark:text-gray-200 placeholder-gray-400 dark:placeholder-gray-600 focus:outline-none text-[0.75rem] leading-relaxed max-h-[200px] disabled:opacity-50 scrollbar-thin"
/>
{/* Think toggle */}
diff --git a/src/index.css b/src/index.css
index 5b28b570..2f7a71e0 100644
--- a/src/index.css
+++ b/src/index.css
@@ -45,6 +45,7 @@ body {
/* Custom scrollbar */
.scrollbar-thin::-webkit-scrollbar {
width: 6px;
+ height: 6px;
}
.scrollbar-thin::-webkit-scrollbar-track {
@@ -61,6 +62,26 @@ body {
border-radius: 3px;
}
+/* Kill the legacy up/down arrow buttons WebView2 paints on custom-styled
+ scrollbars by default — they read as Windows-XP-era chrome and look
+ completely wrong against an otherwise modern dark UI. Affects all
+ .scrollbar-thin containers including the chat textarea. */
+.scrollbar-thin::-webkit-scrollbar-button,
+.scrollbar-thin::-webkit-scrollbar-button:start,
+.scrollbar-thin::-webkit-scrollbar-button:end,
+.scrollbar-thin::-webkit-scrollbar-button:vertical:start,
+.scrollbar-thin::-webkit-scrollbar-button:vertical:end,
+.scrollbar-thin::-webkit-scrollbar-button:horizontal:start,
+.scrollbar-thin::-webkit-scrollbar-button:horizontal:end {
+ display: none;
+ width: 0;
+ height: 0;
+}
+
+.scrollbar-thin::-webkit-scrollbar-corner {
+ background: transparent;
+}
+
/* Range slider */
input[type="range"] {
-webkit-appearance: none;