adds dall-e full history page and metadata downloader

This commit is contained in:
nai-degen
2024-03-10 14:53:11 -05:00
parent 37f17ded60
commit 7610369c6d
15 changed files with 199 additions and 12 deletions
+13
View File
@@ -14,6 +14,7 @@ import {
UserSchema,
UserTokenCounts,
} from "../../shared/users/schema";
import { getLastNImages } from "../../shared/file-storage/image-history";
const router = Router();
@@ -221,6 +222,18 @@ router.post("/maintenance", (req, res) => {
flash.message = `All users' token usage records reset.`;
break;
}
case "downloadImageMetadata": {
const data = JSON.stringify({
exportedAt: new Date().toISOString(),
generations: getLastNImages()
}, null, 2);
res.setHeader(
"Content-Disposition",
`attachment; filename=image-metadata-${new Date().toISOString()}.json`
);
res.setHeader("Content-Type", "application/json");
return res.send(data);
}
default: {
throw new HttpError(400, "Invalid action");
}
+7
View File
@@ -50,6 +50,13 @@
</p>
</fieldset>
<% } %>
<% if (imageGenerationEnabled) { %>
<fieldset>
<legend>Image Generation</legend>
<button id="download-image-metadata" type="button" onclick="submitForm('downloadImageMetadata')">Download Image Metadata</button>
<label for="download-image-metadata">Downloads a metadata file containing URL, prompt, and truncated user token for all cached images.</label>
</fieldset>
<% } %>
</div>
</form>
+1 -1
View File
@@ -6,7 +6,7 @@
<% } else { %>
<input type="checkbox" id="toggle-nicknames" onchange="toggleNicknames()" />
<label for="toggle-nicknames">Show Nicknames</label>
<table>
<table class="striped">
<thead>
<tr>
<th>User</th>