From 8d99c655492a073d2fe485eb7ffee0f93900f6ea Mon Sep 17 00:00:00 2001 From: retrofox Date: Tue, 1 Aug 2023 09:10:21 +0000 Subject: [PATCH] AI Client: remove unused image library (#32127) * [not verified] remove unused image lib * [not verified] changelog Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/5724641991 --- CHANGELOG.md | 3 +++ index.ts | 2 -- src/index.js | 26 -------------------------- 3 files changed, 3 insertions(+), 28 deletions(-) delete mode 100644 src/index.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 64426a5..352d586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ This is an alpha version! The changes listed here are not final. ### Changed - AI Client: handle properly passing the post_id parameter to endpoint +### Removed +- AI Client: remove unused image library + ## 0.1.0 - 2023-07-25 ### Added - Add Jetpack AI Client [#30855] diff --git a/index.ts b/index.ts index ca20320..8e3ffa4 100644 --- a/index.ts +++ b/index.ts @@ -24,5 +24,3 @@ export { default as AIControl } from './src/components/ai-control'; * Contexts */ export * from './src/data-flow'; - -export * from './src/index.js'; diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 98569aa..0000000 --- a/src/index.js +++ /dev/null @@ -1,26 +0,0 @@ -import apiFetch from '@wordpress/api-fetch'; - -/** - * Fetches images from Jetpack AI - * - * It's up to the consumer to catch errors - * - * @param {*} prompt - The prompt to send to Jetpack AI - * @param {*} postId - The post ID where the completion is being requested - * @returns {Promise>} The images - */ -export function requestImages( prompt, postId ) { - return apiFetch( { - path: '/wpcom/v2/jetpack-ai/images/generations', - method: 'POST', - data: { - prompt, - post_id: postId, - }, - } ).then( res => { - const images = res.data.map( image => { - return 'data:image/png;base64,' + image.b64_json; - } ); - return images; - } ); -}