Skip to content

Commit a0c9e13

Browse files
jackshen310shenxiaojie.316
andauthored
add null check for uni.getSystemInfoSync in UniApp user agent (#274)
* fix(coze-js): add null check for uni.getSystemInfoSync in UniApp user agent * chore: Publish fix/uni --------- Co-authored-by: shenxiaojie.316 <shenxiaojie.316@bytedance.com>
1 parent 2e8c5f6 commit a0c9e13

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@coze/api",
5+
"comment": "add null check for uni.getSystemInfoSync in UniApp user agent",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@coze/api",
10+
"email": "shenxiaojie.316@bytedance.com"
11+
}

packages/coze-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coze/api",
3-
"version": "1.3.1",
3+
"version": "1.3.1-beta.1",
44
"description": "Official Coze Node.js SDK for seamless AI integration into your applications | 扣子官方 Node.js SDK,助您轻松集成 AI 能力到应用中",
55
"keywords": [
66
"coze",

packages/coze-js/src/version.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ const getBrowserClientUserAgent = (): string => {
118118
// Get UniApp client user agent
119119
const getUniAppClientUserAgent = (): string => {
120120
// Get system info
121-
121+
if (!uni?.getSystemInfoSync) {
122+
return JSON.stringify({});
123+
}
122124
const systemInfo = uni.getSystemInfoSync();
123125

124126
const platformInfo = {

0 commit comments

Comments
 (0)