chore(8.0): final pre-RC1 sweep — API consistency, named errors, orphans, zero-cast codebase
This commit is contained in:
parent
970e08c466
commit
1f7e365a4e
237 changed files with 1951 additions and 49413 deletions
|
|
@ -15,6 +15,17 @@
|
|||
import { Vector, EmbeddingFunction } from '../coreTypes.js'
|
||||
import { WASMEmbeddingEngine } from './wasm/index.js'
|
||||
|
||||
declare global {
|
||||
/**
|
||||
* Unit-test escape hatch set by the test harness (tests/setup-unit.ts):
|
||||
* when truthy, EmbeddingManager serves deterministic mock embeddings
|
||||
* instead of loading the real model. Guarded against production use in
|
||||
* init()/embed()/embedBatch(). Ambient `var` is required here — `let`/
|
||||
* `const` in `declare global` do not attach to `globalThis`.
|
||||
*/
|
||||
var __BRAINY_UNIT_TEST__: boolean | undefined
|
||||
}
|
||||
|
||||
// Types
|
||||
export type ModelPrecision = 'q8' | 'fp32'
|
||||
|
||||
|
|
@ -68,7 +79,7 @@ export class EmbeddingManager {
|
|||
// In unit test mode, skip real model initialization
|
||||
const isTestMode =
|
||||
process.env.BRAINY_UNIT_TEST === 'true' ||
|
||||
(globalThis as any).__BRAINY_UNIT_TEST__
|
||||
globalThis.__BRAINY_UNIT_TEST__
|
||||
|
||||
if (isTestMode) {
|
||||
// Production safeguard
|
||||
|
|
@ -142,7 +153,7 @@ export class EmbeddingManager {
|
|||
// Check for unit test environment
|
||||
const isTestMode =
|
||||
process.env.BRAINY_UNIT_TEST === 'true' ||
|
||||
(globalThis as any).__BRAINY_UNIT_TEST__
|
||||
globalThis.__BRAINY_UNIT_TEST__
|
||||
|
||||
if (isTestMode) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
|
|
@ -224,7 +235,7 @@ export class EmbeddingManager {
|
|||
|
||||
const isTestMode =
|
||||
process.env.BRAINY_UNIT_TEST === 'true' ||
|
||||
(globalThis as any).__BRAINY_UNIT_TEST__
|
||||
globalThis.__BRAINY_UNIT_TEST__
|
||||
|
||||
if (isTestMode) {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue