**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
04a33b9ae8
commit
5f267b14ed
30 changed files with 1799 additions and 1583 deletions
|
|
@ -10,12 +10,8 @@ import type {
|
|||
PlatformNodeObject
|
||||
} from '../types/tensorflowTypes.js'
|
||||
|
||||
// Import the unified text encoding utilities
|
||||
import { applyTensorFlowPatch } from './textEncoding.js'
|
||||
|
||||
// Apply the TensorFlow.js platform patch if needed
|
||||
// This will define a global PlatformNode class that uses our text encoding utilities
|
||||
applyTensorFlowPatch()
|
||||
// Note: TensorFlow.js platform patch is applied in setup.ts
|
||||
// This ensures the global PlatformNode class uses our text encoding utilities
|
||||
|
||||
/**
|
||||
* Check if an array is a Float32Array
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue