Makelore 2.0 initial clean snapshot

This commit is contained in:
inman
2026-07-29 17:22:35 +08:00
commit b8ca3f8eea
694 changed files with 139782 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
export const NIANCODE_USER_MODEL_ACCOUNT_ID = 'niancode-user-models';
export const NIANCODE_USER_MODEL_ACCOUNT_LABEL = 'Makelore Models';
const WORKS_SQUARE_MODEL_ROUTING_PREFIXES_TO_STRIP = new Set([
'deepseek',
]);
export interface NianCodeUserModelAccountLike {
id: string;
}
export function normalizeImportedUserModelId(rawModel: string): string {
const trimmed = rawModel.trim();
const slashIndex = trimmed.indexOf('/');
if (slashIndex <= 0 || slashIndex >= trimmed.length - 1) {
return trimmed;
}
const prefix = trimmed.slice(0, slashIndex).toLowerCase();
const modelId = trimmed.slice(slashIndex + 1).trim();
return WORKS_SQUARE_MODEL_ROUTING_PREFIXES_TO_STRIP.has(prefix) && modelId
? modelId
: trimmed;
}
export function selectUserModelRuntimeAccounts<T extends NianCodeUserModelAccountLike>(
accounts: T[],
): T[] {
const importedUserModelAccount = accounts.find((account) => (
account.id === NIANCODE_USER_MODEL_ACCOUNT_ID
));
return importedUserModelAccount ? [importedUserModelAccount] : accounts;
}