@xsai/generate-image 0.5.0-beta.4 → 0.5.0-beta.6

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/dist/index.js +2 -10
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { requestURL, requestHeaders, requestBody, responseCatch, responseJSON } from '@xsai/shared';
1
+ import { postJSON, responseJSON, responseCatch } from '@xsai/shared';
2
2
 
3
3
  const mimeTypes = {
4
4
  "/9j/": "image/jpg",
@@ -28,15 +28,7 @@ const responseBlobAsDataURL = async (res) => responseCatch(res).then(async (res2
28
28
  throw new Error(`Failed to parse response blob, response URL: ${res2.url}`);
29
29
  }
30
30
  });
31
- const generateImage = async (options) => (options.fetch ?? globalThis.fetch)(requestURL("images/generations", options.baseURL), {
32
- body: requestBody(options),
33
- headers: requestHeaders({
34
- "Content-Type": "application/json",
35
- ...options.headers
36
- }, options.apiKey),
37
- method: "POST",
38
- signal: options.abortSignal
39
- }).then(responseCatch).then(responseJSON).then(
31
+ const generateImage = async (options) => postJSON("images/generations", options).then(responseJSON).then(
40
32
  async ({ data }) => Promise.all(
41
33
  data.map(async (img, i) => {
42
34
  if (typeof img.b64_json === "string") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xsai/generate-image",
3
3
  "type": "module",
4
- "version": "0.5.0-beta.4",
4
+ "version": "0.5.0-beta.6",
5
5
  "description": "extra-small AI SDK.",
6
6
  "author": "Moeru AI",
7
7
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@xsai/shared": "0.5.0-beta.4"
32
+ "@xsai/shared": "0.5.0-beta.6"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "pkgroll"