forked from pinks/eris
Compare commits
1 Commits
main
...
send-origi
Author | SHA1 | Date |
---|---|---|
nameless | 8b5d242865 |
|
@ -37,6 +37,7 @@ interface GenerationJob {
|
|||
replyMessage: Message;
|
||||
workerInstanceKey?: string;
|
||||
progress?: number;
|
||||
asFile?: boolean;
|
||||
}
|
||||
|
||||
export const generationQueue = new Queue<GenerationJob>(db, "jobQueue");
|
||||
|
@ -284,6 +285,7 @@ async function processGenerationJob(
|
|||
replyMessage: state.replyMessage,
|
||||
workerInstanceKey: workerInstance.value.key,
|
||||
startDate,
|
||||
sendOriginal: state.task.params.file,
|
||||
endDate: new Date(),
|
||||
imageKeys,
|
||||
info,
|
||||
|
|
|
@ -18,6 +18,7 @@ interface UploadJob {
|
|||
replyMessage: Message;
|
||||
workerInstanceKey?: string;
|
||||
startDate: Date;
|
||||
sendOriginal: boolean;
|
||||
endDate: Date;
|
||||
imageKeys: Deno.KvKey[];
|
||||
info: SdGenerationInfo;
|
||||
|
@ -71,6 +72,15 @@ export async function processUploadQueue() {
|
|||
if (!imageType) throw new Error("Image has unknown type");
|
||||
size += imageBuffer.byteLength;
|
||||
types.add(imageType.ext);
|
||||
if (state.sendOriginal) {
|
||||
return InputMediaBuilder.document(
|
||||
new InputFile(imageBuffer, `image${idx}.${imageType.ext}`),
|
||||
// if it can fit, add caption for first photo
|
||||
idx === 0 && caption.text.length <= 1024
|
||||
? { caption: caption.text, caption_entities: caption.entities }
|
||||
: undefined,
|
||||
);
|
||||
} else {
|
||||
return InputMediaBuilder.photo(
|
||||
new InputFile(imageBuffer, `image${idx}.${imageType.ext}`),
|
||||
// if it can fit, add caption for first photo
|
||||
|
@ -78,6 +88,7 @@ export async function processUploadQueue() {
|
|||
? { caption: caption.text, caption_entities: caption.entities }
|
||||
: undefined,
|
||||
);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ export interface PngInfo {
|
|||
|
||||
interface PngInfoExtra extends PngInfo {
|
||||
upscale?: number;
|
||||
file?: boolean;
|
||||
}
|
||||
|
||||
export function parsePngInfo(
|
||||
|
@ -113,6 +114,12 @@ export function parsePngInfo(
|
|||
}
|
||||
break;
|
||||
}
|
||||
case "file": {
|
||||
part = "params";
|
||||
const file = value === "true" || value === "1" || value === "yes";
|
||||
params.file = file;
|
||||
break;
|
||||
}
|
||||
case "model":
|
||||
case "modelhash":
|
||||
case "modelname":
|
||||
|
|
Loading…
Reference in New Issue