feat(demo, docs): introduce threading test demos for browser and fallback, enhance threading documentation
- Added `test-browser-worker.html` to demonstrate threading with Web Workers in browser environments. - Added `test-fallback.html` to verify fallback functionality when threading is unavailable. - Created `THREADING.md` to document unified threading implementation, including Node.js Worker Threads, Web Workers, and fallback mechanisms. - Updated Node.js version requirement in `README.md` and `package.json` to `>=24.0.0` for compatibility with improved Worker Threads API. - Enhanced `workerUtils.ts` to implement threading with a worker pool for Node.js and added Web Worker execution logic for browsers. - Enabled environment-aware threading availability in `environment.ts`. - Updated `rollup.config.js` to include CLI configurations for streamlined builds. - Adjusted `.gitignore` to exclude test artifacts and package files. These changes provide comprehensive testing and documentation of threading functionality, improve cross-environment compatibility, and enhance developer workflows.
This commit is contained in:
parent
1eb2993848
commit
d36711809e
10 changed files with 664 additions and 21 deletions
12
src/index.ts
12
src/index.ts
|
|
@ -33,12 +33,22 @@ import {
|
|||
defaultEmbeddingFunction
|
||||
} from './utils/embedding.js'
|
||||
|
||||
// Export worker utilities
|
||||
import {
|
||||
executeInThread,
|
||||
cleanupWorkerPools
|
||||
} from './utils/workerUtils.js'
|
||||
|
||||
export {
|
||||
UniversalSentenceEncoder,
|
||||
createEmbeddingFunction,
|
||||
createTensorFlowEmbeddingFunction,
|
||||
createThreadedEmbeddingFunction,
|
||||
defaultEmbeddingFunction
|
||||
defaultEmbeddingFunction,
|
||||
|
||||
// Worker utilities
|
||||
executeInThread,
|
||||
cleanupWorkerPools
|
||||
}
|
||||
|
||||
// Export storage adapters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue