Unit_AI/node_modules/@dqbd/tiktoken/init.js

21 lines
668 B
JavaScript
Raw Normal View History

2024-06-01 21:24:36 +01:00
// @ts-expect-error
import * as imports from "./tiktoken_bg";
let isInitialized = false;
export async function init(callback) {
if (isInitialized)
return imports;
const result = await callback({ "./tiktoken_bg.js": imports });
const instance = "instance" in result && result.instance instanceof WebAssembly.Instance
? result.instance
: result instanceof WebAssembly.Instance
? result
: null;
if (instance == null)
throw new Error("Missing instance");
imports.__wbg_set_wasm(instance.exports);
isInitialized = true;
return imports;
}
// @ts-expect-error
export * from "./tiktoken_bg";