Skip to content

Commit 75c6d7f

Browse files
committed
APIAuto: 解决 AI 功能部署后报错 crypto is undefined,因为只支持 https
1 parent ff995a4 commit 75c6d7f

File tree

1 file changed

+12
-1
lines changed
  • APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js

1 file changed

+12
-1
lines changed

APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static/api/js/main.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7660,7 +7660,18 @@ Content-Type: ` + contentType) + (StringUtil.isEmpty(headerStr, true) ? '' : hea
76607660

76617661
// 可能少调用了 https://api2.amplitude.com/2/httpapi 导致不能同一个会话二次请求
76627662
// if (StringUtil.isEmpty(this.uuid, true)) {
7663-
this.uuid = crypto.randomUUID();
7663+
try {
7664+
this.uuid = crypto.randomUUID();
7665+
} catch (e) {
7666+
console.error('Failed to generate UUID:', e);
7667+
}
7668+
7669+
if (StringUtil.isEmpty(this.uuid, true)) {
7670+
this.uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
7671+
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
7672+
return v.toString(16);
7673+
});
7674+
}
76647675
// }
76657676

76667677
this.request(true, REQUEST_TYPE_POST, REQUEST_TYPE_JSON, 'https://api.devin.ai/ada/query', {

0 commit comments

Comments
 (0)