feat: update search cards with chunk_id display; sync snippet db

This commit is contained in:
OpenCode
2026-06-01 21:58:33 +08:00
parent ccfdfb2c20
commit 72a4e8f3b1
4 changed files with 7 additions and 56 deletions

View File

@@ -479,9 +479,9 @@ async function semanticSearch() {
data-end-time="${endTime}"
data-text="${textAttr}">
<div style="font-weight: 600; color: #1e40af;">${i.name} (${i.source || 'unknown'})</div>
<div class="chunk-time">${i.file_uuid} | ${startTime.toFixed(1)}s - ${endTime.toFixed(1)}s</div>
<div style="margin-top: 4px;">${i.text_content || '無內容'}</div>
<button class="play-btn">▶ 播放片段</button>
<div class="chunk-time">${startTime.toFixed(1)}s - ${endTime.toFixed(1)}s${i.chunk_id ? ` | ${i.chunk_id}` : ''}</div>
<div style="margin-top: 4px;font-size:13px;color:#555;">${i.text_content || ''}</div>
<button class="play-btn" style="margin-top:6px;">▶ 播放片段</button>
</div>`;
}).join('');
resultEl.innerHTML = `<p style="padding: 0.5rem; background: #d1fae5; border-radius: 4px; margin-bottom: 0.5rem;">找到 ${data.total || 0} 個身份相關片段</p>${resultsHtml || '<p>沒有結果</p>'}`;
@@ -503,10 +503,10 @@ async function semanticSearch() {
data-start-time="${startTime}"
data-end-time="${endTime}"
data-text="${textAttr}">
<div class="chunk-time">${r.file_uuid} | ${startTime.toFixed(1)}s - ${endTime.toFixed(1)}s</div>
<div style="margin-top: 4px;">${r.text || '無內容'}</div>
<div class="chunk-time">${startTime.toFixed(1)}s - ${endTime.toFixed(1)}s${r.chunk_id ? ` | ${r.chunk_id}` : ''}</div>
<div style="margin-top: 4px;font-size:13px;color:#555;">${r.text || ''}</div>
<div class="badge-status completed" style="margin-top: 4px;">相似度: ${(r.score * 100).toFixed(1)}%</div>
<button class="play-btn">▶ 播放片段</button>
<button class="play-btn" style="margin-top:6px;">▶ 播放片段</button>
</div>`;
}).join('');
resultEl.innerHTML = `<p style="padding: 0.5rem; background: #d1fae5; border-radius: 4px; margin-bottom: 0.5rem;">找到 ${data.total || 0} 個片段</p>${resultsHtml || '<p>沒有結果</p>'}`;