mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-09-21 03:01:27 -03:00
84146b62fd
Other Models management is opt-in and its folders come from folder_paths.get_folder_paths(). In plugin mode ComfyUI registers vae, upscale_models, text_encoders, clip_vision and controlnet out of the box, so enabling the feature works immediately. Standalone only knows the keys present in settings.json.folder_paths, and that file is edited by hand - there is no UI for those keys - so a standalone user who followed the announcement banner reached "Enable Other Models" and then an empty page. Gate the announcement on the capability instead of on how the process was started: - Config.get_other_models_availability() probes every canonical other key (legacy clip collapses into text_encoders where the host exposes map_legacy) and reports which sub_types resolve to a folder that exists on disk. It deliberately ignores enable_other_models: the question is "could this work here at all?". An empty folder counts, because CivitAI downloads can target it. - /api/lm/settings exposes it as the derived, non-persisted other_models_paths_available flag; a probe failure yields null and the banner fails open. - BannerService only registers the announcement when the flag is not false. `=== false` (not falsy) keeps a cached/older payload working, and nothing is written to dismissed_banners, so the banner can return once folders exist. - The Other page grows an "enabled but nothing to scan" empty state driven by config.other_roots, showing the settings.json snippet for standalone and a pointer to ComfyUI model paths otherwise, plus an Open Settings action. It also covers the corner where only a non-default sub_type has a folder. Translate the six other.noPaths.* keys into all nine locales and record the new "folder key" / "on disk" terminology in the i18n guidelines. Backend tests and pytest tests/i18n could not run in this environment (no pytest/platformdirs); the probe was exercised against a stubbed folder_paths. Frontend: 120 files / 1101 JS tests passed.
172 lines
6.8 KiB
HTML
172 lines
6.8 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% block title %}{{ t('other.title') }}{% endblock %}
|
|
{% block page_id %}other{% endblock %}
|
|
|
|
{% block init_title %}{{ t('initialization.other.title') }}{% endblock %}
|
|
{% block init_message %}{{ t('initialization.other.message') }}{% endblock %}
|
|
{% block init_check_url %}/api/other/list?page=1&page_size=1{% endblock %}
|
|
|
|
{% block page_css %}
|
|
<style>
|
|
.other-disabled {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 12px;
|
|
text-align: center;
|
|
padding: 64px 24px;
|
|
color: var(--text-color, #e0e0e0);
|
|
}
|
|
.other-disabled > i {
|
|
font-size: 48px;
|
|
opacity: 0.6;
|
|
}
|
|
.other-disabled h2 {
|
|
margin: 0;
|
|
font-size: 20px;
|
|
}
|
|
.other-disabled p {
|
|
margin: 0;
|
|
max-width: 520px;
|
|
line-height: 1.6;
|
|
opacity: 0.8;
|
|
}
|
|
.other-disabled .other-disabled-hint {
|
|
font-size: 13px;
|
|
opacity: 0.6;
|
|
}
|
|
.other-disabled button {
|
|
margin-top: 8px;
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
font-size: 14px;
|
|
color: #fff;
|
|
background: var(--primary-color, #4a7dff);
|
|
}
|
|
.other-disabled button:disabled {
|
|
opacity: 0.6;
|
|
cursor: default;
|
|
}
|
|
.other-no-paths-config {
|
|
margin: 4px 0 0;
|
|
padding: 12px 16px;
|
|
max-width: 520px;
|
|
overflow-x: auto;
|
|
text-align: left;
|
|
font-size: 12px;
|
|
line-height: 1.5;
|
|
border-radius: 6px;
|
|
background: rgba(127, 127, 127, 0.15);
|
|
border: 1px solid rgba(127, 127, 127, 0.25);
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block additional_components %}
|
|
|
|
<div id="otherContextMenu" class="context-menu" style="display: none;">
|
|
<!-- Metadata -->
|
|
<div class="context-menu-item" data-action="refresh-metadata"><i class="fas fa-sync"></i> {{ t('loras.contextMenu.refreshMetadata') }}</div>
|
|
<div class="context-menu-item has-submenu" data-has-submenu="link-model">
|
|
<i class="fas fa-link"></i>
|
|
<span>{{ t('loras.contextMenu.linkModel') }}</span>
|
|
<i class="fas fa-chevron-right submenu-arrow"></i>
|
|
<div class="context-submenu">
|
|
<div class="context-menu-item" data-action="relink-civitai">
|
|
<i class="fas fa-external-link-alt"></i> <span>{{ t('loras.contextMenu.linkCivitai') }}</span>
|
|
</div>
|
|
<div class="context-menu-item" data-action="link-hf">
|
|
<i class="fas fa-robot"></i> <span>{{ t('loras.contextMenu.linkHuggingFace') }}</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="context-menu-separator menu-section-break"></div>
|
|
<!-- Workflow -->
|
|
<div class="context-menu-item" data-action="copyname"><i class="fas fa-copy"></i> {{ t('loras.contextMenu.copyFilename') }}</div>
|
|
<div class="context-menu-separator menu-section-break"></div>
|
|
<!-- Media / Preview -->
|
|
<div class="context-menu-item" data-action="preview"><i class="fas fa-folder-open"></i> {{ t('loras.contextMenu.openExamples') }}</div>
|
|
<div class="context-menu-item has-submenu" data-has-submenu="download-examples"><i class="fas fa-download"></i> {{ t('loras.contextMenu.downloadExamples') }} <i class="fas fa-chevron-right submenu-arrow"></i>
|
|
<div class="context-submenu">
|
|
<div class="context-menu-item" data-action="download-examples"><i class="fas fa-download"></i> {{ t('loras.contextMenu.downloadMissingExamples') }}</div>
|
|
<div class="context-menu-item" data-action="download-examples-force"><i class="fas fa-redo-alt"></i> {{ t('loras.contextMenu.reprocessExamples') }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="context-menu-item" data-action="replace-preview"><i class="fas fa-image"></i> {{ t('loras.contextMenu.replacePreview') }}</div>
|
|
<div class="context-menu-separator menu-section-break"></div>
|
|
<!-- Attributes -->
|
|
<div class="context-menu-item" data-action="set-nsfw"><i class="fas fa-exclamation-triangle"></i> {{ t('loras.contextMenu.setContentRating') }}</div>
|
|
<div class="context-menu-separator menu-section-break"></div>
|
|
<!-- Organization -->
|
|
<div class="context-menu-item" data-action="move"><i class="fas fa-folder-open"></i> {{ t('loras.contextMenu.moveToFolder') }}</div>
|
|
<div class="context-menu-separator"></div>
|
|
<!-- Destructive -->
|
|
<div class="context-menu-item" data-action="exclude"><i class="fas fa-eye-slash"></i> {{ t('loras.contextMenu.excludeModel') }}</div>
|
|
<div class="context-menu-item delete-item" data-action="delete"><i class="fas fa-trash"></i> {{ t('loras.contextMenu.deleteModel') }}</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% if other_disabled %}
|
|
<div class="other-disabled">
|
|
<i class="fas fa-shapes"></i>
|
|
<h2>{{ t('other.disabled.title') }}</h2>
|
|
<p>{{ t('other.disabled.description') }}</p>
|
|
<button id="enableOtherModelsBtn" type="button">
|
|
<i class="fas fa-toggle-on"></i> {{ t('other.disabled.enableButton') }}
|
|
</button>
|
|
<p class="other-disabled-hint">{{ t('other.disabled.hint') }}</p>
|
|
</div>
|
|
{% elif other_no_paths %}
|
|
<div class="other-disabled">
|
|
<i class="fas fa-folder-open"></i>
|
|
<h2>{{ t('other.noPaths.title') }}</h2>
|
|
{% if standalone_mode %}
|
|
<p>{{ t('other.noPaths.descriptionStandalone') }}</p>
|
|
<pre class="other-no-paths-config"><code>"folder_paths": {
|
|
"vae": ["/path/to/vae"],
|
|
"upscale_models": ["/path/to/upscale_models"],
|
|
"text_encoders": ["/path/to/text_encoders"],
|
|
"clip_vision": ["/path/to/clip_vision"],
|
|
"controlnet": ["/path/to/controlnet"]
|
|
}</code></pre>
|
|
<p class="other-disabled-hint">{{ t('other.noPaths.hintStandalone') }}</p>
|
|
{% else %}
|
|
<p>{{ t('other.noPaths.descriptionComfyUI') }}</p>
|
|
<p class="other-disabled-hint">{{ t('other.noPaths.hintComfyUI') }}</p>
|
|
{% endif %}
|
|
<button id="openOtherModelsSettingsBtn" type="button">
|
|
<i class="fas fa-cog"></i> {{ t('other.noPaths.openSettings') }}
|
|
</button>
|
|
</div>
|
|
{% else %}
|
|
<div class="sticky-topbar">
|
|
{% include 'components/controls.html' %}
|
|
{% include 'components/breadcrumb.html' %}
|
|
</div>
|
|
{% include 'components/duplicates_banner.html' %}
|
|
{% include 'components/folder_sidebar.html' %}
|
|
|
|
<!-- Other model cards container -->
|
|
<div class="card-grid" id="modelGrid">
|
|
<!-- Cards will be dynamically inserted here -->
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block overlay %}
|
|
<div class="bulk-mode-overlay"></div>
|
|
{% endblock %}
|
|
|
|
{% block main_script %}
|
|
{% if other_disabled or other_no_paths %}
|
|
<script type="module" src="/loras_static/js/other_disabled.js?v={{ version }}"></script>
|
|
{% else %}
|
|
<script type="module" src="/loras_static/js/other.js?v={{ version }}"></script>
|
|
{% endif %}
|
|
{% endblock %}
|