Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/providers/fetchers/__tests__/lmstudio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe("LMStudio Fetcher", () => {
expect(mockListLoaded).toHaveBeenCalledTimes(1)

const expectedParsedModel = parseLMStudioModel(mockRawModel)
expect(result).toEqual({ [mockRawModel.modelKey]: expectedParsedModel })
expect(result).toEqual({ [mockRawModel.path]: expectedParsedModel })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test correctly updated to expect the path as the key instead of modelKey. Good to see the test coverage maintained.

})

it("should use default baseUrl if an empty string is provided", async () => {
Expand Down
5 changes: 3 additions & 2 deletions src/api/providers/fetchers/lmstudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ export async function getLMStudioModels(baseUrl = "http://localhost:1234"): Prom
})) as Array<LLMInstanceInfo>

for (const lmstudioModel of loadedModels) {
models[lmstudioModel.modelKey] = parseLMStudioModel(lmstudioModel)
modelsWithLoadedDetails.add(lmstudioModel.modelKey)
// Use path as the key to avoid duplicates when a model is both downloaded and loaded
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix! The comment clearly explains why we're using path as the key. This should resolve the duplicate model issue reported in #6954.

models[lmstudioModel.path] = parseLMStudioModel(lmstudioModel)
modelsWithLoadedDetails.add(lmstudioModel.path)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice consistency - updating the Set to track paths instead of modelKeys aligns with the new keying strategy.

}
} catch (error) {
if (error.code === "ECONNREFUSED") {
Expand Down
Loading