@xsai/shared 0.2.0-beta.3 → 0.2.0-beta.5
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/index.js +5 -12
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -34,19 +34,12 @@ const requestURL = (path, baseURL) => {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
const responseCatch = async (res) => {
|
|
37
|
-
if (!res.ok)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
throw error;
|
|
41
|
-
}
|
|
42
|
-
if (!res.body) {
|
|
37
|
+
if (!res.ok)
|
|
38
|
+
throw new XSAIError(`Remote sent ${res.status} response: ${await res.text()}`, res);
|
|
39
|
+
if (!res.body)
|
|
43
40
|
throw new XSAIError("Response body is empty from remote server", res);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const error = new XSAIError(`Expected Response body to be a ReadableStream, but got ${String(res.body)}`, res);
|
|
47
|
-
error.cause = new Error(`Content-Type is ${res.headers.get("Content-Type")}`);
|
|
48
|
-
throw error;
|
|
49
|
-
}
|
|
41
|
+
if (!(res.body instanceof ReadableStream))
|
|
42
|
+
throw new XSAIError(`Expected Response body to be a ReadableStream, but got ${String(res.body)}; Content Type is ${res.headers.get("Content-Type")}`, res);
|
|
50
43
|
return res;
|
|
51
44
|
};
|
|
52
45
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsai/shared",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.0-beta.
|
|
5
|
-
"description": "extra-small AI SDK
|
|
4
|
+
"version": "0.2.0-beta.5",
|
|
5
|
+
"description": "extra-small AI SDK.",
|
|
6
6
|
"author": "Moeru AI",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"homepage": "https://xsai.js.org",
|