Add tag editing functionality: implement UI for editing model tags, including save and delete options, and integrate with existing modal structure.

This commit is contained in:
Will Miao
2025-06-12 21:00:17 +08:00
parent 92d48335cb
commit c2af282a85
5 changed files with 756 additions and 42 deletions

View File

@@ -26,9 +26,10 @@ export function formatFileSize(bytes) {
/**
* 渲染紧凑标签
* @param {Array} tags - 标签数组
* @param {string} filePath - 文件路径,用于编辑按钮
* @returns {string} HTML内容
*/
export function renderCompactTags(tags) {
export function renderCompactTags(tags, filePath = '') {
if (!tags || tags.length === 0) return '';
// Display up to 5 tags, with a tooltip indicator if there are more
@@ -37,11 +38,16 @@ export function renderCompactTags(tags) {
return `
<div class="model-tags-container">
<div class="model-tags-compact">
${visibleTags.map(tag => `<span class="model-tag-compact">${tag}</span>`).join('')}
${remainingCount > 0 ?
`<span class="model-tag-more" data-count="${remainingCount}">+${remainingCount}</span>` :
''}
<div class="model-tags-header">
<div class="model-tags-compact">
${visibleTags.map(tag => `<span class="model-tag-compact">${tag}</span>`).join('')}
${remainingCount > 0 ?
`<span class="model-tag-more" data-count="${remainingCount}">+${remainingCount}</span>` :
''}
</div>
<button class="edit-tags-btn" data-file-path="${filePath}" title="Edit tags">
<i class="fas fa-pencil-alt"></i>
</button>
</div>
${tags.length > 0 ?
`<div class="model-tags-tooltip">