feat(console): 語意升 default(大眾化) + proxy 語意查不注入 owner(self-hosted 單租戶)
- console.ts: S.semantic false→true(會打字就按意義查,含 normalize);開關反映預設 - kbdb-proxy /kbdb/search: mode=semantic 不注入 owner_id(Vectorize 無 owner index+向量非owner=tenant→帶owner回0);單租戶全庫語意查正確 - <TBD-PhaseB>: 多租戶語意 owner 隔離(建 Vectorize owner_id metadata index) - leo 拍板 X(先做 self-hosted,不糾結 SaaS)
This commit is contained in:
@@ -488,7 +488,7 @@ function renderConsoleHtml(registryBase: string): string {
|
|||||||
tenant: '',
|
tenant: '',
|
||||||
total: null, // KBDB 總筆數(誠實 total)
|
total: null, // KBDB 總筆數(誠實 total)
|
||||||
chip: '', // entry_type filter('' = 全部)
|
chip: '', // entry_type filter('' = 全部)
|
||||||
semantic: false,
|
semantic: true, // 大眾化 default:語意為主(leo 2026-07-05,會打字就查得到,含 normalize)
|
||||||
cardId: '',
|
cardId: '',
|
||||||
graphCenter: '',
|
graphCenter: '',
|
||||||
wfCache: null,
|
wfCache: null,
|
||||||
@@ -755,6 +755,7 @@ function renderConsoleHtml(registryBase: string): string {
|
|||||||
function initSearchOnce() {
|
function initSearchOnce() {
|
||||||
if (searchInited) { return; }
|
if (searchInited) { return; }
|
||||||
searchInited = true;
|
searchInited = true;
|
||||||
|
$('se-sem').classList.toggle('on', S.semantic); // 開關反映預設(語意 default on)
|
||||||
renderChips();
|
renderChips();
|
||||||
ensureTotal();
|
ensureTotal();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -129,7 +129,11 @@ kbdbProxyRouter.get('/kbdb/search', async (c) => {
|
|||||||
const q = c.req.query('q');
|
const q = c.req.query('q');
|
||||||
if (!q) return c.json({ error: 'q 必填' }, 400);
|
if (!q) return c.json({ error: 'q 必填' }, 400);
|
||||||
const { base, headers } = kbdbBase(c.env);
|
const { base, headers } = kbdbBase(c.env);
|
||||||
const params = new URLSearchParams({ q, owner_id: owner });
|
const mode = c.req.query('mode');
|
||||||
|
// self-hosted 單租戶:mode=semantic 暫不注入 owner_id(Vectorize 未建 owner_id metadata index,
|
||||||
|
// 且 embedded 向量非 owner=tenant → 帶 owner 一律回 0)。單租戶下全庫語意查即正確。
|
||||||
|
// <TBD-PhaseB>:多租戶時語意也要 owner 隔離(建 Vectorize owner_id metadata index + 向量帶 owner)。
|
||||||
|
const params = new URLSearchParams(mode === 'semantic' ? { q } : { q, owner_id: owner });
|
||||||
for (const k of ['entry_type', 'source', 'mode']) {
|
for (const k of ['entry_type', 'source', 'mode']) {
|
||||||
const v = c.req.query(k);
|
const v = c.req.query(k);
|
||||||
if (v) params.set(k, v);
|
if (v) params.set(k, v);
|
||||||
|
|||||||
Reference in New Issue
Block a user