PR #24

Merged
pinks merged 11 commits from nameless/eris:pr-main into main 2023-11-17 18:00:14 +00:00
Collaborator

a bunch of stuff

  • changes txt2img seed behavior
  • resolves pinks/eris#21 using other metadata reader (also this commit extends pnginfo support to jpeg)
  • admin priority (in case if admin needs to demonstrate something for user)
  • some fixes for webui/api
  • probably resolves pinks/eris#18 as well (8ced57c175)
  • userdailystats is implemented
a bunch of stuff - changes txt2img seed behavior - resolves pinks/eris#21 using other metadata reader (also this commit extends pnginfo support to jpeg) - admin priority (in case if admin needs to demonstrate something for user) - some fixes for webui/api - probably resolves pinks/eris#18 as well (8ced57c175) - userdailystats is implemented
nameless added 10 commits 2023-11-11 01:31:43 +00:00
f4e7b5e1a7 change txt2img seed behaviour
will ignore seed only on /txt2img or new requests
73810d3204 fix: use exifreader for png info
- replace pnginfo module
- allow jpeg for tag extraction
- rename pnginfo to getprompt
ac63e39373 feat: admin priority
ignore queue limits and assign higher priority on admin jobs
84ad11b709 refactor: webui adjustments
- remove unnecessary margin in admins and workers page
- use rounded-md instead of rounded-xl for queue page
- output "No worker/admin/jobs" as item in a list
af7b370321 feat: tagcount endpoint
removes tagCountMap from user endpoint, returns it only via admin-only endpoint
pinks requested changes 2023-11-11 14:08:03 +00:00
@ -23,0 +26,4 @@
for await (
const generation of generationStore.listBy("fromId", {
before: new Date(new Date(year, month - 1, day).getTime() + 24 * 60 * 60 * 1000),
Owner

You need to use Date.UTC or UTCDateMini here. Otherwise it will return midnight but in local timezone.

For example:

    after: new Date(Date.UTC(year, month - 1, day)),
    before: new Date(Date.UTC(year, month - 1, day + 1)), // days will overflow into months
You need to use `Date.UTC` or `UTCDateMini` here. Otherwise it will return midnight but in local timezone. For example: ```js after: new Date(Date.UTC(year, month - 1, day)), before: new Date(Date.UTC(year, month - 1, day + 1)), // days will overflow into months ```
nameless marked this conversation as resolved
bot/mod.ts Outdated
@ -161,3 +161,3 @@
bot.use(img2imgQuestion.middleware());
bot.command("pnginfo", pnginfoCommand);
bot.command("getprompt", pnginfoCommand);
Owner

Can we change it to imginfo? Also change all the function names if we do. Or leave the name as is

Can we change it to `imginfo`? Also change all the function names if we do. Or leave the name as is
Author
Collaborator

leaving it as it is, will rename everything in future PR

leaving it as it is, will rename everything in future PR
@ -7,3 +3,1 @@
.map((chunk) => decode(chunk.data))
.find((textChunk) => textChunk.keyword === "parameters")
?.text;
export function getPngInfo(pngData: ArrayBuffer): string | undefined {
Owner

I don't like as here. How about:

export function getImageInfo(imageData: ArrayBuffer): string | undefined {
  const info = ExifReader.load(imageData);

  if (info.UserComment?.value && Array.isArray(info.UserComment.value)) {
    // JPEG image
    return String.fromCharCode(
      ...info.UserComment.value
        .filter((char): char is number => typeof char == "number")
        .filter((char) => char !== 0),
    ).replace("UNICODE", "");
  }

  if (info.parameters?.description) {
    // PNG image
    return info.parameters.description;
  }

  // Unknown image type
  return undefined;
}
I don't like `as` here. How about: ```ts export function getImageInfo(imageData: ArrayBuffer): string | undefined { const info = ExifReader.load(imageData); if (info.UserComment?.value && Array.isArray(info.UserComment.value)) { // JPEG image return String.fromCharCode( ...info.UserComment.value .filter((char): char is number => typeof char == "number") .filter((char) => char !== 0), ).replace("UNICODE", ""); } if (info.parameters?.description) { // PNG image return info.parameters.description; } // Unknown image type return undefined; } ```
nameless marked this conversation as resolved
@ -23,3 +23,3 @@
if (document?.mime_type !== "image/png") {
if (document?.mime_type !== "image/png" && document?.mime_type !== "image/jpeg") {
await ctx.reply(
"Please send me a PNG file." +
Owner

"Please send me a PNG or JPEG file."

"Please send me a PNG or JPEG file."
nameless marked this conversation as resolved
@ -38,3 +38,3 @@
const file = await ctx.api.getFile(document.file_id);
const buffer = await fetch(file.getUrl()).then((resp) => resp.arrayBuffer());
const params = parsePngInfo(getPngInfo(new Uint8Array(buffer)) ?? "");
const params = parsePngInfo(getPngInfo(buffer) ?? "Nothing found.", undefined, true);
Owner

Maybe split it in 3 lines:

const info = getPngInfo(buffer);
if (!info) return await ctx.reply("No info found in file.", {...});
const params = parsePngInfo(info, undefined, true);
Maybe split it in 3 lines: ```js const info = getPngInfo(buffer); if (!info) return await ctx.reply("No info found in file.", {...}); const params = parsePngInfo(info, undefined, true); ```
nameless marked this conversation as resolved
@ -57,2 +57,3 @@
: getAdmins.data?.length === 0
? <p>No admins</p>
? (
<li className="flex flex-col gap-2 rounded-md bg-zinc-100 dark:bg-zinc-800 p-2">
Owner

li outside of ul?

`li` outside of `ul`?
nameless marked this conversation as resolved
@ -40,2 +40,3 @@
: getWorkers.data?.length === 0
? <p>No workers</p>
? (
<li className="flex flex-col gap-2 rounded-md bg-zinc-100 dark:bg-zinc-800 p-2">
Owner

li without ul

`li` without `ul`
nameless marked this conversation as resolved
nameless added 1 commit 2023-11-12 02:33:38 +00:00
nameless requested review from pinks 2023-11-12 02:48:59 +00:00
pinks approved these changes 2023-11-17 17:48:55 +00:00
pinks merged commit 2f62c17e32 into main 2023-11-17 18:00:14 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pinks/eris#24
No description provided.