39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { initNativeHostListener } from './native-host';
|
|
import {
|
|
initSemanticSimilarityListener,
|
|
initializeSemanticEngineIfCached,
|
|
} from './semantic-similarity';
|
|
import { initStorageManagerListener } from './storage-manager';
|
|
import { cleanupModelCache } from '@/utils/semantic-similarity-engine';
|
|
|
|
/**
|
|
* Background script entry point
|
|
* Initializes all background services and listeners
|
|
*/
|
|
export default defineBackground(() => {
|
|
// Initialize core services
|
|
initNativeHostListener();
|
|
initSemanticSimilarityListener();
|
|
initStorageManagerListener();
|
|
|
|
// Conditionally initialize semantic similarity engine if model cache exists
|
|
initializeSemanticEngineIfCached()
|
|
.then((initialized) => {
|
|
if (initialized) {
|
|
console.log('Background: Semantic similarity engine initialized from cache');
|
|
} else {
|
|
console.log(
|
|
'Background: Semantic similarity engine initialization skipped (no cache found)',
|
|
);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.warn('Background: Failed to conditionally initialize semantic engine:', error);
|
|
});
|
|
|
|
// Initial cleanup on startup
|
|
cleanupModelCache().catch((error) => {
|
|
console.warn('Background: Initial cache cleanup failed:', error);
|
|
});
|
|
});
|