fix knowledge rag docx sidecar locator
This commit is contained in:
@@ -70,7 +70,7 @@ async function apiSearch(context) {
|
||||
rootUri: ROOT_URI,
|
||||
workspaceId: WORKSPACE_ID,
|
||||
query: QUERY,
|
||||
mode: "mix",
|
||||
mode: "exact",
|
||||
topK: 20,
|
||||
chunkTopK: 20,
|
||||
includeChunkContent: true,
|
||||
@@ -178,6 +178,8 @@ async function clickAndAuditRow(page, index, apiResult) {
|
||||
|
||||
const evidenceText = locator?.openAction?.params?.evidenceText || apiResult?.locator?.openAction?.params?.evidenceText || apiResult?.quote || rowText;
|
||||
const overlap = longestCommonSubstringLength(state.highlightedText, evidenceText);
|
||||
const compactHighlighted = compactText(state.highlightedText);
|
||||
const compactEvidence = compactText(evidenceText);
|
||||
assert.equal(state.panelBlockId, locator.blockId, `第 ${index + 1} 条 panel blockId 不一致: ${JSON.stringify(state, null, 2)}`);
|
||||
assert(state.highlightedText.includes(QUERY), `第 ${index + 1} 条定位高亮未包含 query: ${JSON.stringify(state, null, 2)}`);
|
||||
assert(
|
||||
@@ -185,11 +187,9 @@ async function clickAndAuditRow(page, index, apiResult) {
|
||||
`第 ${index + 1} 条仍是短词高亮,不是段落级高亮: ${JSON.stringify(state, null, 2)}`,
|
||||
);
|
||||
assert(
|
||||
overlap >= 10 || (
|
||||
state.highlightedTag === "P"
|
||||
&& compactText(state.highlightedText).includes(compactText(QUERY))
|
||||
&& compactText(state.highlightedText).length >= 6
|
||||
),
|
||||
overlap >= Math.min(10, Math.max(4, compactEvidence.length))
|
||||
|| compactHighlighted.includes(compactEvidence)
|
||||
|| compactEvidence.includes(compactHighlighted),
|
||||
`第 ${index + 1} 条搜索结果与实际定位上下文不一致: ${JSON.stringify({ rowText, evidenceText, overlap, state }, null, 2)}`,
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user