mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-29 08:58:53 -03:00
fix(recipe): improve Civitai URL generation for missing LoRAs
Use model-versions endpoint (https://civitai.com/model-versions/{id}) which auto-redirects to the correct model page when only versionId is available. This fixes the UX issue where clicking on 'Not in Library' LoRA entries in Recipe Modal would open a search page instead of the actual model page. Changes: - uiHelpers.js: Prioritize versionId over modelId for Civitai URLs - RecipeModal.js: Include versionId in navigation condition checks
This commit is contained in:
@@ -1259,7 +1259,7 @@ class RecipeModal {
|
|||||||
const versionId = checkpoint.id || checkpoint.modelVersionId;
|
const versionId = checkpoint.id || checkpoint.modelVersionId;
|
||||||
const modelName = checkpoint.name || checkpoint.modelName || checkpoint.file_name;
|
const modelName = checkpoint.name || checkpoint.modelName || checkpoint.file_name;
|
||||||
|
|
||||||
if (modelId || modelName) {
|
if (modelId || versionId || modelName) {
|
||||||
openCivitaiByMetadata(modelId, versionId, modelName);
|
openCivitaiByMetadata(modelId, versionId, modelName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1317,7 +1317,7 @@ class RecipeModal {
|
|||||||
const versionId = lora.id || lora.modelVersionId;
|
const versionId = lora.id || lora.modelVersionId;
|
||||||
const modelName = lora.modelName || lora.name || lora.file_name;
|
const modelName = lora.modelName || lora.name || lora.file_name;
|
||||||
|
|
||||||
if (modelId || modelName) {
|
if (modelId || versionId || modelName) {
|
||||||
openCivitaiByMetadata(modelId, versionId, modelName);
|
openCivitaiByMetadata(modelId, versionId, modelName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -184,14 +184,13 @@ function filterByFolder(folderPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function openCivitaiByMetadata(civitaiId, versionId, modelName = null) {
|
export function openCivitaiByMetadata(civitaiId, versionId, modelName = null) {
|
||||||
if (civitaiId) {
|
if (versionId) {
|
||||||
let url = `https://civitai.com/models/${civitaiId}`;
|
// Use model-versions endpoint which auto-redirects to correct model page
|
||||||
if (versionId) {
|
window.open(`https://civitai.com/model-versions/${versionId}`, '_blank');
|
||||||
url += `?modelVersionId=${versionId}`;
|
} else if (civitaiId) {
|
||||||
}
|
window.open(`https://civitai.com/models/${civitaiId}`, '_blank');
|
||||||
window.open(url, '_blank');
|
|
||||||
} else if (modelName) {
|
} else if (modelName) {
|
||||||
// 如果没有ID,尝试使用名称搜索
|
// Fallback: search by name
|
||||||
window.open(`https://civitai.com/models?query=${encodeURIComponent(modelName)}`, '_blank');
|
window.open(`https://civitai.com/models?query=${encodeURIComponent(modelName)}`, '_blank');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user