@bytenew/bn-applet-ui 1.1.80 → 1.1.82

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.
@@ -29085,15 +29085,12 @@ function parseAddressDetail(address, sourceData, originalAddress) {
29085
29085
 
29086
29086
  // ============== 核心解析 ==============
29087
29087
  var detail = detail_parse_forward(address, sourceData);
29088
- console.log('正向解析结果:', JSON.stringify(detail));
29089
29088
  if (!detail.city) {
29090
29089
  detail = detail_parse(address);
29091
- console.log('逆向解析结果:', JSON.stringify(detail));
29092
29090
  if (detail.area && !detail.city) {
29093
29091
  detail = detail_parse(address, {
29094
29092
  ignoreArea: true
29095
29093
  });
29096
- console.log('ignoreArea解析结果:', JSON.stringify(detail));
29097
29094
  }
29098
29095
  }
29099
29096
 
@@ -30056,17 +30053,9 @@ function getDevProxyPrefix() {
30056
30053
  * @param {object} fetchOptions fetch 参数
30057
30054
  * @returns {Promise<{aiResult?: object, failMsg?: string}|null>}
30058
30055
  */
30059
- function requestChat(url, fetchOptions) {
30060
- // 小程序等不支持 fetch 的环境直接跳过,保留本地识别结果
30061
- if (typeof fetch !== 'function') {
30062
- console.warn('当前环境不支持 fetch,无法调用大模型地址识别接口');
30063
- return Promise.resolve(null);
30064
- }
30065
- return fetch(url, fetchOptions).then(function (r) {
30066
- return r.json();
30067
- }).then(parseChatResponse)["catch"](handleChatError);
30056
+ function requestChat(_x, _x2) {
30057
+ return _requestChat.apply(this, arguments);
30068
30058
  }
30069
-
30070
30059
  /**
30071
30060
  * 本地识别错误时,调用大模型接口重新识别
30072
30061
  * 插件端(options.platform === 'plugin'):POST /project/column/addressBychat,请求体 {content: 待识别文本};
@@ -30078,35 +30067,32 @@ function requestChat(url, fetchOptions) {
30078
30067
  * post 为调用方传入的 post 方法 (path, data) => Promise<响应体>,接口前缀与 plugin-token 等鉴权头由宿主项目的 axios 统一处理
30079
30068
  * @returns {Promise<{aiResult?: object, failMsg?: string}|null>}
30080
30069
  */
30081
- function parseAddressByChat(address) {
30082
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
30083
- // 插件端走单独接口:POST /project/column/addressBychat
30084
- if (options.platform === 'plugin') {
30085
- // 优先使用调用方传入的 post(一般是项目 axios 封装),避免组件库内直接 fetch 拼错前缀、缺少鉴权头导致 404
30086
- if (typeof options.post === 'function') {
30087
- return Promise.resolve().then(function () {
30088
- return options.post('/project/column/addressBychat', {
30089
- content: address
30090
- });
30091
- }).then(parseChatResponse)["catch"](handleChatError);
30092
- }
30093
- // 兜底:直连插件网关
30094
- return requestChat(getDevProxyPrefix() + '/gateway/project/column/addressBychat', {
30095
- method: 'POST',
30096
- headers: {
30097
- 'Content-Type': 'application/json'
30098
- },
30099
- body: JSON.stringify({
30100
- content: address
30101
- })
30102
- });
30103
- }
30104
- // 其他端:v2 的 GET 接口
30105
- return requestChat(getDevProxyPrefix() + '/v2/project/column/addressBychat?contents=' + encodeURIComponent(address), {
30106
- method: 'GET'
30107
- });
30070
+ function _requestChat() {
30071
+ _requestChat = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(url, fetchOptions) {
30072
+ return _regenerator().w(function (_context) {
30073
+ while (1) switch (_context.n) {
30074
+ case 0:
30075
+ if (!(typeof fetch !== 'function')) {
30076
+ _context.n = 1;
30077
+ break;
30078
+ }
30079
+ console.warn('当前环境不支持 fetch,无法调用大模型地址识别接口');
30080
+ return _context.a(2, Promise.resolve(null));
30081
+ case 1:
30082
+ _context.n = 2;
30083
+ return fetch(url, fetchOptions).then(function (r) {
30084
+ return r.json();
30085
+ }).then(parseChatResponse)["catch"](handleChatError);
30086
+ case 2:
30087
+ return _context.a(2, _context.v);
30088
+ }
30089
+ }, _callee);
30090
+ }));
30091
+ return _requestChat.apply(this, arguments);
30092
+ }
30093
+ function parseAddressByChat(_x3) {
30094
+ return _parseAddressByChat.apply(this, arguments);
30108
30095
  }
30109
-
30110
30096
  /**
30111
30097
  * 自动识别地址信息,格式化为省市区街道和收件人等信息
30112
30098
  * @param {string} address 原始地址字符串(可含空格、姓名、手机号等)
@@ -30118,11 +30104,57 @@ function parseAddressByChat(address) {
30118
30104
  * AI 识别成功则用其结果覆盖省市区等字段,msg 为「自动识别错误,已使用ai重新识别」;
30119
30105
  * AI 识别失败则保留原识别内容,msg 为「自动识别错误,ai识别结果+接口msg」
30120
30106
  */
30121
- function addressParse(_x, _x2) {
30107
+ function _parseAddressByChat() {
30108
+ _parseAddressByChat = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(address) {
30109
+ var options,
30110
+ _args2 = arguments;
30111
+ return _regenerator().w(function (_context2) {
30112
+ while (1) switch (_context2.n) {
30113
+ case 0:
30114
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
30115
+ if (!(options.platform === 'plugin')) {
30116
+ _context2.n = 3;
30117
+ break;
30118
+ }
30119
+ if (!(typeof options.post === 'function')) {
30120
+ _context2.n = 1;
30121
+ break;
30122
+ }
30123
+ return _context2.a(2, Promise.resolve().then(function () {
30124
+ return options.post('/project/column/addressBychat', {
30125
+ content: address
30126
+ });
30127
+ }).then(parseChatResponse)["catch"](handleChatError));
30128
+ case 1:
30129
+ _context2.n = 2;
30130
+ return requestChat(getDevProxyPrefix() + '/gateway/project/column/addressBychat', {
30131
+ method: 'POST',
30132
+ headers: {
30133
+ 'Content-Type': 'application/json'
30134
+ },
30135
+ body: JSON.stringify({
30136
+ content: address
30137
+ })
30138
+ });
30139
+ case 2:
30140
+ return _context2.a(2, _context2.v);
30141
+ case 3:
30142
+ _context2.n = 4;
30143
+ return requestChat(getDevProxyPrefix() + '/v2/project/column/addressBychat?contents=' + encodeURIComponent(address), {
30144
+ method: 'GET'
30145
+ });
30146
+ case 4:
30147
+ return _context2.a(2, _context2.v);
30148
+ }
30149
+ }, _callee2);
30150
+ }));
30151
+ return _parseAddressByChat.apply(this, arguments);
30152
+ }
30153
+ function addressParse(_x4, _x5) {
30122
30154
  return _addressParse.apply(this, arguments);
30123
30155
  }
30124
30156
  function _addressParse() {
30125
- _addressParse = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(address, sourceData) {
30157
+ _addressParse = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address, sourceData) {
30126
30158
  var options,
30127
30159
  list,
30128
30160
  cleanAddress,
@@ -30130,11 +30162,11 @@ function _addressParse() {
30130
30162
  conflictLevel,
30131
30163
  chatResult,
30132
30164
  aiResult,
30133
- _args = arguments;
30134
- return _regenerator().w(function (_context) {
30135
- while (1) switch (_context.n) {
30165
+ _args3 = arguments;
30166
+ return _regenerator().w(function (_context3) {
30167
+ while (1) switch (_context3.n) {
30136
30168
  case 0:
30137
- options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
30169
+ options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
30138
30170
  list = getGlobalAreaList(options);
30139
30171
  if (list) {
30140
30172
  parseArea(list);
@@ -30144,13 +30176,15 @@ function _addressParse() {
30144
30176
  // 省市区识别全为空但输入中出现省市区等行政区划文字时,同样调用大模型接口重新识别
30145
30177
  conflictLevel = findParsedRegionConflict(parse, address);
30146
30178
  if (!(conflictLevel || shouldFallbackToAIWhenEmpty(parse, address))) {
30147
- _context.n = 2;
30179
+ _context3.n = 2;
30148
30180
  break;
30149
30181
  }
30150
- _context.n = 1;
30182
+ _context3.n = 1;
30151
30183
  return parseAddressByChat(address, options);
30152
30184
  case 1:
30153
- chatResult = _context.v;
30185
+ chatResult = _context3.v;
30186
+ console.log("33333333");
30187
+ console.log(chatResult);
30154
30188
  if (chatResult && chatResult.aiResult) {
30155
30189
  aiResult = chatResult.aiResult;
30156
30190
  parse.name = aiResult.name || '';
@@ -30168,9 +30202,9 @@ function _addressParse() {
30168
30202
  parse.msg = '自动识别错误,ai识别结果' + chatResult.failMsg;
30169
30203
  }
30170
30204
  case 2:
30171
- return _context.a(2, parse);
30205
+ return _context3.a(2, parse);
30172
30206
  }
30173
- }, _callee);
30207
+ }, _callee3);
30174
30208
  }));
30175
30209
  return _addressParse.apply(this, arguments);
30176
30210
  }