koishi-plugin-nitter 0.0.3 → 0.0.4

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.
Files changed (2) hide show
  1. package/lib/index.js +8 -1
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -109,7 +109,14 @@ ${JSON.stringify(texts)}`
109
109
  if (response.data && response.data.choices && response.data.choices[0]) {
110
110
  const content = response.data.choices[0].message.content;
111
111
  data = JSON.parse(content);
112
- if (!Array.isArray(data)) throw new Error("模型未返回数组");
112
+ if (!Array.isArray(data)) {
113
+ if (typeof data === "object" && Object.keys(data).length === 1) {
114
+ const keys = Object.keys(data);
115
+ if (!Array.isArray(data[keys[0]]))
116
+ throw new Error("API返回数据格式异常");
117
+ data = data[keys[0]];
118
+ } else throw new Error("API返回数据格式异常");
119
+ }
113
120
  } else {
114
121
  throw new Error("API返回数据格式异常");
115
122
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-nitter",
3
3
  "description": "使用Rettiwt-API订阅推文,并使用nitter渲染",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
@@ -19,7 +19,7 @@
19
19
  "axios": "^1.12.2",
20
20
  "https-proxy-agent": "^7.0.6",
21
21
  "koishi": "^4.18.9",
22
- "koishi-plugin-subscription": "^0.0.1",
22
+ "koishi-plugin-subscription": "^0.0.5",
23
23
  "node-cron": "^4.2.1",
24
24
  "rettiwt-api": "^6.0.6"
25
25
  }