**feat(tests): add tests for TextEncoder, TensorFlow.js, and fallback mechanisms**
- Introduced `test-fallback-function.js` and `test-fallback-simple.js` to validate `executeInThread` fallback functionality with both named and anonymous compute-intensive functions. - Added `test-tensorflow-textencoder.js` for TensorFlow.js and TextEncoder tests in a Node.js environment. - Created `test-tensorflow-textencoder.html` for browser-based TensorFlow.js and TextEncoder tests. - Implemented cross-environment test support in `cli-package/src/test-tensorflow-textencoder.ts` for CLI functionality. - Enhanced `src/utils/embedding.ts`, `textEncoding.ts`, and `brainy-wrapper.js` to include updated global `TextEncoder` and `TextDecoder` utilities for compatibility and worker improvements. - Standardized and expanded utility methods in `PlatformNode` for broader support, including `isFloat32Array` and `isTypedArray` checks. - Updated Node.js requirement to `>= 24.4.0` across documentation and configuration files for compatibility improvements. This update introduces comprehensive testing for fallback mechanisms, TensorFlow.js, and TextEncoder across multiple environments, ensuring robustness and compatibility.
This commit is contained in:
parent
00039f836f
commit
f0db5b471f
30 changed files with 1799 additions and 1583 deletions
17
src/index.ts
17
src/index.ts
|
|
@ -1,12 +1,12 @@
|
|||
/**
|
||||
* OPFS BrainyData
|
||||
* A vector database using HNSW indexing with Origin Private File System storage
|
||||
* Brainy
|
||||
* A vector and graph database using HNSW
|
||||
*/
|
||||
|
||||
// Import unified text encoding utilities first to ensure they're available
|
||||
import { applyTensorFlowPatch } from './utils/textEncoding.js'
|
||||
// Apply the TensorFlow.js platform patch if needed
|
||||
applyTensorFlowPatch()
|
||||
// Import the setup file for its side-effects.
|
||||
// This MUST be the very first import to ensure patches are applied
|
||||
// before any other module (like TensorFlow.js) is loaded.
|
||||
import './setup.js'
|
||||
|
||||
// Export main BrainyData class and related types
|
||||
import { BrainyData, BrainyDataConfig } from './brainyData.js'
|
||||
|
|
@ -39,10 +39,7 @@ import {
|
|||
} from './utils/embedding.js'
|
||||
|
||||
// Export worker utilities
|
||||
import {
|
||||
executeInThread,
|
||||
cleanupWorkerPools
|
||||
} from './utils/workerUtils.js'
|
||||
import { executeInThread, cleanupWorkerPools } from './utils/workerUtils.js'
|
||||
|
||||
// Export environment utilities
|
||||
import {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue