aboutsummaryrefslogtreecommitdiff
path: root/src/server/ApiManagers/FireflyManager.ts
diff options
context:
space:
mode:
authorJoanne <zehan_ding@brown.edu>2025-06-20 10:18:38 -0400
committerJoanne <zehan_ding@brown.edu>2025-06-20 10:18:38 -0400
commit61787b3c1cf53c0230f6142bee0df30c65971012 (patch)
tree36c43ca031722b9a92f3f344288c8f6cf7fff5e1 /src/server/ApiManagers/FireflyManager.ts
parent2aa2c26b95a539d220e46b20cdfbef6ae39d6c43 (diff)
parente7a96fa043cfc9c3c426e09bbef42c8df88a45f6 (diff)
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/server/ApiManagers/FireflyManager.ts')
-rw-r--r--src/server/ApiManagers/FireflyManager.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/server/ApiManagers/FireflyManager.ts b/src/server/ApiManagers/FireflyManager.ts
index e934e635b..6393a1f74 100644
--- a/src/server/ApiManagers/FireflyManager.ts
+++ b/src/server/ApiManagers/FireflyManager.ts
@@ -23,7 +23,16 @@ export default class FireflyManager extends ApiManager {
return undefined;
});
- generateImageFromStructure = (prompt: string = 'a realistic illustration of a cat coding', width: number = 2048, height: number = 2048, structureUrl: string, strength: number = 50, styles: string[], styleUrl: string | undefined) =>
+ generateImageFromStructure = (
+ prompt: string = 'a realistic illustration of a cat coding',
+ width: number = 2048,
+ height: number = 2048,
+ structureUrl: string,
+ strength: number = 50,
+ styles: string[],
+ styleUrl: string | undefined,
+ variations: number = 4
+ ) =>
this.getBearerToken().then(response =>
response?.json().then((data: { access_token: string }) =>
//prettier-ignore
@@ -37,7 +46,7 @@ export default class FireflyManager extends ApiManager {
],
body: JSON.stringify({
prompt,
- numVariations: 4,
+ numVariations: variations,
detailLevel: 'preview',
modelVersion: 'image3_fast',
size: { width, height },
@@ -107,10 +116,7 @@ export default class FireflyManager extends ApiManager {
});
generateImage = (prompt: string = 'a realistic illustration of a cat coding', width: number = 2048, height: number = 2048, seed?: number) => {
- let body = `{ "prompt": "${prompt}", "size": { "width": ${width}, "height": ${height}} }`;
- if (seed) {
- body = `{ "prompt": "${prompt}", "size": { "width": ${width}, "height": ${height}}, "seeds": [${seed}]}`;
- }
+ const body = `{ "prompt": "${prompt}", "size": { "width": ${width}, "height": ${height}} ${seed ? ', "seeds": [' + seed + ']' : ''}}`;
const fetched = this.getBearerToken().then(response =>
response?.json().then((data: { access_token: string }) =>
fetch('https://firefly-api.adobe.io/v3/images/generate', {