mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:49:26 +08:00
Native LightRAG role models: extraction, keyword, query and vision each resolve their own model, vision indexing pins a vision-capable model instead of silently degrading, and a knowledge base records which models and which embedding built it. A published index refuses queries after its embedding identity changes rather than searching a foreign vector space, and a rebuild is confirmed against the configuration it will actually use — a stale confirmation is rejected instead of quietly rebuilding something else. A failed publication is withdrawn, not left half-written. PDF attachments follow the parsing engine configured for the workspace, report the stage they are in, and a truncated answer says it was truncated with the counters that prove it. Providers are no longer filtered out of the embedding picker on an unverifiable capability guess: configure the model and test it. Visualize's temperature and token budget are settings rather than literals. Notebook evidence no longer depends on the chat session that produced it. See assets/releases/ver1-6-10.md for the full notes, and the README translations for the propagated prose.
41 lines
1.7 KiB
TypeScript
41 lines
1.7 KiB
TypeScript
/**
|
|
* A v4 UUID minted in the browser, on any origin.
|
|
*
|
|
* ``crypto.randomUUID`` is defined only in a secure context, so a deployment
|
|
* reached over plain HTTP — a LAN box, a VPS without TLS — has none, and every
|
|
* caller that reached for it *threw*. On the provider settings page that
|
|
* exception landed inside the "Continue" click handler, before the connection
|
|
* was staged: the button appeared dead, with nothing on screen to explain it.
|
|
*
|
|
* ``crypto.getRandomValues`` carries no such gate, which is why it is the
|
|
* fallback rather than ``Math.random``: same shape, still unguessable. The
|
|
* ``Math.random`` tail is only for a runtime with no Web Crypto at all.
|
|
*
|
|
* ``contracts/parse/turn-command.ts`` states the same decision a second time
|
|
* for ``command_id``, and has to: the architecture keeps ``contracts/`` a leaf
|
|
* (``contracts-are-leaves`` in ``.dependency-cruiser.cjs``), so it cannot
|
|
* import this. Everything outside that layer mints ids here.
|
|
*/
|
|
export function randomUuid(): string {
|
|
const webCrypto = globalThis.crypto;
|
|
if (typeof webCrypto?.randomUUID === "function") return webCrypto.randomUUID();
|
|
const bytes = new Uint8Array(16);
|
|
if (typeof webCrypto?.getRandomValues === "function") {
|
|
webCrypto.getRandomValues(bytes);
|
|
} else {
|
|
for (let i = 0; i < bytes.length; i += 1) {
|
|
bytes[i] = Math.floor(Math.random() * 256);
|
|
}
|
|
}
|
|
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0"));
|
|
return [
|
|
hex.slice(0, 4).join(""),
|
|
hex.slice(4, 6).join(""),
|
|
hex.slice(6, 8).join(""),
|
|
hex.slice(8, 10).join(""),
|
|
hex.slice(10, 16).join(""),
|
|
].join("-");
|
|
}
|