1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 07:39:41 +02:00

feat: create recipe from multiple images (#5590)

Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
Co-authored-by: Kuchenpirat <jojow@gmx.net>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
Ross 2025-06-28 22:11:12 +02:00 committed by GitHub
parent 084f99b0de
commit 95fa0af28a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 149 additions and 131 deletions

View file

@ -157,17 +157,19 @@ export class RecipeAPI extends BaseCRUDAPI<CreateRecipe, Recipe, Recipe> {
return await this.requests.post<string>(routes.recipesCreateUrlBulk, payload);
}
async createOneFromImage(fileObject: Blob | File, fileName: string, translateLanguage: string | null = null) {
async createOneFromImages(fileObjects: (Blob | File)[], translateLanguage: string | null = null) {
const formData = new FormData();
formData.append("images", fileObject);
formData.append("extension", fileName.split(".").pop() ?? "");
fileObjects.forEach((file) => {
formData.append("images", file);
});
let apiRoute = routes.recipesCreateFromImage;
if (translateLanguage) {
apiRoute = `${apiRoute}?translateLanguage=${translateLanguage}`;
}
return await this.requests.post<string>(apiRoute, formData);
return await this.requests.post<string>(apiRoute, formData, { timeout: 120000 });
}
async parseIngredients(parser: Parser, ingredients: Array<string>) {