Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

perf(llamacpp): defer backend dep verification to browser idle

Akarshan Biswas189a011c6647
diff --git a/extensions/llamacpp-extension/src/index.ts b/extensions/llamacpp-extension/src/index.ts
index af0a8ca52..678ffce7f 100644
--- a/extensions/llamacpp-extension/src/index.ts
+++ b/extensions/llamacpp-extension/src/index.ts
@@ -1193,7 +1193,12 @@ export default class llamacpp_extension extends AIEngine {
// "b4589/linux-cuda-12"). Any other shape silently skips verification.
const [version, backend] = effectiveBackendString.split('/')
if (version && backend) {
- await this.verifyBackendDeps(backend, version)
+ // Advisory and fail-soft — defer to browser idle so it yields to the
+ // router (already up by now) and the UI instead of running inline.
+ const verify = () => void this.verifyBackendDeps(backend, version)
+ const ric = window.requestIdleCallback
+ if (ric) ric(verify, { timeout: 3000 })
+ else setTimeout(verify, 0)
}
}
} finally {