adds input prompt to imagehistory

This commit is contained in:
nai-degen 2024-03-10 15:08:44 -05:00
parent e1fb53b461
commit eb55f30414
2 changed files with 11 additions and 2 deletions

View File

@ -2,7 +2,12 @@ const IMAGE_HISTORY_SIZE = 10000;
const imageHistory = new Array<ImageHistory>(IMAGE_HISTORY_SIZE);
let index = 0;
type ImageHistory = { url: string; prompt: string, token?: string };
type ImageHistory = {
url: string;
prompt: string;
inputPrompt: string;
token?: string;
};
export function addToImageHistory(image: ImageHistory) {
if (image.token?.length) {

View File

@ -68,7 +68,11 @@ export async function mirrorGeneratedImage(
}
item.url = `${host}/user_content/${path.basename(mirror)}`;
await createThumbnail(mirror);
addToImageHistory({ url: item.url, prompt, token: req.user?.token});
addToImageHistory({
url: item.url,
prompt,
inputPrompt: req.body.prompt,
token: req.user?.token});
}
return result;
}