diff --git a/console-ui/public/portal/index.html b/console-ui/public/portal/index.html index 9278fac..2efcccb 100644 --- a/console-ui/public/portal/index.html +++ b/console-ui/public/portal/index.html @@ -647,12 +647,25 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { return src.slice(5).replace(/#[^#]*$/, ''); } function entryLib(e) { var m = entryMeta(e); return (typeof m.library === 'string' && m.library) ? m.library : 'general'; } + // 內部型別 → 人話標籤(2026-08-07:entry_type 原始值如 wiki_card / block / execution_log + // 是資料庫內部分類,不是用戶該懂的詞——尤其 wiki_card 直接違背上傳頁自己講的「AI 整理後 + // 會以 wiki 卡形式出現」,若卡片上貼的標籤是英文 snake_case「wiki_card」,等於自打嘴巴。 + // 未知型別一律落地成中性的「筆記」,不吐原始英文字串給使用者。 + var ENTRY_TYPE_LABEL = { + wiki_card: '知識卡', block: '知識卡', value: '記錄', workflow: '工作流', + execution_log: '執行紀錄', todo: '待辦', inbox: '收件', user_template: '範本', + recipe_submission: '投稿', agent_feedback: '回饋' + }; + function entryTypeLabel(t) { return ENTRY_TYPE_LABEL[t] || '筆記'; } + // 搜尋模式的原始值(keyword/semantic)是 API 參數,不是用戶詞彙——一律轉中文再顯示。 + var SEARCH_MODE_LABEL = { keyword: '關鍵字', semantic: '語意', graph: '圖譜' }; + function searchModeLabel(m) { return SEARCH_MODE_LABEL[m] || m; } function entryTitle(e) { if (e.page_name) return e.page_name; var first = String(e.content || '').split(/\r?\n/).find(function (l) { return l.trim(); }) || ''; first = first.replace(/^#+\s*/, '').replace(/^[-*>]\s*/, '').trim(); if (first.length > 60) first = first.slice(0, 60) + '…'; - return first || '(無標題・' + (e.entry_type || 'entry') + ')'; + return first || '(無標題・' + entryTypeLabel(e.entry_type) + ')'; } function entrySnippet(e) { var lines = String(e.content || '').split(/\r?\n/).filter(function (l) { return l.trim(); }); @@ -1165,10 +1178,14 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { if (!x.ok) { $('se-count').innerHTML = '' + esc(x.d.error || ('查詢失敗(HTTP ' + x.status + ')')) + ''; return; } var d = x.d; if (S.mode === 'semantic' && d.mode === 'keyword') { - $('se-banner').innerHTML = '
語意搜尋尚未啟用
語意搜尋用「意思」找資料,不是字面比對。
' + esc(d.capability_hint || '系統尚未開啟語意索引——不會假裝有語意結果,以下是關鍵字結果。') + '
'; + // 2026-08-07:不直接透傳後端 capability_hint——那句話是寫給工程師看的 + // (會出現「叫 CC」「vectorize」「redeploy」這類我們內部的修法指令,不是講給 + // 一般用戶聽的)。前端固定顯示「發生了什麼+現在怎麼辦」,不假裝有語意結果, + // 也不留用戶不知道下一步的空白。 + $('se-banner').innerHTML = '
語意搜尋還沒開通
語意搜尋能理解你問題的「意思」找資料,不只是比對關鍵字。
這個知識庫目前還沒開通這個功能,以下顯示的是關鍵字搜尋結果(不會假裝有語意結果)。
想開通的話,到「設定」→「疑難排解」匯出診斷檔給我們,我們會幫你打開。
'; } var entries = d.entries || []; - $('se-count').textContent = '命中 ' + entries.length + ' 筆・模式 ' + (d.mode || 'keyword') + (d.note ? '・' + d.note : ''); + $('se-count').textContent = '命中 ' + entries.length + ' 筆・模式 ' + searchModeLabel(d.mode || 'keyword') + (d.note ? '・' + d.note : ''); if (!entries.length) { $('se-results').innerHTML = '
找不到「' + esc(q) + '」——換個關鍵字試試。
'; return; @@ -1179,7 +1196,7 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { '
' + esc(entryTitle(e)) + '
' + '
' + esc(entrySnippet(e)) + '
' + '
' + - '' + esc(e.entry_type || 'entry') + '' + + '' + esc(entryTypeLabel(e.entry_type)) + '' + '' + esc(entryLib(e)) + '' + (src ? '' + esc(src) + '' : '') + '' + esc(fmtDate(e.created_at)) + '
'; @@ -1223,7 +1240,7 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { var mode = (s && s.mode) || ''; var href = s && s.source ? srcHref(s.source) : ''; return '
' + - (mode ? '' + esc(mode) + '' : '') + + (mode ? '' + esc(searchModeLabel(mode)) + '' : '') + '' + esc(page || '(無頁名)') + '' + (href ? '來源 ↗' : '') + '
'; @@ -1323,7 +1340,7 @@ function taipeiMonthDay(ms) { var d = new Date(ms + TAIPEI_OFFSET_MS); return { var src = entrySource(e); $('cd-main').innerHTML = '
' + esc(entryTitle(e)) + '
' + '
' + - '' + esc(e.entry_type || 'entry') + '' + + '' + esc(entryTypeLabel(e.entry_type)) + '' + '' + esc(entryLib(e)) + '' + (e.page_name ? '' + esc(e.page_name) + '' : '') + '' + esc(fmtDateTime(e.created_at)) + '
' +