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