aboutsummaryrefslogtreecommitdiff
path: root/src/server/ApiManagers/FireflyManager.ts
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-12-14 14:27:03 -0500
committerbobzel <zzzman@gmail.com>2024-12-14 14:27:03 -0500
commit0034a4b7d1bbaf5c6909d76b1a2dac85054fa4ff (patch)
tree99c962272375d9eb14a2d675c7ce1fd833488439 /src/server/ApiManagers/FireflyManager.ts
parente7162baa77a851d73037c63b75fac6a5c07f9b61 (diff)
preparing to merge
Diffstat (limited to 'src/server/ApiManagers/FireflyManager.ts')
-rw-r--r--src/server/ApiManagers/FireflyManager.ts28
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);