mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
feat(llm): also add functions to clear/unregister embedding providers
This commit is contained in:
@@ -845,17 +845,21 @@ export class IndexService {
|
||||
try {
|
||||
log.info("Starting embedding generation system");
|
||||
|
||||
// Re-initialize if needed
|
||||
if (!this.initialized) {
|
||||
await this.initialize();
|
||||
}
|
||||
|
||||
const aiEnabled = options.getOptionOrNull('aiEnabled') === "true";
|
||||
if (!aiEnabled) {
|
||||
log.error("Cannot start embedding generation - AI features are disabled");
|
||||
throw new Error("AI features must be enabled first");
|
||||
}
|
||||
|
||||
// Re-initialize providers first in case they weren't available when server started
|
||||
log.info("Re-initializing embedding providers");
|
||||
await providerManager.initializeDefaultProviders();
|
||||
|
||||
// Re-initialize if needed
|
||||
if (!this.initialized) {
|
||||
await this.initialize();
|
||||
}
|
||||
|
||||
// Check if this instance should process embeddings
|
||||
const embeddingLocation = await options.getOption('embeddingGenerationLocation') || 'client';
|
||||
const isSyncServer = await this.isSyncServerForEmbeddings();
|
||||
@@ -902,6 +906,9 @@ export class IndexService {
|
||||
// Stop the background processing from embeddings/events.ts
|
||||
vectorStore.stopEmbeddingBackgroundProcessing();
|
||||
|
||||
// Clear all embedding providers to clean up resources
|
||||
providerManager.clearAllEmbeddingProviders();
|
||||
|
||||
// Mark as not indexing
|
||||
this.indexingInProgress = false;
|
||||
this.indexRebuildInProgress = false;
|
||||
|
||||
Reference in New Issue
Block a user