[1.8] refactor(embeddings): type extractor with FeatureExtractionPipeline - #207
Merged
Conversation
h4yfans
added a commit
that referenced
this pull request
May 6, 2026
[1.8] refactor(embeddings): type extractor with FeatureExtractionPipeline
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.
Summary
Replaces the
let extractor: any = nullescape hatch inapps/desktop/src/main/lib/embeddings.tswith the realFeatureExtractionPipelinetype imported from@huggingface/transformers, removing the file's onlyeslint-disable @typescript-eslint/no-explicit-anydirective.pipeline('feature-extraction', ...)returns a large discriminated union that TypeScript reports as "too complex to represent". The return is routed throughunknown(notany) and cast once to the concrete pipeline type — keeping the module-levelextractorstrongly typed at every call site.Before / After
And inside
initEmbeddingModel():generateEmbedding()now calls a locally-typedextractorInstance(same narrowed reference) rather than re-reading the module variable after theinitEmbeddingModel()call.Verification
pnpm --filter @memry/desktop typecheck:node 2>&1 | grep "embeddings.ts" | wc -l= 0rg ": any|as any" apps/desktop/src/main/lib/embeddings.ts= no matchespnpm --filter @memry/desktop typecheck:web= passpnpm typecheck:packages= pass (10/10 cached)pnpm exec eslint --cache src/main/lib/embeddings.ts= 0 errors, 0 warningspnpm test= 2 failures, both pre-existing and unrelated:calendar-page.test.tsx:258"Due draft" (known flake, ignored per unit instructions)notes-tree.test.tsxT523 — reproduces on cleanmainwithout this change (@/components/kibo-ui/treealias resolution issue in local env)Test plan
typecheck:nodeclean for touched filetypecheck:webcleantypecheck:packagescleananyremaining inembeddings.ts