@bytenew/bn-applet-ui 1.1.76 → 1.1.77

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.
@@ -30001,6 +30001,19 @@ function findParsedRegionConflict(parse, originalAddress) {
30001
30001
  return '';
30002
30002
  }
30003
30003
 
30004
+ /**
30005
+ * 本地识别的省市区全部为空,但输入文本中出现省/市/区/县等行政区划文字时,
30006
+ * 说明本地识别遗漏了行政区划(如姓名前缀把省份顶出匹配窗口),
30007
+ * 也需要调用大模型接口重新识别
30008
+ */
30009
+ function shouldFallbackToAIWhenEmpty(parse, originalAddress) {
30010
+ if (parse.province || parse.city || parse.area) {
30011
+ return false;
30012
+ }
30013
+ var compareText = normalizeAddressForCompare(originalAddress);
30014
+ return /[省市区县]/.test(compareText);
30015
+ }
30016
+
30004
30017
  /**
30005
30018
  * 本地识别错误时,使用原生 fetch 调用大模型接口重新识别
30006
30019
  * options.platform == 'plugin'(插件端):POST /project/column/addressBychat,请求体 {content: 待识别文本}
@@ -30100,9 +30113,10 @@ function _addressParse() {
30100
30113
  parseArea(list);
30101
30114
  }
30102
30115
  cleanAddress = preprocessAddress(address);
30103
- parse = parseAddressDetail(cleanAddress, sourceData || {}, address); // 识别完毕后校验:输入文本中有明确的省市区文字,但识别结果与之不一致时,调用大模型接口重新识别
30116
+ parse = parseAddressDetail(cleanAddress, sourceData || {}, address); // 识别完毕后校验:输入文本中有明确的省市区文字,但识别结果与之不一致时,调用大模型接口重新识别;
30117
+ // 省市区识别全为空但输入中出现省市区等行政区划文字时,同样调用大模型接口重新识别
30104
30118
  conflictLevel = findParsedRegionConflict(parse, address);
30105
- if (!conflictLevel) {
30119
+ if (!(conflictLevel || shouldFallbackToAIWhenEmpty(parse, address))) {
30106
30120
  _context.n = 2;
30107
30121
  break;
30108
30122
  }