Lumbridge Bench
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Normalize a public Hugging Face reference before it becomes an inert
|
||||
* Lumbridge model-suggestion record.
|
||||
*/
|
||||
export function parseHuggingFaceRef(input: string): string | null {
|
||||
const trimmed = input.trim().replace(/\/+$/, "");
|
||||
const url = trimmed
|
||||
.replace(/^https?:\/\/(www\.)?huggingface\.co\//i, "")
|
||||
.replace(/^hf:\/\//i, "");
|
||||
// owner/model — letters, digits, dot, dash, underscore.
|
||||
return /^[\w.-]+\/[\w.-]+$/.test(url) ? url : null;
|
||||
}
|
||||
Reference in New Issue
Block a user