diff options
Diffstat (limited to 'src/server/ApiManagers/FireflyManager.ts')
-rw-r--r-- | src/server/ApiManagers/FireflyManager.ts | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/src/server/ApiManagers/FireflyManager.ts b/src/server/ApiManagers/FireflyManager.ts index 55fa1e461..d9a1ef621 100644 --- a/src/server/ApiManagers/FireflyManager.ts +++ b/src/server/ApiManagers/FireflyManager.ts @@ -14,30 +14,8 @@ export default class FireflyManager extends ApiManager { console.error('Error:', error); return ''; }); - // askFirefly = (prompt: string = 'a realistic illustration of a cat coding') => { - // const fetched = this.getBearerToken().then(response => - // response.json().then((data: { access_token: string }) => - // fetch('https://firefly-api.adobe.io/v3/images/generate', { - // method: 'POST', - // headers: [ - // ['Content-Type', 'application/json'], - // ['Accept', 'application/json'], - // ['x-api-key', process.env._CLIENT_FIREFLY_CLIENT_ID ?? ''], - // ['Authorization', `Bearer ${data.access_token}`], - // ], - // body: `{ "prompt": "${prompt}" }`, - // }) - // .then(response => response.json().then(json => JSON.stringify((json.outputs?.[0] as { image: { url: string } })?.image))) - // .catch(error => { - // console.error('Error:', error); - // return ''; - // }) - // ) - // ); - // return fetched; - // }; - askFirefly = (prompt: string = 'a realistic illustration of a cat coding', uploadId: string, strength: number) => { + askFireflyOld = (prompt: string = 'a realistic illustration of a cat coding', uploadId: string, strength: number) => { const fetched = this.getBearerToken().then(response => response.json().then((data: { access_token: string }) => { const body: any = { @@ -97,11 +75,11 @@ export default class FireflyManager extends ApiManager { protected initialize(register: Registration): void { register({ method: Method.POST, - subscription: '/queryFireflyImage', + subscription: '/oldQueryFireflyImage', secureHandler: async ({ req, res }) => { const { prompt, imageBlob, strength = 0.5 } = req.body; const uploadId = imageBlob ? await this.uploadImageToFirefly(imageBlob) : null; - this.askFirefly(prompt, uploadId, strength).then(fire => + this.askFireflyOld(prompt, uploadId, strength).then(fire => DashUploadUtils.UploadImage(JSON.parse(fire).url).then(info => { if (info instanceof Error) _invalid(res, info.message); else _success(res, info.accessPaths.agnostic.client); |