@customize-agent/knowledge 4.3.4 → 4.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -856,6 +856,10 @@ export class KnowledgeBaseManager {
|
|
|
856
856
|
rerankBoost += 160;
|
|
857
857
|
if (normalizedPhrase.length >= 4 && normalizedContent.includes(normalizedPhrase))
|
|
858
858
|
rerankBoost += 220;
|
|
859
|
+
// 时间类查询下,含具体日期/时刻的 chunk 是精确答案(如「获取时间:2026年8月13日」),
|
|
860
|
+
// 应优先于仅含规则条款的程序句(「距投标截止时间不足15日」类无具体时间)
|
|
861
|
+
if (/(时间|日期|工期|截止|开标|获取|递交)/u.test(query) && /20\d{2}年\d{1,2}月\d{1,2}日|\d{1,2}时\d{1,2}分/u.test(item.content))
|
|
862
|
+
rerankBoost += 60;
|
|
859
863
|
const titleText = `${item.titlePath ?? ''}\n${item.sectionTitle ?? ''}`.toLowerCase();
|
|
860
864
|
const normalizedTitle = this.normalizeSearchText(titleText);
|
|
861
865
|
let matchedTermCount = 0;
|
|
@@ -873,7 +877,7 @@ export class KnowledgeBaseManager {
|
|
|
873
877
|
rerankBoost += 22;
|
|
874
878
|
}
|
|
875
879
|
if (matchedTermCount >= 2)
|
|
876
|
-
rerankBoost += matchedTermCount *
|
|
880
|
+
rerankBoost += matchedTermCount * 30;
|
|
877
881
|
for (const label of factLabels) {
|
|
878
882
|
const normalizedLabel = this.normalizeSearchText(label);
|
|
879
883
|
if (normalizedContent.includes(normalizedLabel))
|
|
@@ -881,8 +885,11 @@ export class KnowledgeBaseManager {
|
|
|
881
885
|
if (normalizedTitle.includes(normalizedLabel))
|
|
882
886
|
rerankBoost += 120;
|
|
883
887
|
}
|
|
888
|
+
// 表格块惩罚仅针对「无任何查询词命中」的表格(清单特征块命中查询词时应保留竞争力);
|
|
889
|
+
// 表格行(清单特征「混凝土强度等级:C35」)在向量空间天然弱势,RRF 名次扁平下
|
|
890
|
+
// 若再吃 -80 惩罚,会被普通段落(绿建专篇)挤到后面,丢失精确词命中优势
|
|
884
891
|
if (item.chunkKind === 'table')
|
|
885
|
-
rerankBoost += wantsTable ? 25 : -80;
|
|
892
|
+
rerankBoost += wantsTable ? 25 : (matchedTermCount > 0 ? -10 : -80);
|
|
886
893
|
if (item.chunkKind === 'metadata')
|
|
887
894
|
rerankBoost += wantsDrawing ? 60 : -100;
|
|
888
895
|
if (item.chunkKind === 'data')
|
|
@@ -893,7 +900,9 @@ export class KnowledgeBaseManager {
|
|
|
893
900
|
rerankBoost -= wantsDrawing ? 60 : 160;
|
|
894
901
|
}
|
|
895
902
|
if (/工作表:|COL\d+|专业工程暂估价计价表|分部分项工程量清单计价表|材料(工程设备)暂估单价一览表/u.test(item.content)) {
|
|
896
|
-
|
|
903
|
+
// 计价表行无查询词命中是纯标题噪音(-140);命中查询词的清单特征行
|
|
904
|
+
// (「混凝土强度等级:C35」)是用户直接目标,仅轻惩罚维持正文优先
|
|
905
|
+
rerankBoost -= wantsTable ? 35 : (matchedTermCount > 0 ? 20 : 140);
|
|
897
906
|
}
|
|
898
907
|
if (/第\s*\d+\s*页\s*共\s*\d+\s*页|PDF\s*第\s*\d+\s*页/iu.test(item.content) && factLabels.length > 0)
|
|
899
908
|
rerankBoost -= 12;
|
|
@@ -921,8 +930,12 @@ export class KnowledgeBaseManager {
|
|
|
921
930
|
}
|
|
922
931
|
queryTerms(query) {
|
|
923
932
|
const base = query.toLowerCase().split(/[\s,,。;;::、]+/u).filter(Boolean);
|
|
933
|
+
// 字母数字与汉字连续串按边界拆词(与 store.expandSearchTerms 的边界拆分一致):
|
|
934
|
+
// 「C35混凝土」须拆出「c35」「混凝土」,重排层才能识别清单特征块的双词命中,
|
|
935
|
+
// 否则 terms 只有整串连写短语,对「强度等级:C35」类特征块零命中、错吃 table 惩罚
|
|
936
|
+
const splitParts = base.flatMap(term => term.split(/([\p{Script=Han}]+)/u).filter(part => part.length > 0));
|
|
924
937
|
const labels = this.queryFactLabels(query).map(label => label.toLowerCase());
|
|
925
|
-
return [...new Set([...base, ...labels].filter(term => term.length > 0))];
|
|
938
|
+
return [...new Set([...base, ...splitParts, ...labels].filter(term => term.length > 0))];
|
|
926
939
|
}
|
|
927
940
|
queryFactLabels(query) {
|
|
928
941
|
const labels = [];
|
|
@@ -944,6 +957,12 @@ export class KnowledgeBaseManager {
|
|
|
944
957
|
labels.push('招标人', '项目业主', '建设单位');
|
|
945
958
|
if (/临水|临电|临时水电|水电接引|接驳点|挂表计量|施工水电/u.test(query))
|
|
946
959
|
labels.push('临水临电', '临时水电接引', '施工水电接引费', '接驳点挂表计量', '挂表计量');
|
|
960
|
+
if (/获取时间|获取方式/u.test(query))
|
|
961
|
+
labels.push('获取时间', '招标文件获取时间');
|
|
962
|
+
if (/投标截止|截止时间/u.test(query))
|
|
963
|
+
labels.push('投标截止时间', '投标文件递交的截止时间');
|
|
964
|
+
if (/开标时间|开标地点|开标/u.test(query))
|
|
965
|
+
labels.push('开标时间和地点', '开标时间', '开标地点');
|
|
947
966
|
if (/场地限制|材料堆场|办公区|生活区|加工区/u.test(query))
|
|
948
967
|
labels.push('场地限制', '不具备材料堆场', '搭设加工区', '搭设办公区', '搭设生活区');
|
|
949
968
|
if (/拆除|修补|破损处|改造维修/u.test(query))
|