Skip to content

Commit 60737eb

Browse files
committed
Add error handling for new performPreparationTasks method
1 parent 028c2da commit 60737eb

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
type TerminalActionPromptType,
2424
type HistoryItem,
2525
type CloudUserInfo,
26-
type MarketplaceItem,
2726
requestyDefaultModelId,
2827
openRouterDefaultModelId,
2928
glamaDefaultModelId,
@@ -41,7 +40,7 @@ import { supportPrompt } from "../../shared/support-prompt"
4140
import { GlobalFileNames } from "../../shared/globalFileNames"
4241
import { ExtensionMessage, MarketplaceInstalledMetadata } from "../../shared/ExtensionMessage"
4342
import { Mode, defaultModeSlug, getModeBySlug } from "../../shared/modes"
44-
import { experimentDefault, experiments, EXPERIMENT_IDS } from "../../shared/experiments"
43+
import { experimentDefault } from "../../shared/experiments"
4544
import { formatLanguage } from "../../shared/language"
4645
import { DEFAULT_WRITE_DELAY_MS } from "@roo-code/types"
4746
import { Terminal } from "../../integrations/terminal/Terminal"
@@ -71,7 +70,6 @@ import { WebviewMessage } from "../../shared/WebviewMessage"
7170
import { EMBEDDING_MODEL_PROFILES } from "../../shared/embeddingModels"
7271
import { ProfileValidator } from "../../shared/ProfileValidator"
7372
import { getWorkspaceGitInfo } from "../../utils/git"
74-
import { LmStudioHandler } from "../../api/providers"
7573
import { forceFullModelDetailsLoad, hasLoadedFullDetails } from "../../api/providers/fetchers/lmstudio"
7674

7775
/**
@@ -186,16 +184,22 @@ export class ClineProvider
186184
async performPreparationTasks(cline: Task) {
187185
// LMStudio: we need to force model loading in order to read its context size; we do it now since we're starting a task with that model selected
188186
if (cline.apiConfiguration && cline.apiConfiguration.apiProvider === "lmstudio") {
189-
if (!hasLoadedFullDetails(cline.apiConfiguration.lmStudioModelId!)) {
190-
forceFullModelDetailsLoad(
191-
cline.apiConfiguration.lmStudioBaseUrl ?? "http://localhost:1234",
192-
cline.apiConfiguration.lmStudioModelId!,
193-
)
194-
}
187+
try {
188+
if (!hasLoadedFullDetails(cline.apiConfiguration.lmStudioModelId!)) {
189+
forceFullModelDetailsLoad(
190+
cline.apiConfiguration.lmStudioBaseUrl ?? "http://localhost:1234",
191+
cline.apiConfiguration.lmStudioModelId!,
192+
)
193+
}
195194
await forceFullModelDetailsLoad(
196195
cline.apiConfiguration.lmStudioBaseUrl ?? "http://localhost:1234",
197196
cline.apiConfiguration.lmStudioModelId!,
198197
)
198+
} catch (error) {
199+
this.log(`Failed to load full model details for LM Studio: ${error}`)
200+
vscode.window.showErrorMessage(error.message)
201+
}
202+
}
199203
}
200204

201205
// Removes and destroys the top Cline instance (the current finished task),

0 commit comments

Comments
 (0)