@blocklet/aigne-hub 0.3.19 → 0.3.20
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/lib/cjs/api/ai-kit.js +3 -2
- package/lib/esm/api/ai-kit.js +3 -2
- package/package.json +1 -1
package/lib/cjs/api/ai-kit.js
CHANGED
|
@@ -30,7 +30,7 @@ const createTextCompletionApi = ({ fetch, path, timeout, headers = {}, }) => asy
|
|
|
30
30
|
})
|
|
31
31
|
: fetch(path, {
|
|
32
32
|
method: 'POST',
|
|
33
|
-
headers: { 'Content-Type': 'application/json' },
|
|
33
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
34
34
|
body: JSON.stringify(options),
|
|
35
35
|
})
|
|
36
36
|
.then((res) => res.json())
|
|
@@ -48,8 +48,9 @@ const createTextCompletionApi = ({ fetch, path, timeout, headers = {}, }) => asy
|
|
|
48
48
|
};
|
|
49
49
|
exports.createTextCompletionApi = createTextCompletionApi;
|
|
50
50
|
const createImageGenerationApi = ({ axios, path, }) => async (options) => {
|
|
51
|
+
var _a;
|
|
51
52
|
return axios
|
|
52
|
-
.post(path, options)
|
|
53
|
+
.post(path, options, { headers: { 'x-aigne-hub-client-did': (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.appPid } })
|
|
53
54
|
.then((res) => res.data)
|
|
54
55
|
.catch(processResponseError);
|
|
55
56
|
};
|
package/lib/esm/api/ai-kit.js
CHANGED
|
@@ -26,7 +26,7 @@ export const createTextCompletionApi = ({ fetch, path, timeout, headers = {}, })
|
|
|
26
26
|
})
|
|
27
27
|
: fetch(path, {
|
|
28
28
|
method: 'POST',
|
|
29
|
-
headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
30
30
|
body: JSON.stringify(options),
|
|
31
31
|
})
|
|
32
32
|
.then((res) => res.json())
|
|
@@ -43,8 +43,9 @@ export const createTextCompletionApi = ({ fetch, path, timeout, headers = {}, })
|
|
|
43
43
|
]);
|
|
44
44
|
};
|
|
45
45
|
export const createImageGenerationApi = ({ axios, path, }) => async (options) => {
|
|
46
|
+
var _a;
|
|
46
47
|
return axios
|
|
47
|
-
.post(path, options)
|
|
48
|
+
.post(path, options, { headers: { 'x-aigne-hub-client-did': (_a = window.blocklet) === null || _a === void 0 ? void 0 : _a.appPid } })
|
|
48
49
|
.then((res) => res.data)
|
|
49
50
|
.catch(processResponseError);
|
|
50
51
|
};
|