Skip to content

Commit eb1d46e

Browse files
committed
feat: add Show Debug Thoughts option for LM Studio provider
- Add lmStudioShowDebugThoughts field to provider settings schema - Implement reasoning output handling in LM Studio provider - Add UI checkbox for enabling/disabling debug thoughts display - Add localization for English and Russian languages - Feature allows users to see model reasoning output when supported
1 parent 87b45de commit eb1d46e

File tree

5 files changed

+26
-0
lines changed

5 files changed

+26
-0
lines changed

packages/types/src/provider-settings.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ const lmStudioSchema = baseProviderSettingsSchema.extend({
276276
lmStudioBaseUrl: z.string().optional(),
277277
lmStudioDraftModelId: z.string().optional(),
278278
lmStudioSpeculativeDecodingEnabled: z.boolean().optional(),
279+
lmStudioShowDebugThoughts: z.boolean().optional(),
279280
})
280281

281282
const geminiSchema = apiModelIdProviderModelSchema.extend({

src/api/providers/lm-studio.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,17 @@ export class LmStudioHandler extends BaseProvider implements SingleCompletionHan
118118
yield processedChunk
119119
}
120120
}
121+
122+
if ("reasoning" in delta && delta.reasoning && typeof delta.reasoning === "string") {
123+
const reasoning = delta.reasoning
124+
assistantText += reasoning
125+
if (this.options.lmStudioShowDebugThoughts === true) {
126+
yield {
127+
type: "reasoning",
128+
text: reasoning,
129+
}
130+
}
131+
}
121132
}
122133

123134
for (const processedChunk of matcher.final()) {

webview-ui/src/components/settings/providers/LMStudio.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ export const LMStudio = ({ apiConfiguration, setApiConfigurationField }: LMStudi
207207
)}
208208
</>
209209
)}
210+
<Checkbox
211+
checked={apiConfiguration?.lmStudioShowDebugThoughts === true}
212+
onChange={(checked) => {
213+
setApiConfigurationField("lmStudioShowDebugThoughts", checked)
214+
}}>
215+
{t("settings:providers.lmStudio.showDebugThoughts")}
216+
</Checkbox>
217+
<div className="text-sm text-vscode-descriptionForeground mb-2">
218+
{t("settings:providers.lmStudio.showDebugThoughtsDesc")}
219+
</div>
210220
<div className="text-sm text-vscode-descriptionForeground">
211221
<Trans
212222
i18nKey="settings:providers.lmStudio.description"

webview-ui/src/i18n/locales/en/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@
372372
"draftModelDesc": "Draft model must be from the same model family for speculative decoding to work correctly.",
373373
"selectDraftModel": "Select Draft Model",
374374
"noModelsFound": "No draft models found. Please ensure LM Studio is running with Server Mode enabled.",
375+
"showDebugThoughts": "Show Debug Thoughts",
376+
"showDebugThoughtsDesc": "Display debug reasoning output from models that support it. Note: this is different from standard <think> tags which are always processed.",
375377
"description": "LM Studio allows you to run models locally on your computer. For instructions on how to get started, see their <a>quickstart guide</a>. You will also need to start LM Studio's <b>local server</b> feature to use it with this extension. <span>Note:</span> Roo Code uses complex prompts and works best with Claude models. Less capable models may not work as expected."
376378
},
377379
"ollama": {

webview-ui/src/i18n/locales/ru/settings.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)