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 modelName = checkpoint.name || checkpoint.modelName || checkpoint.file_name;
|
||||
|
||||
if (modelId || modelName) {
|
||||
if (modelId || versionId || modelName) {
|
||||
openCivitaiByMetadata(modelId, versionId, modelName);
|
||||
return;
|
||||
}
|
||||
@@ -1317,7 +1317,7 @@ class RecipeModal {
|
||||
const versionId = lora.id || lora.modelVersionId;
|
||||
const modelName = lora.modelName || lora.name || lora.file_name;
|
||||
|
||||
if (modelId || modelName) {
|
||||
if (modelId || versionId || modelName) {
|
||||
openCivitaiByMetadata(modelId, versionId, modelName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,14 +184,13 @@ function filterByFolder(folderPath) {
|
||||
}
|
||||
|
||||
export function openCivitaiByMetadata(civitaiId, versionId, modelName = null) {
|
||||
if (civitaiId) {
|
||||
let url = `https://civitai.com/models/${civitaiId}`;
|
||||
if (versionId) {
|
||||
url += `?modelVersionId=${versionId}`;
|
||||
}
|
||||
window.open(url, '_blank');
|
||||
if (versionId) {
|
||||
// Use model-versions endpoint which auto-redirects to correct model page
|
||||
window.open(`https://civitai.com/model-versions/${versionId}`, '_blank');
|
||||
} else if (civitaiId) {
|
||||
window.open(`https://civitai.com/models/${civitaiId}`, '_blank');
|
||||
} else if (modelName) {
|
||||
// 如果没有ID,尝试使用名称搜索
|
||||
// Fallback: search by name
|
||||
window.open(`https://civitai.com/models?query=${encodeURIComponent(modelName)}`, '_blank');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user