aboutsummaryrefslogtreecommitdiff
path: root/src
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
parente7162baa77a851d73037c63b75fac6a5c07f9b61 (diff)
preparing to merge
Diffstat (limited to 'src')
-rw-r--r--src/client/views/smartdraw/DrawingFillHandler.tsx6
-rw-r--r--src/server/ApiManagers/FireflyManager.ts28
2 files changed, 6 insertions, 28 deletions
diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx
index 8f71b150d..6f111e95b 100644
--- a/src/client/views/smartdraw/DrawingFillHandler.tsx
+++ b/src/client/views/smartdraw/DrawingFillHandler.tsx
@@ -23,9 +23,9 @@
// const response = await fetch(hrefComplete);
// const blob: Blob = await response.blob();
// const strength: number = 100;
-// const img = await Networking.PostToServer('/queryFireflyImage', { prompt, blob, strength });
+// const img = await Networking.PostToServer('/oldQueryFireflyImage', { prompt, blob, strength });
// DocumentViewInternal.addDocTabFunc(Docs.Create.ImageDocument(img, {}), OpenWhere.addRight);
-// // Networking.PostToServer('/queryFireflyImage', { prompt, blob, strength }).then(img => DocumentViewInternal.addDocTabFunc(Docs.Create.ImageDocument(img, {}), OpenWhere.addRight));
+// // Networking.PostToServer('/oldQueryFireflyImage', { prompt, blob, strength }).then(img => DocumentViewInternal.addDocTabFunc(Docs.Create.ImageDocument(img, {}), OpenWhere.addRight));
// } catch (error) {
// console.error('Error fetching image:', error);
// return;
@@ -44,7 +44,7 @@
// // ctx.drawImage(image, 0, 0);
// // const blob: Blob = await ImageUtility.canvasToBlob(canvas);
// // const strength: number = 100;
-// // Networking.PostToServer('/queryFireflyImage', { prompt, blob, strength }).then(img => DocumentViewInternal.addDocTabFunc(Docs.Create.ImageDocument(img, {}), OpenWhere.addRight));
+// // Networking.PostToServer('/oldQueryFireflyImage', { prompt, blob, strength }).then(img => DocumentViewInternal.addDocTabFunc(Docs.Create.ImageDocument(img, {}), OpenWhere.addRight));
// // };
// };
// }
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);