mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
fix(server): skip embedding when not configured (#12544)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved reliability by ensuring certain features are only enabled when required support and configuration are present, reducing the risk of runtime errors. - Enhanced platform detection logic for better accuracy across different environments, including macOS and Windows systems. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -52,9 +52,11 @@ export class CopilotContextDocJob {
|
||||
private async setup() {
|
||||
this.supportEmbedding =
|
||||
await this.models.copilotContext.checkEmbeddingAvailable();
|
||||
this.client = new OpenAIEmbeddingClient(
|
||||
this.config.copilot.providers.openai
|
||||
);
|
||||
if (this.supportEmbedding && this.config.copilot.providers.openai.apiKey) {
|
||||
this.client = new OpenAIEmbeddingClient(
|
||||
this.config.copilot.providers.openai
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// public this client to allow overriding in tests
|
||||
|
||||
Reference in New Issue
Block a user