feat: 增强模型下载功能,支持 HuggingFace Hub 直接下载 ONNX 格式模型

This commit is contained in:
catlog22
2026-01-11 18:22:36 +08:00
parent 1e91fa9f9e
commit b77672dda4
3 changed files with 75 additions and 45 deletions

View File

@@ -916,7 +916,7 @@ select.cli-input {
.cli-textarea {
resize: vertical;
min-height: 4rem;
max-height: 12rem;
max-height: 20rem;
font-family: 'SF Mono', 'Consolas', 'Liberation Mono', monospace;
font-size: 0.8125rem;
}
@@ -2681,7 +2681,7 @@ select.cli-input {
display: flex;
position: relative;
min-height: 200px;
max-height: 350px;
max-height: min(450px, 50vh);
}
.json-line-numbers {

View File

@@ -2672,14 +2672,15 @@ async function loadModelList() {
'<i data-lucide="plus-circle" class="w-3 h-3"></i> Download Custom Model' +
'</div>' +
'<div class="flex gap-2">' +
'<input type="text" id="customModelInput" placeholder="e.g., BAAI/bge-small-en-v1.5" ' +
'<input type="text" id="customModelInput" placeholder="e.g., Xenova/bge-small-en-v1.5" ' +
'class="flex-1 text-xs px-2 py-1.5 border border-border rounded bg-background focus:border-primary focus:ring-1 focus:ring-primary outline-none" />' +
'<button onclick="downloadCustomModel()" class="text-xs px-3 py-1.5 bg-primary text-primary-foreground rounded hover:bg-primary/90">' +
'Download' +
'</button>' +
'</div>' +
'<div class="text-[10px] text-muted-foreground mt-2">' +
'Enter any HuggingFace model name compatible with FastEmbed' +
'<div class="text-[10px] text-muted-foreground mt-2 space-y-1">' +
'<div><span class="text-amber-500">⚠</span> Only <strong>ONNX-format</strong> models work with FastEmbed (e.g., Xenova/* models)</div>' +
'<div>PyTorch models (intfloat/*, sentence-transformers/*) will download but won\'t work with local embedding</div>' +
'</div>' +
'</div>';
} else {