From 6ff1355fe8ed59f380ff267f62127f8ba7fdc60a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claude=20=28=E7=B8=BD=E7=AE=A1=E9=9B=B2=E7=AB=AF=29?= Date: Sat, 18 Jul 2026 06:13:45 +0000 Subject: [PATCH] =?UTF-8?q?portal:=20=E5=9C=96=E8=AD=9C=E9=84=B0=E5=B1=85?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E4=BF=AE=20[object=20Object]=EF=BC=8B?= =?UTF-8?q?=E9=97=9C=E8=81=AF=E5=88=97=E5=BE=9E=20workflow=20neighbors=20?= =?UTF-8?q?=E5=B0=8E=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - workflow 版 graph_neighbors 的 neighbors 是 {node,predicate,from,depth} 物件, renderGraph 期望字串 → 節點 chips 全變 [object Object];正規化成名字再渲染。 - workflow 版 edges 恆空 → 關聯永遠 0;neighbor 物件本身就是一條邊,導出成 {subject,predicate,object} 餵關聯列(plugin 版行為不變)。 - 邊列 subject 比對改大小寫不敏感(graph 查詢端已正規化,搜 rag 命中節點 RAG)。 - 來源:leo RAG demo 客戶測試回饋問題 3(鄰居/關聯顯示有誤)。 --- cypher-executor/src/routes/portal-ui.ts | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/cypher-executor/src/routes/portal-ui.ts b/cypher-executor/src/routes/portal-ui.ts index 99c79b9..99b2aa6 100644 --- a/cypher-executor/src/routes/portal-ui.ts +++ b/cypher-executor/src/routes/portal-ui.ts @@ -749,11 +749,23 @@ function renderPortalHtml(brand: string, sourceWebBase = ''): string { if (!x.ok) { $('se-count').innerHTML = '' + esc(x.d.error || ('關聯查詢失敗(HTTP ' + x.status + ')')) + ''; renderGraphEmpty(x.d.error || '關聯查詢失敗'); return; } var neighbors = x.d.neighbors || []; var edges = x.d.edges || []; - $('se-count').textContent = '節點「' + name + '」・鄰居 ' + neighbors.length + '・關聯 ' + edges.length; - if (!neighbors.length) { renderGraphEmpty('尚無關聯資料——這個名字還沒有連進知識圖譜。'); return; } - renderGraph(name, neighbors.slice(0, 10)); + // 形狀相容(Arcrun#57 家族):plugin 版 neighbors 是字串、workflow 版是 + // { node, predicate, from, depth } 物件——不正規化會渲染成 [object Object]。 + var names = neighbors.map(function (nb) { + if (typeof nb === 'string') return nb; + return (nb && (nb.node || nb.name)) || ''; + }).filter(Boolean); + // workflow 版 edges 恆空,但 neighbor 物件本身就是一條邊(from --predicate--> node)→ 導出。 + if (!edges.length) { + edges = neighbors.filter(function (nb) { return nb && typeof nb === 'object' && nb.predicate; }) + .map(function (nb) { return { subject: nb.from || name, predicate: nb.predicate, object: nb.node }; }); + } + $('se-count').textContent = '節點「' + name + '」・鄰居 ' + names.length + '・關聯 ' + edges.length; + if (!names.length) { renderGraphEmpty('尚無關聯資料——這個名字還沒有連進知識圖譜。'); return; } + renderGraph(name, names.slice(0, 10)); $('gr-edges').innerHTML = edges.slice(0, 12).map(function (t) { - var other = t.subject === name ? t.object : t.subject; + // 大小寫不敏感比對(graph 查詢已正規化:搜 rag 會命中節點 RAG) + var other = String(t.subject).toLowerCase() === String(name).toLowerCase() ? t.object : t.subject; return '
' + '' + esc(t.predicate || '關聯') + '' + '' + esc(other) + '' +