Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address copilot review (round 5): drop dead modelsError, return on-disk id

Adam Eivy926f478f0745
diff --git a/server/services/lmStudioManager.js b/server/services/lmStudioManager.js
index 72cca1a481..44c3f05a14 100644
--- a/server/services/lmStudioManager.js
+++ b/server/services/lmStudioManager.js
@@ -506,6 +506,9 @@ async function importModelFromGguf({ lmstudioId, ggufPath, projectorPath }) {
const modelsDir = await getModelsDir()
const { publisher, repo } = lmStudioPublisherRepo(lmstudioId)
const destDir = join(modelsDir, publisher, repo)
+ // Report the actual on-disk id (sanitized) rather than the raw input, so
+ // migrate results / follow-up ops match where the file really landed.
+ const resolvedId = `${publisher}/${repo}`
const r = await mkdir(destDir, { recursive: true })
.then(async () => {
const base = basename(ggufPath)
@@ -518,10 +521,10 @@ async function importModelFromGguf({ lmstudioId, ggufPath, projectorPath }) {
})
.then(() => ({ ok: true }))
.catch((err) => ({ _err: err.message }))
- if (r._err) return { success: false, error: r._err, modelId: lmstudioId }
+ if (r._err) return { success: false, error: r._err, modelId: resolvedId }
resetCache()
- console.log(`📦 LM Studio import (local): ${lmstudioId} ← ${ggufPath}`)
- return { success: true, modelId: lmstudioId }
+ console.log(`📦 LM Studio import (local): ${resolvedId} ← ${ggufPath}`)
+ return { success: true, modelId: resolvedId }
}
export {
diff --git a/server/services/localLlm.js b/server/services/localLlm.js
index 0cb0ecedc3..ca2d362b45 100644
--- a/server/services/localLlm.js
+++ b/server/services/localLlm.js
@@ -245,10 +245,10 @@ export async function getStatus() {
commandExists('ollama', ['--version']),
lmStudioManager.getStatus(),
commandExists('lms', ['version']),
- // forceRefresh: this is the status/refresh path, so bypass the list cache.
- // already normalized; capture (don't swallow) a list failure so the UI can
- // distinguish "no models" from "couldn't read the model list".
- listModels('lmstudio', true).then((models) => ({ models, error: null })).catch((err) => ({ models: [], error: err.message }))
+ // forceRefresh: status/refresh path bypasses the list cache. "Couldn't
+ // reach LM Studio" is carried by the `available` field below (the model
+ // list is [] in that case), so we don't double-report it here.
+ listModels('lmstudio', true).catch(() => [])
])
return {
@@ -269,9 +269,8 @@ export async function getStatus() {
available: lmStudioStatus.available,
hasCli: lmsCli,
baseUrl: lmStudioStatus.baseUrl,
- modelCount: lmStudioModels.models.length,
- models: lmStudioModels.models,
- modelsError: lmStudioModels.error,
+ modelCount: lmStudioModels.length,
+ models: lmStudioModels,
canAutoInstall: canAutoInstall('lmstudio'),
downloadUrl: DOWNLOAD_URL.lmstudio
}