@xsai/model 0.0.22 → 0.0.24

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 +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import { requestHeaders } from '@xsai/shared';
1
+ import { requestURL, requestHeaders, responseJSON } from '@xsai/shared';
2
2
 
3
- const listModels = async (options) => await (options.fetch ?? globalThis.fetch)(new URL("models", options.baseURL), {
3
+ const listModels = async (options) => await (options.fetch ?? globalThis.fetch)(requestURL("models", options.baseURL), {
4
4
  headers: requestHeaders({
5
5
  "Content-Type": "application/json",
6
6
  ...options.headers
7
7
  }, options.apiKey),
8
8
  signal: options.abortSignal
9
- }).then((res) => res.json()).then(({ data }) => data);
9
+ }).then(responseJSON).then(({ data }) => data);
10
10
 
11
- const retrieveModel = async (options) => await (options.fetch ?? globalThis.fetch)(new URL(`models/${options.model}`, options.baseURL), {
11
+ const retrieveModel = async (options) => await (options.fetch ?? globalThis.fetch)(requestURL(`models/${options.model}`, options.baseURL), {
12
12
  headers: requestHeaders({
13
13
  "Content-Type": "application/json",
14
14
  ...options.headers
15
15
  }, options.apiKey),
16
16
  signal: options.abortSignal
17
- }).then((res) => res.json());
17
+ }).then(responseJSON);
18
18
 
19
19
  export { listModels, retrieveModel };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xsai/model",
3
- "version": "0.0.22",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "author": "Moeru AI",
6
6
  "license": "MIT",