diff --git a/cypher-executor/src/routes/console.ts b/cypher-executor/src/routes/console.ts index a3a62b8..88caff6 100644 --- a/cypher-executor/src/routes/console.ts +++ b/cypher-executor/src/routes/console.ts @@ -488,7 +488,7 @@ function renderConsoleHtml(registryBase: string): string { tenant: '', total: null, // KBDB 總筆數(誠實 total) chip: '', // entry_type filter('' = 全部) - semantic: false, + semantic: true, // 大眾化 default:語意為主(leo 2026-07-05,會打字就查得到,含 normalize) cardId: '', graphCenter: '', wfCache: null, @@ -755,6 +755,7 @@ function renderConsoleHtml(registryBase: string): string { function initSearchOnce() { if (searchInited) { return; } searchInited = true; + $('se-sem').classList.toggle('on', S.semantic); // 開關反映預設(語意 default on) renderChips(); ensureTotal(); } diff --git a/cypher-executor/src/routes/kbdb-proxy.ts b/cypher-executor/src/routes/kbdb-proxy.ts index 8d12267..d6e2c6f 100644 --- a/cypher-executor/src/routes/kbdb-proxy.ts +++ b/cypher-executor/src/routes/kbdb-proxy.ts @@ -129,7 +129,11 @@ kbdbProxyRouter.get('/kbdb/search', async (c) => { const q = c.req.query('q'); if (!q) return c.json({ error: 'q 必填' }, 400); 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)。單租戶下全庫語意查即正確。 + // :多租戶時語意也要 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']) { const v = c.req.query(k); if (v) params.set(k, v);