@bytenew/bn-applet-ui 1.1.81 → 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.
package/dist/bn-applet-ui.umd.js
CHANGED
|
@@ -30071,17 +30071,9 @@ function getDevProxyPrefix() {
|
|
|
30071
30071
|
* @param {object} fetchOptions fetch 参数
|
|
30072
30072
|
* @returns {Promise<{aiResult?: object, failMsg?: string}|null>}
|
|
30073
30073
|
*/
|
|
30074
|
-
function requestChat(
|
|
30075
|
-
|
|
30076
|
-
if (typeof fetch !== 'function') {
|
|
30077
|
-
console.warn('当前环境不支持 fetch,无法调用大模型地址识别接口');
|
|
30078
|
-
return Promise.resolve(null);
|
|
30079
|
-
}
|
|
30080
|
-
return fetch(url, fetchOptions).then(function (r) {
|
|
30081
|
-
return r.json();
|
|
30082
|
-
}).then(parseChatResponse)["catch"](handleChatError);
|
|
30074
|
+
function requestChat(_x, _x2) {
|
|
30075
|
+
return _requestChat.apply(this, arguments);
|
|
30083
30076
|
}
|
|
30084
|
-
|
|
30085
30077
|
/**
|
|
30086
30078
|
* 本地识别错误时,调用大模型接口重新识别
|
|
30087
30079
|
* 插件端(options.platform === 'plugin'):POST /project/column/addressBychat,请求体 {content: 待识别文本};
|
|
@@ -30093,35 +30085,32 @@ function requestChat(url, fetchOptions) {
|
|
|
30093
30085
|
* post 为调用方传入的 post 方法 (path, data) => Promise<响应体>,接口前缀与 plugin-token 等鉴权头由宿主项目的 axios 统一处理
|
|
30094
30086
|
* @returns {Promise<{aiResult?: object, failMsg?: string}|null>}
|
|
30095
30087
|
*/
|
|
30096
|
-
function
|
|
30097
|
-
|
|
30098
|
-
|
|
30099
|
-
|
|
30100
|
-
|
|
30101
|
-
|
|
30102
|
-
|
|
30103
|
-
|
|
30104
|
-
|
|
30105
|
-
|
|
30106
|
-
|
|
30107
|
-
|
|
30108
|
-
|
|
30109
|
-
|
|
30110
|
-
|
|
30111
|
-
|
|
30112
|
-
|
|
30113
|
-
|
|
30114
|
-
|
|
30115
|
-
|
|
30116
|
-
|
|
30117
|
-
|
|
30118
|
-
|
|
30119
|
-
|
|
30120
|
-
return
|
|
30121
|
-
method: 'GET'
|
|
30122
|
-
});
|
|
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);
|
|
30123
30113
|
}
|
|
30124
|
-
|
|
30125
30114
|
/**
|
|
30126
30115
|
* 自动识别地址信息,格式化为省市区街道和收件人等信息
|
|
30127
30116
|
* @param {string} address 原始地址字符串(可含空格、姓名、手机号等)
|
|
@@ -30133,11 +30122,57 @@ function parseAddressByChat(address) {
|
|
|
30133
30122
|
* AI 识别成功则用其结果覆盖省市区等字段,msg 为「自动识别错误,已使用ai重新识别」;
|
|
30134
30123
|
* AI 识别失败则保留原识别内容,msg 为「自动识别错误,ai识别结果+接口msg」
|
|
30135
30124
|
*/
|
|
30136
|
-
function
|
|
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) {
|
|
30137
30172
|
return _addressParse.apply(this, arguments);
|
|
30138
30173
|
}
|
|
30139
30174
|
function _addressParse() {
|
|
30140
|
-
_addressParse = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
30175
|
+
_addressParse = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(address, sourceData) {
|
|
30141
30176
|
var options,
|
|
30142
30177
|
list,
|
|
30143
30178
|
cleanAddress,
|
|
@@ -30145,11 +30180,11 @@ function _addressParse() {
|
|
|
30145
30180
|
conflictLevel,
|
|
30146
30181
|
chatResult,
|
|
30147
30182
|
aiResult,
|
|
30148
|
-
|
|
30149
|
-
return _regenerator().w(function (
|
|
30150
|
-
while (1) switch (
|
|
30183
|
+
_args3 = arguments;
|
|
30184
|
+
return _regenerator().w(function (_context3) {
|
|
30185
|
+
while (1) switch (_context3.n) {
|
|
30151
30186
|
case 0:
|
|
30152
|
-
options =
|
|
30187
|
+
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
|
|
30153
30188
|
list = getGlobalAreaList(options);
|
|
30154
30189
|
if (list) {
|
|
30155
30190
|
parseArea(list);
|
|
@@ -30159,13 +30194,13 @@ function _addressParse() {
|
|
|
30159
30194
|
// 省市区识别全为空但输入中出现省市区等行政区划文字时,同样调用大模型接口重新识别
|
|
30160
30195
|
conflictLevel = findParsedRegionConflict(parse, address);
|
|
30161
30196
|
if (!(conflictLevel || shouldFallbackToAIWhenEmpty(parse, address))) {
|
|
30162
|
-
|
|
30197
|
+
_context3.n = 2;
|
|
30163
30198
|
break;
|
|
30164
30199
|
}
|
|
30165
|
-
|
|
30200
|
+
_context3.n = 1;
|
|
30166
30201
|
return parseAddressByChat(address, options);
|
|
30167
30202
|
case 1:
|
|
30168
|
-
chatResult =
|
|
30203
|
+
chatResult = _context3.v;
|
|
30169
30204
|
console.log("33333333");
|
|
30170
30205
|
console.log(chatResult);
|
|
30171
30206
|
if (chatResult && chatResult.aiResult) {
|
|
@@ -30185,9 +30220,9 @@ function _addressParse() {
|
|
|
30185
30220
|
parse.msg = '自动识别错误,ai识别结果' + chatResult.failMsg;
|
|
30186
30221
|
}
|
|
30187
30222
|
case 2:
|
|
30188
|
-
return
|
|
30223
|
+
return _context3.a(2, parse);
|
|
30189
30224
|
}
|
|
30190
|
-
},
|
|
30225
|
+
}, _callee3);
|
|
30191
30226
|
}));
|
|
30192
30227
|
return _addressParse.apply(this, arguments);
|
|
30193
30228
|
}
|