threads.js
threads.js copied to clipboard
Promised Observable
Kia Ora,
We're trying to run an async function that returns an observable, because of the structure of the resultType the library tries to serialize our Observable function leading to a DataCloneError.
Would a promised-observable resultType cause confusion? Happy to put the time in for a PR.
Try iife, like what we do in useEffect
function runLLama(
options: { conversationID: string; modelPath: string; openDebugger?: boolean; prompt: string },
): Observable<ILanguageModelWorkerResponse> {
return new Observable<ILanguageModelWorkerResponse>((subscriber) => {
void (async function runLLamaObservableIIFE() {
await xxx
})();
});
}