Closed flatsiedatsie closed 2 days ago
You need to call loadModel
before exit
. Otherwise this.proxy
is null:
https://github.com/ngxson/wllama/blob/d20441c36907938f60491ccd1fefc48186a2fb53/src/wllama.ts#L302
Additionally, we can add a optional chaining (?.) inside exit
function to make sure we don't call proxy if it's null
/**
* Unload the model and free all memory
*/
async exit(): Promise<void> {
await this.proxy?.wllamaExit();
}
Ah, that must be it. Makes total sense. I had to start loading Wllama "empty" from the start because of the new caching system so I could get a list of already cached files from it when the page first loads.
Would you like me to create a PR?
This is a mystery to me. In the code below I check that Wllama exists, and that
exit
is a function on the Wllama object.Yet when I call it, I sometimes get this error: