-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Add OpenAI Compatible embedder for codebase indexing #4066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Add OpenAI Compatible embedder for codebase indexing #4066
Conversation
- Implement OpenAiCompatibleEmbedder with batching and retry logic - Add configuration support for base URL and API key - Update UI with provider selection and input fields - Add comprehensive test coverage - Support for all OpenAI-compatible endpoints (LiteLLM, LMStudio, Ollama, etc.) - Add internationalization for 17 languages
- Fix field count expectations (4 fields including Qdrant) - Use specific test IDs for button selection - Fix input handling with clear() before type() - Use toHaveBeenLastCalledWith for better assertions - Fix status text matching with regex pattern
- Remove unused waitFor import to fix ESLint error - Fix test expectations to match actual component behavior for input fields - Simplify provider selection test by removing complex mock interactions - All CodeIndexSettings tests now pass (20/20)
@@ -40,6 +40,9 @@ | |||
"selectProviderPlaceholder": "选择提供商", | |||
"openaiProvider": "OpenAI", | |||
"ollamaProvider": "Ollama", | |||
"openaiCompatibleProvider": "OpenAI 兼容", | |||
"openaiCompatibleBaseUrlLabel": "基础 URL:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label value for openaiCompatibleBaseUrlLabel
uses a half-width colon (:
) instead of the full-width colon (:
) used in similar labels (e.g. openaiKeyLabel
). Consider changing it for consistency.
"openaiCompatibleBaseUrlLabel": "基础 URL:", | |
"openaiCompatibleBaseUrlLabel": "基础 URL:", |
@@ -40,6 +40,9 @@ | |||
"selectProviderPlaceholder": "选择提供商", | |||
"openaiProvider": "OpenAI", | |||
"ollamaProvider": "Ollama", | |||
"openaiCompatibleProvider": "OpenAI 兼容", | |||
"openaiCompatibleBaseUrlLabel": "基础 URL:", | |||
"openaiCompatibleApiKeyLabel": "API 密钥:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The label value for openaiCompatibleApiKeyLabel
uses a half-width colon (:
) rather than the full-width colon (:
) seen in other labels like openaiKeyLabel
and ollamaUrlLabel
. Please update for consistency.
"openaiCompatibleApiKeyLabel": "API 密钥:", | |
"openaiCompatibleApiKeyLabel": "API 密钥:", |
Related GitHub Issue
Closes: #4065
Description
This PR implements OpenAI Compatible embedder support for codebase indexing, enabling users to connect to any OpenAI-compatible API endpoint (LiteLLM, LMStudio, Ollama, etc.) for generating embeddings.
Key implementation details:
OpenAiCompatibleEmbedder
with intelligent batching and retry logicDesign choices:
Test Procedure
Automated Testing:
pnpm test
- All 20+ new unit tests passpnpm lint
- No linting errorspnpm check-types
- All TypeScript types validManual Testing:
Type of Change
Pre-Submission Checklist
npm run lint
).console.log
) has been removed.npm test
).main
branch.npm run changeset
if this PR includes user-facing changes or dependency updates.Documentation Updates
Additional Notes
This implementation supports all major OpenAI-compatible providers including:
The feature is fully backward compatible and doesn't affect existing embedder configurations.
Important
Adds support for OpenAI-compatible embedders in codebase indexing with new embedder class, configuration, UI integration, and comprehensive testing.
OpenAiCompatibleEmbedder
class for OpenAI-compatible API endpoints with batching and retry logic.codebase-index.ts
to includeopenai-compatible
as an embedder provider.CodeIndexSettings.tsx
to support dynamic provider selection.config-manager.ts
.provider-settings.ts
andglobal-settings.ts
for new configuration keys.openai-compatible.test.ts
andconfig-manager.test.ts
.service-factory.test.ts
.OpenAiCompatibleEmbedder
toservice-factory.ts
for embedder creation.embeddingModels.ts
to includeopenai-compatible
models.This description was created by
for 9755fd7. You can customize this summary. It will automatically update as commits are pushed.