Files
Jyotisha/frontend/src/components/admin/model-id.ts
T
Jesse_Chen fc47939ba9
Staging Backend Quality Gate / validate (push) Successful in 14m16s
Staging Backend Quality Gate / publish (push) Successful in 1h2m51s
fix(admin): repair model discovery and simplify model setup
2026-08-08 17:29:17 +08:00

9 lines
373 B
TypeScript

export async function createDiscoveredModelId(providerId: string, providerModel: string) {
const digest = await globalThis.crypto.subtle.digest(
"SHA-256",
new TextEncoder().encode(`${providerId}\0${providerModel}`),
);
const hex = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join("");
return `m-${hex.slice(0, 62)}`;
}