fix: skip API key check for local providers and fix /v1 endpoint suffix#5
Open
bluzername wants to merge 1 commit into
Open
fix: skip API key check for local providers and fix /v1 endpoint suffix#5bluzername wants to merge 1 commit into
bluzername wants to merge 1 commit into
Conversation
…to local endpoint Closes MadAppGang#4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two bugs from issue #4 when using mnemex with Ollama or other local embedding providers:
Bug 1:
mnemex indexrequires OpenRouter API key even when using Ollama/local provider. Runningmnemex indexafter configuring Ollama gives:This makes no sense because I configured Ollama as my embedding provider, not OpenRouter.
Bug 2: The
initwizard saveslocalEndpointwithout/v1suffix, but the embeddings client sends requests to{localEndpoint}/embeddingswhich gives 404. The LLM endpoint is correctly set tohttp://localhost:11434/v1by the same wizard - inconsistent behavior.What I changed
Bug 1 fix -
src/config.ts:isLocalEmbeddingProvider(projectPath)function that checks if the project config hasembeddingProviderset toollama,lmstudio, orlocalloadProjectConfig()to read the settingBug 1 fix -
src/cli.ts:isLocalEmbeddingProviderindexcommand (line ~725): added&& !isLocalEmbeddingProvider(projectPath)so local providers skip the checksearchcommand (line ~1509): same fixbenchmarkcommand check unchanged (benchmarks are dev tools that may need cloud APIs regardless)Bug 2 fix -
src/cli.ts:localprovider, the endpoint now gets/v1appended if not already present:embeddingEndpoint.endsWith("/v1") ? embeddingEndpoint : embeddingEndpoint + "/v1"lmstudioendpoint already defaults tohttp://localhost:1234/v1Not addressed
Bug 3 from issue #4 (hardcoded wasm path for global install) - this one needs deeper investigation into the tree-sitter wasm resolution logic which I didnt want to mix into this PR.
Closes #4 (bugs 1 and 2)