Skip to content

Commit 21c34f1

Browse files
committed
fix: prevent duplicate LM Studio models in provider configuration
- Use consistent model.path as key for both downloaded and loaded models - Fixes issue where models appeared twice with different identifiers - Update tests to reflect the new consistent key usage Fixes #6954
1 parent b30372d commit 21c34f1

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/api/providers/fetchers/__tests__/lmstudio.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ describe("LMStudio Fetcher", () => {
140140
expect(mockListLoaded).toHaveBeenCalledTimes(1)
141141

142142
const expectedParsedModel = parseLMStudioModel(mockRawModel)
143-
expect(result).toEqual({ [mockRawModel.modelKey]: expectedParsedModel })
143+
expect(result).toEqual({ [mockRawModel.path]: expectedParsedModel })
144144
})
145145

146146
it("should use default baseUrl if an empty string is provided", async () => {

src/api/providers/fetchers/lmstudio.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ export async function getLMStudioModels(baseUrl = "http://localhost:1234"): Prom
8787
})) as Array<LLMInstanceInfo>
8888

8989
for (const lmstudioModel of loadedModels) {
90-
models[lmstudioModel.modelKey] = parseLMStudioModel(lmstudioModel)
91-
modelsWithLoadedDetails.add(lmstudioModel.modelKey)
90+
// Use path as the key to avoid duplicates when a model is both downloaded and loaded
91+
models[lmstudioModel.path] = parseLMStudioModel(lmstudioModel)
92+
modelsWithLoadedDetails.add(lmstudioModel.path)
9293
}
9394
} catch (error) {
9495
if (error.code === "ECONNREFUSED") {

0 commit comments

Comments
 (0)