From ac4fb56c913baccf12fb3faf36304aad35668f3e Mon Sep 17 00:00:00 2001 From: uncle6me-web Date: Fri, 7 Aug 2026 22:38:07 +0800 Subject: [PATCH] =?UTF-8?q?portal=20=E5=89=8D=E7=AB=AF=E6=96=87=E6=A1=88?= =?UTF-8?q?=EF=BC=9A=E8=AA=9E=E6=84=8F=E6=90=9C=E5=B0=8B=E9=99=8D=E7=B4=9A?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=94=B9=E8=AC=9B=E4=BA=BA=E8=A9=B1=EF=BC=8B?= =?UTF-8?q?entry=5Ftype/mode=20=E4=B8=8D=E5=86=8D=E5=90=90=E5=8E=9F?= =?UTF-8?q?=E5=A7=8B=E8=8B=B1=E6=96=87=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 封測者 Oscar 回報「語義搜尋搜不到」,追查發現 portal 使用者實際會看到的降級提示 其實是後端 kbdb capability_hint 直接透傳(寫給工程師看的:「叫 CC」「vectorize」 「kbdb_embed:true」「redeploy」),比 UI 裡原本的 fallback 文案還難懂。 - se-banner:不再透傳後端 capability_hint,前端固定顯示「發生了什麼+現在怎麼辦」 (語意搜尋還沒開通→以下是關鍵字結果→到設定頁疑難排解匯出診斷檔給我們) - 新增 entryTypeLabel():entry_type 原始值(wiki_card/block/execution_log…) 不再直接印給用戶看——尤其 wiki_card 原樣顯示會打臉上傳頁自己講的「AI 整理後 會以 wiki 卡形式出現」 - 新增 searchModeLabel():搜尋結果「模式 keyword/semantic」的英文值改顯示 中文(關鍵字/語意/圖譜),AI 問答來源標籤同步套用 不動 console/index.html(僅供部署擁有者/維運者使用,非客戶介面,根目錄 index.html 明文寫「不該對客戶露出」,同類字眼在此屬合理專業詞彙,故不改)。 不動 cypher-executor/src、kbdb/src(另一 agent 正在改 credential 路徑; 真正的降級文案根因在 kbdb/src/routes/entries.ts 的 capability_hint, 已另行回報總管,非本次改動範圍)。 已用 installer/scripts/build-ui-bundle.mjs 打包驗證:新文案進 bundle、 舊文案消失,entryTypeLabel/searchModeLabel 均實際生效(非死代碼)。 --- console-ui/public/portal/index.html | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) 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)) + '
' +