diff --git a/common/changes/@coze/taro-api/fix-taro-timeout_2025-03-17-09-16.json b/common/changes/@coze/taro-api/fix-taro-timeout_2025-03-17-09-16.json new file mode 100644 index 00000000..0b9dbf4b --- /dev/null +++ b/common/changes/@coze/taro-api/fix-taro-timeout_2025-03-17-09-16.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@coze/taro-api", + "comment": "taro adapter timeout", + "type": "patch" + } + ], + "packageName": "@coze/taro-api", + "email": "yjfengwen@foxmail.com" +} diff --git a/packages/coze-taro/package.json b/packages/coze-taro/package.json index 6076a3aa..5acbcce3 100644 --- a/packages/coze-taro/package.json +++ b/packages/coze-taro/package.json @@ -1,6 +1,6 @@ { "name": "@coze/taro-api", - "version": "0.0.7-beta.1", + "version": "0.0.7-beta.2", "description": "Official Coze Taro SDK for seamless AI integration into your applications | 扣子官方 Taro SDK,助您轻松集成 AI 能力到应用中", "keywords": [ "coze", @@ -61,4 +61,4 @@ "module": "dist/index.js", "types": "dist/index.d.ts" } -} +} \ No newline at end of file diff --git a/packages/coze-taro/src/api.ts b/packages/coze-taro/src/api.ts index 1d3fd6e8..02de02f3 100644 --- a/packages/coze-taro/src/api.ts +++ b/packages/coze-taro/src/api.ts @@ -50,7 +50,7 @@ export class CozeAPI extends InnerCozeAPI { } const taroAdapter: AxiosAdapter = config => { - const { url, method, data, headers } = config; + const { url, method, data, headers, timeout } = config; const header = typeof headers.toJSON === 'function' ? headers.toJSON() : headers; header['Content-Type'] = header['Content-Type'] || 'application/json'; @@ -61,6 +61,7 @@ export class CozeAPI extends InnerCozeAPI { method: (method ?? 'GET').toUpperCase(), data, header, + timeout, success: res => { // Request failed if (res.statusCode !== 200 || res.data?.code) {