feat(rag): align LightRAG native citations and MCP bridge
This commit is contained in:
@@ -78,6 +78,14 @@ async function main() {
|
||||
assert((knowledgePayload.results?.length || 0) >= 8, `资料库 2 字 query 应返回段落去重后的 LightRAG 检索命中: ${JSON.stringify(knowledgePayload, null, 2).slice(0, 2000)}`);
|
||||
assert(String(knowledgePayload.results?.[0]?.snippet || "").includes(SHORT_QUERY), `资料库结果未包含 ${SHORT_QUERY}: ${JSON.stringify(knowledgePayload.results?.[0], null, 2)}`);
|
||||
assert(knowledgePayload.references?.some((reference) => reference.matchSource === "lightrag_search"), `2 字 query 应走 LightRAG search provider: ${JSON.stringify(knowledgePayload.references?.slice(0, 3), null, 2)}`);
|
||||
const firstKnowledgeResult = knowledgePayload.results?.[0] || {};
|
||||
const firstKnowledgeCitation = knowledgePayload.citations?.[0] || {};
|
||||
assert(firstKnowledgeResult.displayQuote && firstKnowledgeResult.locatorEvidenceText, `搜索结果缺少 displayQuote/locatorEvidenceText: ${JSON.stringify(firstKnowledgeResult, null, 2)}`);
|
||||
assert(firstKnowledgeCitation.citationId && firstKnowledgeCitation.displayQuote && firstKnowledgeCitation.locatorEvidenceText, `citations[] 缺少统一引用字段: ${JSON.stringify(firstKnowledgeCitation, null, 2)}`);
|
||||
assert(
|
||||
!/(?:<\/?e(?:q(?:uation)?)?\b|<\/?drawing\b|format=["']?latex|\blatex\b)/i.test(String(firstKnowledgeResult.displayQuote || "")),
|
||||
`displayQuote 仍暴露原始公式/绘图标记: ${firstKnowledgeResult.displayQuote}`
|
||||
);
|
||||
|
||||
const tooShortSearch = await context.request.post(`${BASE_URL}/api/knowledge-rag/search`, {
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user