Skip to content

Commit aac1b79

Browse files
committed
chore: remove commented-out code and streamline generateImages method
1 parent 8911dec commit aac1b79

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

index.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -107,37 +107,12 @@ export default class UploadPlugin extends AdminForthPlugin {
107107

108108
private async generateImages(jobId: string, prompt: string,requestAttachmentFiles: string[], recordId: any, adminUser: any, headers: any) {
109109
if (this.options.generation.rateLimit?.limit) {
110-
// rate limit
111-
// const { error } = RateLimiter.checkRateLimit(
112-
// this.pluginInstanceId,
113-
// this.options.generation.rateLimit?.limit,
114-
// this.adminforth.auth.getClientIp(headers),
115-
// );
116110
if (!await this.rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
117111
jobs.set(jobId, { status: "failed", error: this.options.generation.rateLimit.errorMessage });
118112
return { error: this.options.generation.rateLimit.errorMessage };
119113
}
120114
}
121115
let attachmentFiles = requestAttachmentFiles;
122-
// if (this.options.generation.attachFiles) {
123-
// // TODO - does it require additional allowed action to check this record id has access to get the image?
124-
// // or should we mention in docs that user should do validation in method itself
125-
// const record = await this.adminforth.resource(this.resourceConfig.resourceId).get(
126-
// [Filters.EQ(this.resourceConfig.columns.find(c => c.primaryKey)?.name, recordId)]
127-
// );
128-
129-
130-
// if (!record) {
131-
// return { error: `Record with id ${recordId} not found` };
132-
// }
133-
134-
// attachmentFiles = await this.options.generation.attachFiles({ record, adminUser });
135-
// // if files is not array, make it array
136-
// if (!Array.isArray(attachmentFiles)) {
137-
// attachmentFiles = [attachmentFiles];
138-
// }
139-
140-
// }
141116

142117
let error: string | undefined = undefined;
143118

0 commit comments

Comments
 (0)